Jeenode + roomboard: switching output from Homeseer

All about Arduino, Jeenode and other Clones (hardware & Software)

Moderator: Mdamen

jakkes
Member
Member
Posts: 167
Joined: Sat Oct 10, 2009 2:09 pm
Location: Netherlands

Jeenode + roomboard: switching output from Homeseer

Post by jakkes »

I got the Jeenode and the roomboard working for a while now.
In the sketch there is also a LED defined.
It switches on when a movement is detected from the PIR.

In the Homeseer "plugin" there are buttons aside the device which could indicate that it is possible to switch the LED on/off...

In the sketch there is a decision rule which switches the LED on/off.

How do i have to adjust the sketch to switch the LED on/off using the Homeseer Plugin???
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

In the sketch there is also a LED defined.
It switches on when a movement is detected from the PIR.
So you managed to uncomment the LED definition code so that it shows up in Homeseer. Great :)
When you use the Buttons, HomeSeer sends a message to the JeeNode which triggers the execution of the overRuleMessage() in the JeeNode sketch.
There the status of the device is set and overruled so that Decisionrules will no longer influence the device status.

The next step you have to take is to modify the hard coded switching of the LED in the sketch, which is at lines 722-726.
As you can see this is too hard coded as it is right now; I left it in as it was, since this is a good exercise :)

Just try it and report back if you're running into problems.
jakkes
Member
Member
Posts: 167
Joined: Sat Oct 10, 2009 2:09 pm
Location: Netherlands

Re: Jeenode + roomboard: switching output from Homeseer

Post by jakkes »

i think that i have another sketch.... on line 709 to 731 it says:
void loop() {

#if SERIAL || DEBUG
Serial.print('#');
delay(2);
#endif

#if PIR_PORT
if (pir.triggered()) {

payload.moved = pir.state();

#if SERIAL || DEBUG
delay(2); // without this delay, reception is garbage...
Serial.print("PIR "); Serial.println((int)payload.moved);
delay(2);
#endif

// update the devices and report to Homeseer.
updateSystem();
doReport(); // !!! kan dit niet vanuit updatesystem?

}

Also i cannot find the overRuleMessage() in my sketch...
(I am using "JeeNode for Homeseer Low Power")
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

That's right, wrong sketch.
This version doesn't support controlling the LED at all.

PS.
Why? Because it's low power, which means almost always off, so it cannot receive messages.
jakkes
Member
Member
Posts: 167
Joined: Sat Oct 10, 2009 2:09 pm
Location: Netherlands

Re: Jeenode + roomboard: switching output from Homeseer

Post by jakkes »

I followed the handout allready...., but used the low power variant...

Should it also be visible in the homeseer log? (when switching the led within Homeseer....)

I tried using the "normal" variant, but was not able (jet) to get it working
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

In the log yes, not in the LED status.
It should not be, cause the only thing Homeseer does is send the overrule message to the JeeNode, it doesn't "locally" adjust the LED status by itself.
Only when a status update is coming from the JeeNode, the LED is updated.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

Wrong!, switching the LED will not appear in the log. I checked it.
This can easily be changed by adding a hs.writelog() in the subs onMEssage() and offMessage, around line 333 in the jeeNode.txt script.
jakkes
Member
Member
Posts: 167
Joined: Sat Oct 10, 2009 2:09 pm
Location: Netherlands

Re: Jeenode + roomboard: switching output from Homeseer

Post by jakkes »

not having any success here for now.....

Is there a basic sketch somewhere where i can start from?
ie just switching one led on/off
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

Yes, the sketch that is used in the handout.
There's a LED device in the sketch, but it's commented out.
With a few adjustments this sketch can be used with a LED, since it's not low power it will be able to receive messages from Homeseer.
Just try it. If you think you can't manage that, I will see if I can create a "LED-only" version for you later this evening.
Including notes about what I changed, so that next time you can try yourself with a relay or whatever you want.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

I made a sketch for switching one LED on/off.

I stripped the original sketch but left in all the handy stuff like the messaging etc. and all other stuff you need to be able to communicate with HS.
Remember to delete all the (non-JeeLink) devices in Homeseer before you start the sketch; devices will be recreated automatically once the JeeNode "boots" with the new sketch running :)
JeeNode_for_Homeseer_LED.rar
(3.78 KiB) Downloaded 581 times
Hey, and it's 2-way of course, ain't that neat :lol:
jakkes
Member
Member
Posts: 167
Joined: Sat Oct 10, 2009 2:09 pm
Location: Netherlands

Re: Jeenode + roomboard: switching output from Homeseer

Post by jakkes »

Thanks!!!

I will try it tomorow!!!
User avatar
esschenk
Member
Member
Posts: 426
Joined: Sun Feb 17, 2008 10:34 pm
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by esschenk »

Hello,

I have tried the sketch the led is working great with the status buttons
But when I make an event the led status is changing within Homeseer to on
But the led is not going on.
When I press the on button then the led is going on.

Do you have also an example for a sketch with an input and a output

Thanks

Ed
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

What you are doing is probably setting the LED value from the event? I don't think that will work.

The LED buttons are created like this (On button as example):

Code: Select all

hs.DeviceButtonAdd hc&dv.dc,"jeeNode.txt(""onMessage"","""& dv.dc & """)","On"
Explanation: what happens is that when you click the LED "On" button, the onMessage() routine in the JeeNode.txt script is executed with the devicecode as parameter.
If you're able to the same from your event, then it should work from an event also.

OK, I gave HS Events a try, here's an LED ON action that works for me (my LED's HSCode is ^8):
Capture13-12-2010-23.24.23.png
Capture13-12-2010-23.24.23.png (7.93 KiB) Viewed 13367 times
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by Digit »

PS Ed,

Do you mean Analog/Digital Input/Output?
User avatar
esschenk
Member
Member
Posts: 426
Joined: Sun Feb 17, 2008 10:34 pm
Location: Netherlands
Contact:

Re: Jeenode + roomboard: switching output from Homeseer

Post by esschenk »

Hello,

Yes that’s what I am doing
Device Command: nodeId: 1 LED1 Value Set set to On
I can only make a choice between value set on or off
I will try your example when I come home

Ed
Post Reply

Return to “Raspberry, Arduino, Cubietruck and other clones Forum”