PiDome does not show devices that seem to have been discovered



  • Hello,

    My first post, so sorry in advance 🙂

    I'm kinda stuck.
    I managed to get a serial gateway (MySensors 1.5) working with PiDome server (0.1-SNAPSHOT-2016-06-10.691) on my RPi2.
    Following instructions found in all sort of places (like: https://pidome.org/support/manual/devices/supported-devices/mysensors-devices.html) I tried to add a simple BinarySwitchSensor (with a button) through Device discovery. Here is what happens:

    1. Peripheral is correctly found and MySensors driver assigned to it
    2. Going to Device discovery allows me to start discovering devices, which I start
    3. I activate my sensor
    4. Sensor gets discovered
    5. I assign it a new id = 1
    6. Id seems to be assigned to the sensor
    7. no device is shown in PiDome
    8. I am unable to 'rediscover' the sensor as it already has an id

    Here are some logs from PiDome and Serial Monitors:

    GATEWAY

    Gateway info
    Gateway information

    Version Waiting for gateway
    Last receive time 25-06-2016 09:17:52
    Last send time 25-06-2016 09:17:50
    Last known messages
    Below is a list of last known 64 messages

    25-06-2016 09:17:520;0;3;0;9;read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
    25-06-2016 09:17:500;0;3;0;9;read: 1-1-0 s=255,c=3,t=6,pt=1,l=1,sg=0:0
    25-06-2016 09:17:500;0;3;0;9;read: 1-1-0 s=255,c=0,t=17,pt=0,l=5,sg=0:1.5.4
    25-06-2016 09:17:500;0;3;0;9;read: 1-1-0 s=255,c=3,t=15,pt=2,l=2,sg=0:0
    25-06-2016 09:17:500;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    25-06-2016 09:17:450;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=13,pt=0,l=1,sg=0,st=fail:1
    25-06-2016 09:17:450;0;3;0;9;send: 0-0-255-255 s=255,c=3,t=4,pt=0,l=1,sg=0,st=bc:1
    25-06-2016 09:17:45Trying assigning address '1' to a new node
    25-06-2016 09:17:400;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    25-06-2016 09:17:380;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    25-06-2016 09:17:360;0;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
    25-06-2016 09:17:340;0;3;0;9;send: 0-0-255-255 s=255,c=3,t=8,pt=1,l=1,sg=0,st=bc:0
    25-06-2016 09:17:340;0;3;0;9;read and forward: 255-255-255 s=255,c=3,t=7,pt=0,l=0,sg=0:
    25-06-2016 09:16:390;0;3;0;14;Gateway startup complete.
    25-06-2016 09:16:390;0;3;0;9;gateway started, id=0, parent=0, distance=0

    SENSOR

    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    sensor started, id=255, parent=0, distance=1
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    req id
    send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
    read: 0-0-255 s=255,c=3,t=4,pt=0,l=1,sg=0:1
    send: 1-1-0-0 s=255,c=3,t=15,pt=2,l=2,sg=0,st=ok:0
    send: 1-1-0-0 s=255,c=0,t=17,pt=0,l=5,sg=0,st=ok:1.5.4
    send: 1-1-0-0 s=255,c=3,t=6,pt=1,l=1,sg=0,st=ok:0
    id=1
    send: 1-1-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:1

    ...from that point on... silence.

    Now, to check that my gateway is ok I unplugged it from RPi2 and plugged into my pc to start a Serial Monitor through Arduino IDE. NB. The sensor is still working with given id=1.
    After pressing the sensor button a couple of times:
    send: 1-1-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:0
    send: 1-1-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:1
    send: 1-1-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:0
    send: 1-1-0-0 s=3,c=1,t=16,pt=2,l=2,sg=0,st=ok:1
    ...here is what I get from the gateway's serial monitor:
    1;3;1;0;16;0
    0;0;3;0;9;read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
    1;3;1;0;16;1
    0;0;3;0;9;read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:0
    1;3;1;0;16;0
    0;0;3;0;9;read: 1-1-0 s=3,c=1,t=16,pt=2,l=2,sg=0:1
    1;3;1;0;16;1
    ...which suggests the communication is working, but for some reason PiDome won't record the sensor as a device.

    Any ideas?

    A few extra info:

    • both gateway and sensor are on Arduino Nano
    • the gateway uses NRF24L01+PA+LNA with an antenna
    • the sensor uses NRF24L01+
    • both above NRF24L01+'s are fitted with 47uF caps
      Also, I tried different NRF24L01+ with different Nanos. Same result.

    Please help.



  • So, it seems that PiDome should restart the node after assigning a new id, but it doesn't.
    0_1466865614970_upload-a83b0e46-3357-467e-b11a-02e6158f0923

    also sometimes I get this line from the gateway when trying to assign an id to node.
    0;0;3;0;9;send: 0-0-1-1 s=255,c=3,t=13,pt=0,l=1,sg=0,st=fail:1



  • Ok, after further investigation it seems that the sensor does not get the node ID set until it 'moves' i.e. until there is an action on it.
    I am using the stock (coming with 1.5) version of BinarySwitchSensor sketch as well as stock version of SerialGateway.

    This means that the order of events is:

    • gateway discovers
    • through controller id is sent but it is not set on sensor side
    • controller tries to reboot the sensor but fails due to mismatch in id's (it tries to reboot node by id other than 255)
    • sensor 'moves' (senses - here, press of a button) which makes it read the previous set id message (I_ID_RESPONSE) and this sets the ID (but it is too late).

    Is this suppose to work like that? Am I missing something?
    Any help will be really appreciated.



  • Also, working on 2 serial monitors, I noticed the same behaviour as through controller (I was sending my own messages to gateway).

    Is dynamic assigning node ID working in general and in PiDome?



  • Ok, I give up. I really don't know how is this supposed to work.
    There is no immediate reaction from the sensor (with stock BinarySwitchSensor sketch) on commands from the gateway (like I_ID_RESPONSE or I_REBOOT).

    Separately it seems the I_REBOOT simply doesn't work - it makes the L led blink ultra fast and freezes the arduino.

    I now tried this on arduino pro-mini 3.3v as the sensor, the same behaviour.

    Am I missing something obvious?


  • Plugin Developer

    I can't speak for PiDome, but regarding requesting and assigning node ids, this will only be relevant until the first time the node gets a node id. Then it will store the id in its eeprom, and use that id on further messages and reboots. You have to clear the eeprom of the node with a clear eeprom sketch, to make it request a new node id again.

    This is how requesting id should work, in my experience:

    1. A fresh node, with no stored id, and no manually set node id, sends a request for id. This will be an internal message of subtype 3.
    2. The gateway receives the message for requesting a node id and relays it to the connected controller.
    3. The controller answers with an internal message of subtype 4 and with the new node id as payload.
    4. The gateway broadcasts this message.
    5. The node receives the message and sets the node id as its own and saves it in the eeprom. The node will use the new node id for all further messages.

    I don't believe a restart is necessary per se, after a node has received its requested node id. It might be that PiDome wants all presentation messages etc after the restart to come from the correct node id.

    Regarding "fail" in the serial log, that means the message was not sent successfully. This is often power and/or range related.



  • @martinhjelmare

    Hi, thanks for your reply.
    I did spend some time going through documentation, forums and testing the library and am aware of the eeprom and the fact it needs to be cleared to remove the id from node.

    I see and agree with your process of requesting id. I noticed (when connected to serial monitors) no restart is really needed.
    Oddly, with the example sketch BinarySwitchSensor, considering your process point no.5, the node will save the new, given id only on action (press of a button, or when it receives the id when loading up). In other words it does not 'listen' for it in a standby mode after it loaded up. I believe PiDome straight after sending the I_ID_RESPONSE message through gateway it attempts I_REBOOT with the new id (which at that point no node has - as no 'action' has been done), thus the 'fail' message.

    Separately, I don't see how I can make I_REBOOT working on its own (didn't work for me at all, or was putting arduinos in a weird 'hanging' state - L led blinking quickly and no response to anything - even reset button - only power down helps).

    After spending a few days on this, I don't see a way how I can add a device to PiDome, so it would be great to hear if someone succeeded and find out how. 🙂

    Thanks again for your help. I will keep digging, but probably move to a different controller, or write something of my own.


  • Plugin Developer

    The default BinarySwitchSensor example doesn't have a call to process messages in the loop. A node will not process any incoming messages during the loop without gw.process in the loop. If you want it to do that, just add it in the loop.

    Requesting id and getting a node id is supposed to happen during setup/presentation. I'm not sure if there's a "timeout" for this, that will make the node continue to the loop without everything setup. That would be a bit weird, I think. Are you sure the node doesn't have a node id assigned already?



  • @martinhjelmare
    Hi martin,
    Again thanks for sticking with me 🙂

    To start, I'll answer your question: Yes, I am positive about the lack of id on the node to start with. Once the node is in eeprom of the sensor PiDome device discovery doesn't 'see' the sensor. The serial monitor confirms all this as well.

    Yes, I did try what you suggest. Actually I tried 2 things:

    • add gw.process into the loop to capture the id at any time after the start up of the node
    • send a message to give id during the setup of the node

    In both cases, the sensor gets its id, but after that arduino goes into this weird mode of L led blinking fast and 'hanging' - no idea why this is happening.

    However, I don't see how either of this is practical:

    • gw.process in the loop for a BinarySwitchSensor seems pointless, and then, if you want something running on battery, in deep sleep, it makes even less sense as the sensor would be constantly 'alive'
    • in order to assign id on sensor startup you need to be extra quick, as the startup takes maybe a second, in which you would need to let PiDome discover the sensor, click the new box of the sensor on the web page, type in new id / click the confirmation button (all in that one second - which seems mad, but I managed to do that)

    As mentioned, if you do either, then arduino gets into this weird 'hanging' state and is unresponsive (with gw.process in sketch and a short script that sends I_ID_RESPONSE and I_REBOOT from gateway one after the other quickly, this is reproducible for me).

    Therefore, I really don't see how adding nodes to PiDome can work (unless there is something really wrong with all my arduinos).


  • Plugin Developer

    I imagine the idea is like this:

    1. Node requests id, continuously during setup.
    2. Node id is assigned manually in PiDome interface.
    3. Node receives the id, and continues with setup.
    4. PiDome sends reboot to node with node id.
    5. Node reboots and starts with correct id from the beginning.

    The problem I see is that one have to make sure the node is listening and processing commands and is still in setup when the controller sends the reboot command. This could be done with a call to wait for some time in setup directly after the call to begin.

    I don't know why your arduino doesn't reboot properly.



  • I like that process. I suppose I can try to tweak the setup section of the sketch (or maybe somewhere in the loop) to listen to I_ID_RESPONSE (I thought this is something that should be happening anyway).

    Other thing is figure out why I_REBOOT doesn't work. :?

    Thanks for the discussion!



  • I have been using PiDome since its infancy and testing it's beta versions. you need to tell it otherwise each node will assign it's own I'D which can be seen in a serial monitor on start.

    To change a node I'D you need to firstly specify it's I'd with #define NODE_ID 10// for example and with the gateway.begin statement.i.e

    Gateway.begin (null, NODE_ID,false, 0);

    Once the node is running head over to PiDome and select Add/Remove Device NOT device discovery, enter the name of the node then at the bottom enter the NODE_ID as per your code.save and start.

    Now go to custom devices, add new device and enter the required fields regarding group and data fields, update the device, restarting the node you should see the data being sent via serial on the node. Check the initial lines of the output as these will tell you your node I'D gateway I'd and other info. Eg.
    0_1467034969246_20160627_143950.jpg

    0_1467035084760_20160627_144349.jpg

    0_1467035107365_20160627_144435.jpg

    You can see in the serial output the line:
    Sensor started id=22 parent=0
    That tells you your NODE_ID is 22 and the parent or gateway is 0 which is default. And check it's not started as a repeater node by using "false" in the gw.begin () statement.



  • @sudo_bash80

    Hi, thanks for the reply.
    I did have a brief look at this route of adding nodes, but will give it another go, however, if I remember correctly there were some UI issues where the name of the node was not being recognised.
    Need to retry and will update the thread.



  • No problem, hope it helps! That's just the way I've always done it is like to keep track of it all, I have a few nodes connected..see pic! Good luck.0_1467057595777_Screenshot_20160627-114639.png


Log in to reply
 

Suggested Topics

9
Online

11.4k
Users

11.1k
Topics

112.7k
Posts