We have moved at community.getvera.com

Author Topic: Arduino Relay Node Sensor - Help  (Read 10364 times)

Offline lininger

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
Arduino Relay Node Sensor - Help
« on: April 26, 2014, 10:03:49 pm »
I have an Arduino gateway and motion sensor, setup and they have been running for a month without problems.  They have been setting within 5 feet of each other.  Both are using the latest 1.3b3 (71afb55c) library.

I built an Arduino Relay Node and the MySensors gateway sees it just fine.  It is also running the latest 1.3b3 (71afb55c) library.  The relay is 4.5 meters from the gateway and has a line of sight with it.  The motion sensor was moved around the corner of a wall and is 2.5 meters from the relay node and has a line of sight with it.

I have 4.7uF capacitors on the wireless boards between power and ground.  They are the 24L01 board.

I am unable to get the motion sensor to send its signal via the relay node.  I have been looking at the relay code, very simple, trying to figure out what I have done wrong.  When I look at the vera log I see the following arduino messages.


After restarting the Vera I see this block of message, all looks OK.

09   04/26/14 21:14:33.442   JobHandler_LuaUPnP::Run device 98 Arduino Gateway room 0 type urn:schemas-arduino-cc:device:arduinonode:1 id 1;255 parent 97/0x8f9558 upnp: 0 <0x2ae43000>
09   04/26/14 21:14:33.442   JobHandler_LuaUPnP::Run device 99 Arduino Motion 1:0 room 0 type urn:schemas-micasaverde-com:device:MotionSensor:1 id 1;0 parent 97/0x9001e0 upnp: 0 <0x2ae43000>
09   04/26/14 21:14:33.442   JobHandler_LuaUPnP::Run device 112 Arduino Relay room 0 type urn:schemas-arduino-cc:device:arduinorelay:1 id 3;0 parent 97/0x911a98 upnp: 0 <0x2ae43000>
09   04/26/14 21:14:33.450   JobHandler_LuaUPnP::Run device 97 MySensors Gateway room 0 type urn:schemas-arduino-cc:device:arduino:1 id  parent 0/0x8fec18 upnp: 0 <0x2ae43000>
50   04/26/14 21:14:38.912   luup_log:97: Arduino plugin: loading library L_Arduino ... <0x2b777680>
50   04/26/14 21:14:38.941   luup_log:97: Arduino plugin: library L_Arduino loaded __LEAK__ this:110592 start:1105920 to 0xf00000 <0x2b777680>
50   04/26/14 21:14:38.942   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,PluginVersion, 1.3, 97 <0x2b777680>
50   04/26/14 21:14:38.942   luup_log:97: Arduino: Using network connection: IP address is 192.168.101.66:5003 <0x2b777680>
50   04/26/14 21:14:39.045   luup_log:97: Arduino: Sending: 0;0;4;4;Get Version __LEAK__ this:16384 start:1122304 to 0xf04000 <0x2b777680>
50   04/26/14 21:14:39.057   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,ArduinoLibVersion, 1.3b3 (7afb55c), 97 <0x2e1ba680>


However, every time I press the reset button on the arduino board, of the relay node, I see the following three message lines.

50   04/26/14 21:14:54.863   luup_log:97: Arduino: Presentation: 3;255;0;18;1.3b3 (7afb55c) <0x2e1ba680>
02   04/26/14 21:14:54.875   luup_log:97: Arduino: Incoming internal command '3;255;4;7;0' discarded for child: nil <0x2e1ba680>
02   04/26/14 21:14:54.888   luup_log:97: Arduino: Incoming internal command '3;255;4;14;Relaying Node' discarded for child: nil <0x2e1ba680>
02   04/26/14 21:14:54.900   luup_log:97: Arduino: Incoming internal command '3;255;4;15;1.1' discarded for child: nil <0x2e1ba680>


I believe something is not configured correctly within the Arduino relay node device on the Vera, but I can?t figure out what it is.  Could anyone give me any pointers on what I might be doing wrong?

My Vera device configs if it helps

Device #97
----------
name - MySensors Gateway
device_type - urn:schemas-arduino-cc:device:arduino:1
ip - 192.168.101.66:5003
device_file - D_Arduino1.xml
id - 97
room - 0
time_created - 1396490806
local_udn - uuid:4d494342-5342-5645-0061-000002165e68
commUse- rs232
PluginVersion - 1.3
Unit - M
CommFailure - 1
ArduinoLibVersion - 1.3b3 (7afb55c)
LastUpdate - 0
InclusionMode - 0


Device #98
----------
name - Arduino Gateway
device_type - urn:schemas-arduino-cc:device:arduinonode:1
altid - 1;255
id_parent - 97
device_file - D_ArduinoNode1.xml
id - 98
room - 0
time_created - 1396568272
local_udn - uuid:4d494342-5342-5645-0062-000002165e68
LastUpdate - 1398559937
LastUpdateHR - 20:52
ArduinoLibVersion - 1.3b3 (7afb55c)
SketchName - Motion Sensor
SketchVersion - 1.0


Device #99
----------
name - Arduino Motion 1:0
device_type - urn:schemas-micasaverde-com:device:MotionSensor:1
altid - 1;0
id_parent - 97
device_file - D_MotionSensor1.xml
id - 99
room - 0
time_created - 1396568272
category_num - 4
subcategory_num- 3
onDashboard - 1
local_udn - uuid:4d494342-5342-5645-0063-000002165e68
Variables
Tripped- 1
LastTrip - 1398559937
LastUpdate - 1398558862
Armed - 1

Device #112
-----------
name - Arduino Relay
device_type - urn:schemas-arduino-cc:device:arduinorelay:1
altid - 3;255
id_parent - 97
device_file - D_ArduinoRelay1.xml
id - 112
room - 0
impl_file
time_created - 1398558171
local_udn - uuid:4d494342-5342-5645-0070-000002165e68
ArduinoLibVersion - 1.3b3 (7afb55c)
SketchName - Relaying Node
SketchVersion 1.0
RelayNode - Refreshing...
LastUpdate - 0


Thanks
Mike
« Last Edit: April 26, 2014, 10:07:33 pm by lininger »

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Relay Node Sensor - Help
« Reply #1 on: April 27, 2014, 01:56:16 pm »
Hmmm.. it does not look like the Relay node has been included correctly. It does not seem to have a RelayNode set (should be 0 == Gateway)

"RelayNode - Refreshing..."

I wonder why the plugin is throwing away the messages from your relay-node... You your perhaps hard reset you vera controller and see what devices is actually there. And re-include the relay-node. Also try peeking in the vera-log while including. 

Offline lininger

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
Re: Arduino Relay Node Sensor - Help
« Reply #2 on: April 27, 2014, 06:10:21 pm »
Still no go

1.   Reworked with a Nano in place of a Uno and a new Radio.
2.   Hard restart of Vera.
3.   Same distance setup.
4.   Recompiled all three sensors, with default packages from GitHub.
5.   Enabled debug in config.h

The discard log message have disappeared.  However, still no message relaying, via the relay node.

Concerns

1.   Every time the Relay Node presents itself a lu_incoming failed message is logged.
50      04/27/14 17:33:38.505   luup_log:97: Arduino: Presentation: 2;255;0;18;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:33:38.505   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 112 <0x2f962680>
01      04/27/14 17:33:38.521   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>
50      04/27/14 17:33:38.540   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Relaying Node, 112 <0x2f962680>
50      04/27/14 17:33:38.557   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchVersion, 1.0, 112 <0x2f962680>


2.   When watching the serial monitor for the individual sensors (one at a time), I don?t see any weird serial print data that would be a result of an error condition.

3.   On both the Uno and the Nano boards of the Relay Node the L LED light is always orange.  Is this correct because it is waiting for a gw.messageAvailable() for a message?

Question.

When wiring the Radio for the Relay Node, I am using the normal sensor radio wiring guide or should I be using the vera network gateway wiring guide?

Thanks


Logs


Reload Vera
09      04/27/14 17:29:48.210   JobHandler_LuaUPnP::Run device 98 Arduino Gateway room 0 type urn:schemas-arduino-cc:device:arduinonode:1 id 1;255 parent 97/0x9e6250 upnp: 0 <0x2b1ec000>
09      04/27/14 17:29:48.211   JobHandler_LuaUPnP::Run device 99 Arduino Motion 1:0 room 0 type urn:schemas-micasaverde-com:device:MotionSensor:1 id 1;0 parent 97/0x9ecf20 upnp: 0 <0x2b1ec000>
09      04/27/14 17:29:48.211   JobHandler_LuaUPnP::Run device 112 Arduino Relay 2 room 0 type urn:schemas-arduino-cc:device:arduinorelay:1 id 2;255 parent 97/0x9fe798 upnp: 0 <0x2b1ec000>

09      04/27/14 17:29:48.219   JobHandler_LuaUPnP::Run device 97 MySensors Gateway room 0 type urn:schemas-arduino-cc:device:arduino:1 id  parent 0/0x9eb958 upnp: 0 <0x2b1ec000>

50      04/27/14 17:29:51.278   luup_log:95: (MiosUpdater::Startup) Device #95-MiOS Update Utility <0x2bb1f680>
50      04/27/14 17:29:51.278   luup_log:95: (MiosUpdater::Startup) Too soon since last check. Return <0x2bb1f680>
50      04/27/14 17:29:51.283   luup_log:97: Arduino plugin: loading library L_Arduino ... <0x2bb1f680>
50      04/27/14 17:29:51.311   luup_log:97: Arduino plugin: library L_Arduino loaded <0x2bb1f680>
50      04/27/14 17:29:51.312   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,PluginVersion, 1.3, 97 <0x2bb1f680>
50      04/27/14 17:29:51.312   luup_log:97: Arduino: Using network connection: IP address is 192.168.101.66:5003 <0x2bb1f680>

50      04/27/14 17:29:51.415   luup_log:97: Arduino: Sending: 0;0;4;4;Get Version <0x2bb1f680>

50      04/27/14 17:29:51.426   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduino1,ArduinoLibVersion, 1.3b3 (7afb55c), 97 <0x2f962680>

50      04/27/14 17:30:15.928   luup_log:97: Arduino: Presentation: 2;255;0;18;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:30:15.929   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 112 <0x2f962680>
01      04/27/14 17:30:15.945   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>
50      04/27/14 17:30:15.964   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Relaying Node, 112 <0x2f962680>
50      04/27/14 17:30:15.981   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchVersion, 1.0, 112 <0x2f962680>

Relay Node Reset Button Pressed
50      04/27/14 17:31:01.902   luup_log:97: Arduino: Presentation: 2;255;0;18;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:31:01.902   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 112 <0x2f962680>
01      04/27/14 17:31:01.918   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>
50      04/27/14 17:31:01.937   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Relaying Node, 112 <0x2f962680>
50      04/27/14 17:31:01.954   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchVersion, 1.0, 112 <0x2f962680>

Relay Node Reset Button Pressed
50      04/27/14 17:31:09.953   luup_log:97: Arduino: Presentation: 1;255;0;17;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:31:09.953   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 98 <0x2f962680>
01      04/27/14 17:31:09.969   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>

Moved Motion Sensor within Gateway Range and reset button was pressed
50      04/27/14 17:31:09.988   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Motion Sensor, 98 <0x2f962680>
50      04/27/14 17:31:10.005   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchVersion, 1.0, 98 <0x2f962680>
50      04/27/14 17:31:10.029   luup_log:97: Arduino: Presentation: 1;0;0;1;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:31:10.048   luup_log:97: Arduino: Set Var: 1;0;1;16;1 <0x2f962680>
50      04/27/14 17:31:10.048   luup_log:97: Arduino: Setting variable 'Tripped' to value '1' <0x2f962680>
50      04/27/14 17:31:10.048   luup_log:97: Arduino: urn:micasaverde-com:serviceId:SecuritySensor1,Tripped, 1, 99 <0x2f962680>
50      04/27/14 17:31:10.049   luup_log:97: Arduino: urn:micasaverde-com:serviceId:SecuritySensor1,LastTrip, 1398634270, 99 <0x2f962680>
06      04/27/14 17:31:10.049   Device_Variable::m_szValue_set device: 99 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: LastTrip was: 1398633163 now: 1398634270 #hooks: 0 upnp: 0 v:0xa2ac30/NONE duplicate:0 <0x2f962680>
50      04/27/14 17:31:10.070   luup_log:97: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1398634270, 98 <0x2f962680>
06      04/27/14 17:31:10.071   Device_Variable::m_szValue_set device: 98 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1398633163 now: 1398634270 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f962680>
50      04/27/14 17:31:10.072   luup_log:97: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdateHR, 17:31, 98 <0x2f962680>
06      04/27/14 17:31:10.072   Device_Variable::m_szValue_set device: 98 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdateHR was: 17:12 now: 17:31 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f962680>

Relay Node Reset Button Pressed
50      04/27/14 17:31:42.216   luup_log:97: Arduino: Presentation: 2;255;0;18;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:31:42.216   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 112 <0x2f962680>
01      04/27/14 17:31:42.232   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>
04      04/27/14 17:31:42.241   <Job ID="12" Name="pollnode #17 1 cmds" Device="49" Created="2014-04-27 17:31:42" Started="2014-04-27 17:31:42" Completed="2014-04-27 17:31:42" Duration="0.139824000" Runtime="0.138527000" Status="Successful" LastNote="" Node="17" NodeType="ZWaveNonDimmableLight" NodeDescription="Outside Flood"/> <0x2b91f680>
50      04/27/14 17:31:42.252   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Relaying Node, 112 <0x2f962680>

Relay Node Reset Button Pressed
50      04/27/14 17:33:38.505   luup_log:97: Arduino: Presentation: 2;255;0;18;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:33:38.505   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 112 <0x2f962680>
01      04/27/14 17:33:38.521   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>
50      04/27/14 17:33:38.540   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Relaying Node, 112 <0x2f962680>
50      04/27/14 17:33:38.557   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchVersion, 1.0, 112 <0x2f962680>

Moved Motion Sensor within Gateway Range and reset button was pressed
50      04/27/14 17:34:23.405   luup_log:97: Arduino: Set Var: 1;0;1;16;1 <0x2f962680>
50      04/27/14 17:34:23.405   luup_log:97: Arduino: Setting variable 'Tripped' to value '1' <0x2f962680>
50      04/27/14 17:34:23.406   luup_log:97: Arduino: urn:micasaverde-com:serviceId:SecuritySensor1,Tripped, 1, 99 <0x2f962680>
50      04/27/14 17:34:23.406   luup_log:97: Arduino: urn:micasaverde-com:serviceId:SecuritySensor1,LastTrip, 1398634463, 99 <0x2f962680>
06      04/27/14 17:34:23.406   Device_Variable::m_szValue_set device: 99 service: urn:micasaverde-com:serviceId:SecuritySensor1 variable: LastTrip was: 1398634270 now: 1398634463 #hooks: 0 upnp: 0 v:0xa2ac30/NONE duplicate:0 <0x2f962680>
50      04/27/14 17:34:23.407   luup_log:97: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdate, 1398634463, 98 <0x2f962680>
06      04/27/14 17:34:23.408   Device_Variable::m_szValue_set device: 98 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdate was: 1398634270 now: 1398634463 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f962680>
50      04/27/14 17:34:23.408   luup_log:97: Arduino: urn:micasaverde-com:serviceId:HaDevice1,LastUpdateHR, 17:34, 98 <0x2f962680>
06      04/27/14 17:34:23.409   Device_Variable::m_szValue_set device: 98 service: urn:micasaverde-com:serviceId:HaDevice1 variable: LastUpdateHR was: 17:31 now: 17:34 #hooks: 0 upnp: 0 v:(nil)/NONE duplicate:0 <0x2f962680>

50      04/27/14 17:34:28.064   luup_log:97: Arduino: Presentation: 1;255;0;17;1.3b3 (7afb55c) <0x2f962680>
50      04/27/14 17:34:28.064   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,ArduinoLibVersion, 1.3b3 (7afb55c), 98 <0x2f962680>

50      04/27/14 17:34:28.132   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchName, Motion Sensor, 98 <0x2f962680>
50      04/27/14 17:34:28.148   luup_log:97: Arduino: urn:upnp-arduino-cc:serviceId:arduinonode1,SketchVersion, 1.0, 98 <0x2f962680>
50      04/27/14 17:34:28.171   luup_log:97: Arduino: Presentation: 1;0;0;1;1.3b3 (7afb55c) <0x2f962680>




Offline BulldogLowell

  • Hero Member
  • *****
  • Posts: 1576
  • Karma: +191/-85
Re: Arduino Relay Node Sensor - Help
« Reply #3 on: April 27, 2014, 08:36:06 pm »
@lininger

can you post your sketch?

Offline lininger

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
Re: Arduino Relay Node Sensor - Help
« Reply #4 on: April 27, 2014, 09:46:19 pm »
// Example sketch showing how to create a node thay relays messages
// from nodes far from gateway back to gateway.
// Important here is that node uses Relay-class and calls
// gw.messageAvailable() frequently. This sketch should not
// sleep.

#include <Relay.h>
#include <SPI.h>
#include <EEPROM.h> 
#include <RF24.h>

Relay gw;

void setup() 

  gw.begin();

  //Send the sensor node sketch version information to the gateway
  gw.sendSketchInfo("Relaying Node", "1.0");
}

void loop()
{
  // By calling this regularely you route messages in the background
  if (gw.messageAvailable()) { 
    // Handleincoming message for this node here...
  }

}

Offline BulldogLowell

  • Hero Member
  • *****
  • Posts: 1576
  • Karma: +191/-85
Re: Arduino Relay Node Sensor - Help
« Reply #5 on: April 27, 2014, 10:10:54 pm »
I think you need to define what to do if you see the message.  You have an IF test without a consequence.

Code: [Select]
void loop()
{
  // By calling this regularely you route messages in the background
  if (gw.messageAvailable()) { 
    // Handleincoming message for this node here...
  }

}

you need to replace the comment
Code: [Select]
   // Handleincoming message for this node here...
with instructions.

it seems to me that the sketch posted on github is not complete for your application.

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Relay Node Sensor - Help
« Reply #6 on: April 28, 2014, 01:20:43 am »

you need to replace the comment
Code: [Select]
   // Handleincoming message for this node here...
with instructions.

it seems to me that the sketch posted on github is not complete for your application.

It is complete for a node that just should relay messages from other nodes.

Offline BulldogLowell

  • Hero Member
  • *****
  • Posts: 1576
  • Karma: +191/-85
Re: Arduino Relay Node Sensor - Help
« Reply #7 on: April 28, 2014, 07:13:39 am »
It is complete for a node that just should relay messages from other nodes.

I'm scratching my head trying to understand that one.  Would you mind to explain how this sketch works to telegraph a message from node to node?

Programmatically, is it in RF24.h or one of the other library files?


Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Relay Node Sensor - Help
« Reply #8 on: April 28, 2014, 07:43:47 am »
@lininger

Yes, you should do the normal wiring of radio for Relaying nodes.

Quote
Code: [Select]
01      04/27/14 17:30:15.945   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>

Which means this line fails

Code: [Select]
setVariable(incomingData, iChildId, incomingNodeId) -- This will set relay node variable and update LAST_UPDATE for node device

So it looks like incomingNodeId somehow is nil. Will have to check with Bruce.. but I doubt this explains why you arean't receiving data through you relay node.


@Bulldoglowell
Yes, the logic is in Relay.cpp. You can read more  in the sourcecode.

Behind the scene gw.messageAvailable() checks if there is any new messages in the radio queue. If message was addressed for some other node it forwards it using an internal routing table. And finally If the message was addressed for the relay-node itself the function returns true. 



Offline BulldogLowell

  • Hero Member
  • *****
  • Posts: 1576
  • Karma: +191/-85
Re: Arduino Relay Node Sensor - Help
« Reply #9 on: April 28, 2014, 08:05:34 am »
Yes, the logic is in Relay.cpp. You can read more  in the sourcecode.

got it, thanks!



Offline lininger

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
Re: Arduino Relay Node Sensor - Help
« Reply #10 on: April 28, 2014, 06:56:53 pm »
I just built a quick temperature sensor, using the same 24L01 board I was trying to get the Relay Node to work with.  It works perfectly.  I just can?t get the relayingNode.ino to work.  Has anyone else successfully built and is using a relaying node, successfully?  I added a ton of debug prints and best I can tell no messages are arrive at the messageAvailable()in the Relay.ccp module.

Pipe    IS AWAYS 224 which is odd because it looks for pipe<7
boolean available = RF24::available(&pipe);   IS ALWAYS 0

After adding the temperature sensor I noticed both the temperature and motion sensor have two panels in the Vera devices window, while the non-functional Relaying Node only has one.  Should it also have a second panel as well?  Might it be something is amiss within the D_ArduinoRelay1.json or D_ArduinoRelay1.xml Luup files? See attached image.

Offline blacey

  • Sr. Member
  • ****
  • Posts: 251
  • Karma: +30/-1
Re: Arduino Relay Node Sensor - Help
« Reply #11 on: April 29, 2014, 01:26:46 am »
@lininger

Yes, you should do the normal wiring of radio for Relaying nodes.

Quote
Code: [Select]
01      04/27/14 17:30:15.945   LuaInterface::CallFunction-2 lu_incoming failed [string "module("L_Arduino", package.seeall)..."]:252: attempt to call global 'setVariable' (a nil value) <0x2f962680>

Which means this line fails

Code: [Select]
setVariable(incomingData, iChildId, incomingNodeId) -- This will set relay node variable and update LAST_UPDATE for node device

So it looks like incomingNodeId somehow is nil. Will have to check with Bruce.. but I doubt this explains why you arean't receiving data through you relay node.


The root cause for the exception is that we didn't define the local function setVariable() before we attempted to call it so Lua complains that we tried to call a nil global function.  I just submitted a fix in a pull request that Henrik will commit once he peer reviews the code. 

@llinger, if you are game, please regress your Relay Node tests to see if this resolves the issue you reported.
Three Vera-3 (Home, Seasonal 1 & 2) - Firmware: 1.5.622,   Zwave: 3.20 L:1
One Vera-Edge (Dependent) - Firmware: 1.7.1707, Zwave: 4.5 L:1

Offline lininger

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
Re: Arduino Relay Node Sensor - Help
« Reply #12 on: April 29, 2014, 08:52:07 am »
Sure, will wait for the next GitHub update.

Thanks

Offline lininger

  • Newbie
  • *
  • Posts: 18
  • Karma: +1/-0
Re: Arduino Relay Node Sensor - Help
« Reply #13 on: April 29, 2014, 08:50:06 pm »
Blacey,

Thanks for the fast solution and update to the code.

I grabbed the latest from GitHub (541cd43) and recompiled all the sensors.  Also replaced the L_Arduino.lua file (actually I replaced all of them just to be safe).

The sensor presentation in the Vera now shows Parent Node: GW: and all the Last Update: are filled in.

Questions (just for my understanding as I delve into this)

1.    What does the Parent node: GW represent?  (I know it is gateway), but does it mean the device communicated directly with the Gateway Sensor, bypassing the relaying node?  Or is it representing something totally different?  Will it show anything other than GW or Nothing?
2.   When the Last Update: on the relaying node panel changes time does that mean info was relayed to the gateway?
3.   Is there a way to tell if the relaying node is doing its job visually without hooking up a PC to it and serial monitoring with prints?

Again thanks for taking the time to look into this.

ML

Offline hek

  • Moderator
  • Hero Member
  • *****
  • Posts: 714
  • Karma: +60/-1
Re: Arduino Relay Node Sensor - Help
« Reply #14 on: April 30, 2014, 01:09:32 am »
1. Yes, it looks like your sensor is bypassing the relay node. When sensor detects that it is unable to communicate through its "Parent Node" (20 missed messages) it will try to find a new parent. When searching for  nodes your relay-node might answer and the  sensor uses this as parent.

2. No, Last update on relay node will update when relay is restarted or any physically attached sensors reports a value. Relayed messages does not count.

3. Hooking up a pc is the easiest option to see what is happening in the relaying node. Turn on debug prints in Config.h.