jeenodes wont work - please help a desperate guy
Hi,
I tried almost everything, but my jeenodes do not work.
In the attachment you can find my applets, they are quite similar to the given examples here.
My problem so far:
I managed to be able to initialize the basenode as well as the outputnode.
Also the serial port is correct, as I verified several times!
But when I try to change e.g. the state of the 1st port on the outputnode, I can see the correct state-changing in the xfx-viewer on that port (see also the screenshot), but neither in the serial section of the xfx-Viewer, nor on the jeenode itself anything happens.
Can anybody help me, I am really derperate!
Thank you,
Markus
Attachment | Size |
---|---|
WM_jeenodeApplet.lua | 860 bytes |
WM_relaysApplet.lua | 1.12 KB |
2013-06-19_1636.png | 132.56 KB |
I will verify later when I get back to my machine but I think you should see a serial.comms class xap message sent from plugboard to xap-serial.
the data sent will be 1,48,2 s (from memory) first digit is port, second is ascii 0. (Off) third is jeenode ID and then s for send.
try connecting to base node directly with microcom after killing xap-serial and type the above data in manually, or 1,49,2 s for on.
If this fails also then I would suggest going back to HAhCentral with config and double checking your frequency, I had an issue where it was changed by error. No config version doesn't report so its not easy to tell if its correct. Is the id set as 1 on the base node?
ill keep thinking!
Garry
Update:have noticed that I did modify the output node sketch quite heavily when then initial buffer issue existed. As such I send 1,1,2 s. not 1,49,2 s
the point of this is that I have noticed the output node sketch on google code seems to want ascii characters for the port ID too?!
maybe try sending 49,49,2 s and see if this works. If so there is a bug in output node sketch.
byte port = rf12_data[0] - '0'; |
if(port < 1 || port > 4) return; |
Should possibly be:
byte port = rf12_data[0] ; |
if(port < 1 || port > 4) return; |
Again, been a while so its from memory but I don't think the characters show on screen while in microcom. Just type them anyway and press enter.
Concerned your not seeing the reported data back from your output node though (every 5 mins). Do you not get any good data if microcom left open for a while?
We can pick this up on Sunday. Well get to the bottom if it!!
garry
Just remembered that to test jeenode functionality you can flash both nodes with the rf12demo sketch and power one remotely (flashed with ID 2) and connect the other to a serial port(ID 1)
send 2 a command via the serial port to ID1 and all being well the remote node wil ack receipt, proving jeenodes are operating correctly.
This may work with two HAHcentral nodes, I've never tried it
Garry
You can drive the Output node with the RF12DEMO sketch and not use ANY of the HAH infrastructure.
So I would start there as a 1st step this will prove there is comms between the two units and that you can control it using basic command sequence. After that you can reflash the base node with HAHCentral and integrate with the rest of the system.
Using RF12DEMO you can drive it with strings like this
nodeid,port,state s
So for example as your output node is configured as 2. To enable Port4 you would use
2,4,1 s
And to turn off port 4
2,4,0 s
These commands can be entered directly at the command line prompt in the HAH Central sketch or RF12DEMO.
Not sure if it will help but I uploaded a Sequence diagram to the output node section to show process flow.
Be aware if you restart xap-serial you MUST restart the plugboard so the Serial.Setup message is sent again.
http://www.dbzoo.com/livebox/hah_hahnode#output_node
Brett
Brett, is that correct? I thought the data structure was:
<payload>,<id> s |
Therefore port 4 on would be 4,1,2 s
it also appears the output sketch requires ascii characters ie 52,49,2 s
Am I missing something somewhere? My output node are heavily modified so cannot remember how they worked when in "virgin" state
thanks
Garry
OK in the Output node we do this.
function OutputNode:portCmd(e)
-- The output port is the last character of the key (a little kludgy)
local port = e.key:sub(-1)
self:sender(port ..","..string.byte( utils.choose(e.state=="off",0,1)))
end
So the first bit is PORT,STATE
Then we pass this DATA into here:
function Nodule:sender(data)
xap.sendShort(string.format([[
xap-header
{
class=Serial.Comms
target=%s
}
Serial.Send
{
port=%s
data=%s,%s s
}]], self.cfg.target, self.cfg.port, data, self.cfg.id))
end
So we get PORT,STATE,NODE s
OK I'm wrong I can't even read my own code, how bad am I !
UPDATE: Only the ON/OFF is required to be an ASCII value. No sure why that was but there go.
Port 4 ON (49) to node 2.
4,49,2 s
Brett
Now that is curious in the SKETCH it IS assuming both the PORT and the STATE are ASCII values.
static void doIncoming() {
byte port = rf12_data[0] - '0';
if(port < 1 || port > 4) return;
byte state = rf12_data[1] -'0';
if(state > 1) state=1;
setPort(port, state);
}
So does that mean there is a bug in the outputnode.lua code?
local port = e.key:sub(-1)
Should really be.
local port = string.byte(e.key:sub(-1))
Gary did you make any modifications to the sketch? Or are you running a native output node?
Brett,
I did modify the lua and sketch so that it didn't send ascii values at all for either port or state as I had an issue with the memory allocation if you remember. Ive not bothered swapping it back since you fixed the issue.
I have therefore never tested a virgin output node on the code aince you fixed the memory issue.
Looks like I may have dodged the bug but for other reasons.
Garry
Gary indeed you did I've been playing with it and its broken for me.
I've checked in a couple of changes that should sort it out so it will work as I first stated Not with ASCII representations of the numbers.
I've pushed beta 309.2 which has a modification to the outputnode.lua.
The STATE is no longer send in ASCII form, it goes native a 1 is a 1 (not 49 !). I've made a couple of changes to the backend outputnode sketch to match. I also made changes to HARDCODE a node ID and not use EEPROM save doing the two step setup, just compile and flash.
http://code.google.com/p/livebox-hah/source/detail?r=454
Brett
Markus,
What version of the HAH firmware are you on, there was a Xap-serial bug fixed recently that affected outputnodes. Is xap-serial still running?
I use output nodes fine so will check my scripts with yours later when I get home.
Garry.
another thought, did you setup output node ID as 2? Also are you using the no config HahCentral script?