jeenode - xap messages - state=?

9 replies [Last post]
Pentala
Offline
Joined: 22 Oct 2011

I'm just starting out with the HAH and a couple of jeenodes.

I've got them setup with roomnode2 and rf12demo and can see data coming into the HAH from the remote device using microcom - 

 

 [RF12demo.7] A i1 g212 @ 433 MHz

Available commands:

  <nn> i     - set node ID (standard node ids are 1..26)
               (or enter an uppercase 'A'..'Z' to set id)
  <n> b      - set MHz band (4 = 433, 8 = 868, 9 = 915)
  <nnn> g    - set network group (RFM12 only allows 212, 0 = any)
  <n> c      - set collect mode (advanced, normally 0)
  t          - broadcast max-size test packet, with ack
  ...,<nn> a - send data packet to node <nn>, with ack
  ...,<nn> s - send data packet to node <nn>, no ack
  <n> l      - turn activity LED on PB1 on or off
  <n> q      - set quiet mode (1 = don't report bad packets)
Remote control commands:
  <hchi>,<hclo>,<addr>,<cmd> f     - FS20 command (868 MHz)
  <addr>,<dev>,<on> k              - KAKU command (433 MHz)
Current configuration:

 A i1 g212 @ 433 MHz
 ? 18 36 216 230 116 139 102 48 20 206 172 103 247 98 27 65 26 14 75 93 77
 ? 34 229 215 36 57 146 85 99 47 192 154 100 180 96 3 118 68 229 192 140 71
 ? 12 223 131 243 41 180 74 219 223 103 56 213 236 106 179 30 100 113 160 128 108
 ? 184 216 15 59 106 108 242 94 19 156 12 93 49 25 8 13 232 64 227 123 188

> 1q

OK 2 0 0 211 0

The remote device is configured as node 2 and I have added the following to /etc/plugboard/jeenodeApplet.lua
# cat jeenodeApplet.lua
--[[
    JeeNode to xAP Endpoint mapping
--]]

_DEBUG=1
module(...,package.seeall)

monitor = require("xap.jeenode").monitor
RoomNode = require("xap.roomnode").RoomNode
OutputNode = require("xap.outputnode").OutputNode

info={
   version="2.0", description="JeeNode"
}

       local jeemon={
       port="/dev/ttyUSB0",
       baud=57600,
       stop=1,
       databits=8,
       parity="none",
       flow="none"
}

-- Keyed by NODE ID
local nodes = {
   [2] = RoomNode{base="dbzoo.livebox.jeenode:attic", endpoints={temp=1,lobat=1,light=1}, ttl=900},
   [3] = RoomNode{base="dbzoo.livebox.jeenode:basement", endpoints={temp=1,lobat=1}, ttl=900},
   [4] = OutputNode{base="dbzoo.wombat.jeenode:bedroom",endpoints={p1="light",p2="heater",p3="amp",p4=0}},
}

function init()
   monitor(jeemon, nodes)
end
However, the messages I am receiving in xfx don't seem to contain the information received in the serial data -
xap-header
{
v=12
hop=1
uid=FF00D804
class=xAPBSC.info
source=dbzoo.livebox.jeenode:attic.temp
}
input.state
{
state=?
text=?
}
I've tried running xap-plugboard with the debug option -d 9 but it doesn't appear to be supported with v2? I've also tried increasing the debug value in the jeenodeApplet.lua file but again it doesn't seem to log any more than at level 1?
Can anyone help with this please? 
Many thanks,
Andy

 

BoxingOrange
Offline
United Kingdom
Joined: 11 Jun 2010
JeeNode Range

> ? 18 36 216 230 116 139 102 48 20 206 172 103 247 98 27 65 26 14 75 93 77 

The above is wireless traffic from other devices and can be ignored.  Your ttl looks fine  The empty xAPBSC.info events occur when no valid message has been received, try moving the jeenode and basenode about 4-5 meters apart and see if that helps, we can work from there if it does.  I would also suggest connecting the roomnode to the HAH and using microcom to check it's config.

Karl

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Did you enable xap-serial too

Have you enabled the xap-serial daemon?  Via the web gui "Automation -> Assists -> Serial SCHEMA Service" ENABLE.

Are you seeing traffic coming in from this daemon?  That is with xFxViewer(Windows) or xap-snoop (HAH) do you see the traffic from the dbzoo.livebox.serial endpoint?

# xap-snoop -s dbzoo.livebox.Serial
xAP Snoop - for xAP v1.2
Copyright (C) DBzoo 2009-2010

xap-header
{
v=12
hop=1
uid=FF00D500
class=Serial.Comms
source=dbzoo.livebox.Serial
}
Serial.Received
{
port=/dev/ttyUSB0
data=OK 2 0 0 171 0
}

Do you have ANY other USB serial devices on the HAH, ie CurrentCost?  Are you 100% its /dev/ttyUSB0?

Plugboard does not support the -d switch - _DEBUG is an ON/OFF switch... the output will only be visible if you are running the plugboard from the command line.  Make sure you only run one at a time if the other is running kill it before starting manually.

Also you CANNOT run both xap-serial AND any microcom session to the same serial port.

Brett

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Frequency looks wrong

These modules are designed to work at 868MHz. Yours looks to be configured for 433MHz. '8b' will fix this.

Derek. 

Pentala
Offline
Joined: 22 Oct 2011
Working!

Thanks to all who responded - the main problem was down to the fact that the xap-serial daemon wasn't running. Once that had been enabled things started moving.

I've re-compiled the roomnode2 code to enable the debug option (it will then output to the serial port) and also increasing the transmit rate to make it a little easier to debug this using xap-snoop. I've attached the new compiled code below and also the sketch if anyone is interested.

Thanks to all again - I'm now a happy owner of a Livebox with working Jeenodes!

Andy

AttachmentSize
roomNode3.zip 11.8 KB
roomNode3-sketch.zip 4.21 KB
Pentala
Offline
Joined: 22 Oct 2011
Thanks DerekI hadn't realised

Thanks Derek

I hadn't realised they should have been running at 433Mhz.

I've changed them over and all is well.

Andy

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Dont enable serial

Enable serial on a BATTERY operated device is a bad idea as it will increase your power consumption.

OK for power and DEBUG NOT ok for production on batteries.

By enabling SERIAL and DEBUG you have added 10sec to the main loop due to the additional delays that where added to SLOW things down for debugging.  This also means that the report period is no longer once per 150sec its 160sec. I've not examined how the Arduino libraries implement these delay() operations hopefully with an interrupt timer otherwise you are doing a busy spin (re: sucking power).

As I said not a good idea when you go production to leave these things enabled esp. for battery powered units.

Wait you've drop down the reporting period to be once every 1 second and you have 10 seconds worth of delay loops (as mentioned above due to SERIAL/DEBUG enablement.  So really its once every 12 seconds (as you report every 2nd cycle).   You are going to chew battery. Really you need to know the temp and light readings this often?   I really advise NOT to use this with batteries unless you want to replace them every few weeks.

Brett

Pentala
Offline
Joined: 22 Oct 2011
Brett,Agree - the re-compiled

Brett,

Agree - the re-compiled version was for debugging only. Waiting 2 1/2 minutes between each transmit to see if it was being seen by xap-snoop when you are not sure if the jeenode is transmitting/receiving or even in range is a painful way to get things working. The re-compiled version allows you to check any attached devices are being seen and then, using xap-snoop, quickly check that the final position of the device will work ok.

At least then you can be sure that everything should be working whilst you wait for the transmissions.

Andy

Pentala
Offline
Joined: 22 Oct 2011
Multiple USB Devices - Jeenode & CurrentCost

Is there a reliable way to get the different devices to register on specific ports? i.e. Current Cost always on USB1 and Jeenode on USB0?

Andy

derek
Offline
Glasgow, United Kingdom
Joined: 26 Oct 2009
Enumeration is repeatable

I've tried hooking on a variety of USB attached devices. I don't know of a way to 'force' a given device to a specific USB<n> port, but I do know that for any given setup, the devices always enumerate in the same order. 

So, whilst this is a bit of a pain when you are in the setup phase and devices are being added/removed, once things settle down it's a solid environment.

Cheers,

Derek.

Hardware Info