Page 1 of 1
Strange behaviour in creating Nodes
Posted: Monday 27 June 2016 17:38
by Lemme
Hi all
I posted this first in the MySensors forum, but was advised to post here.
For background information, I use the latest v.2 beta version of MySensors, and latest development version of Domoticz. The 3 nodes that I have are 100% identical, both HW and SW. I use a serial gateway based on the RFM69 radio.
Here is the situation - when I add my 3 identical Door Switches, they are created randomly with either 1 or 2 children. All children are created with a child ID of 0 (S_LOCK ). But some of them are also created with a child ID of 255 (S_ARDUINO_NODE ).
What is the normal behaviour – 1 or 2 children created?
Below is how I do the presentation. Is there anything wrong here, should I reverse the presentation so I send the sketch info before the present? Or should there be some 'delays' to give Domoticz time to create the nodes?
Code: Select all
void presentation() {
present(CHILD_ID, S_LOCK);
sendSketchInfo("Door switch", "1.0");
}
This is my 3 Nodes:

- Nodes.jpg (88.34 KiB) Viewed 2268 times
Here the node are created with only 1 Child:

- 1_child.jpg (68.8 KiB) Viewed 2268 times
Here are a similar node created with 2 Children:

- 2_child.jpg (79 KiB) Viewed 2268 times
Best regards
Lemme
Re: Strange behaviour in creating Nodes
Posted: Monday 27 June 2016 18:03
by gizmocuz
255 is reserved for the node, and i suggest to have your CHILD_ID to 1 ?
It could also be that maybe some sensors are just a bit to far away ?
Also make sure you have 'accept new hardware' enabled in the settings
Re: Strange behaviour in creating Nodes
Posted: Monday 27 June 2016 18:53
by Lemme
Hi Gizmocuz
Thanks for answering. Just to remove any doubt, my sensors were not to far away from the gateway when I made the pairing, thats for sure. And I also enabled 'accept new hardware' in the settings before the pairing.
The 'CHILD_ID' is a variable that is set to 0. The question is, would it really make a difference to set it to 1? Does Domoticz have trouble handling ChildID's of 0? I can reflash my 3 nodes, but just want to know if this is a long shot before I do so.
Br
Lemme
Re: Strange behaviour in creating Nodes
Posted: Tuesday 28 June 2016 8:39
by gizmocuz
Why would you want to start with 0 ? Was there an original mysensors.org example with a child_id of 0 that you based your sensors code on ?
Re: Strange behaviour in creating Nodes
Posted: Tuesday 28 June 2016 8:40
by gizmocuz
So how i normally work, i have a spare arduino+rf that i use to make my mockup sketch with (demo sketch), if all is working (i use the serial log to check and log things), .... then (and only then), i start adding real hardware to the sensor, one by one, test and test
Then put it on the place where it belongs, if it is working good, i make some more if needed
Re: Strange behaviour in creating Nodes
Posted: Tuesday 28 June 2016 12:46
by Lemme
In most of the MySensors examples, the Child_id are created as 0. So this is definitely not an issue, at least from a MySensors perspective. And that is also why I use child_id 0 myself. If Domiticz have an issue with child_id 0, then I will bring that to the MySensors Forum, or maybe it could be solved in Domiticz?
I am far beyond testing now. I have created my nodes with components soldered on fabricated PCB's. So the HW is in a sort of 'production' mode, and work very well. The issues that I am experiencing right now are SW related. And I really want things to be reliable, consistent and functioning as expected 100% of the time. I have some other small issues, but I address these later.
As a way to solve the problem, does it matter what comes first during the ‘presentation’ (present/sendSketchInfo or the other way around)?
And should there be some sort of delay in the code, to give Domoticz time to initialise correctly?
This is how I do the presentation:
Code: Select all
void presentation() {
present(CHILD_ID, S_LOCK);
sendSketchInfo("Door switch", "1.0");
}
Br
Lemme
Re: Strange behaviour in creating Nodes
Posted: Tuesday 28 June 2016 21:57
by Lemme
It seems that things are partly begin to work correctly. I found out that all examples had 'sendSketchInfo' first. I also found delays in one of the examples, and I implemented that as well. This is how it looks like now:
Code: Select all
void presentation() {
sendSketchInfo("Door switch", "1.0");
wait(500);
present(CHILD_ID, S_LOCK);
wait(500);
}
I also updated MySensors library, there were som TransportProcess cleanup yesterday, and it seems that some of those changes included some changes to the presentation as well.
All nodes are now created with only 1 child of 0. So I must conclude that creating child_id of 255 is wrong.
As this seems to work now, there are now another problem. Only one of the nodes are identified correctly as an S_LOCK node. The variable V_LOCK_STATUS are identified correctly on all nodes.
All nodes now have 1 child:

- Nodes.jpg (82.17 KiB) Viewed 2191 times
This node have both S_LOCK node the variable V_LOCK_STATUS identified correctly

- 1_child.jpg (59.81 KiB) Viewed 2191 times
The remaining nodes are missing the S_LOCK, but the variable V_LOCK_STATUS identified correctly

- 2_child.jpg (60.58 KiB) Viewed 2191 times
Any clue why this is happening?
Br
Lemme
Re: Strange behaviour in creating Nodes
Posted: Thursday 30 June 2016 13:01
by gizmocuz
As explained, start with an virtual example, then implement your changes
Yes, it is important to send your sketchinfo, and sensor type's
Re: Strange behaviour in creating Nodes
Posted: Thursday 30 June 2016 13:21
by Lemme
Hi Gizmocuz
OK - I will go back to test on the Arduino board and my mockup sketch.
But I need a correct starting point. Can you be precise on what the preferred way of presenting MySensors nodes to Domoticz are?
Is it this way?
Code: Select all
void presentation() {
present(CHILD_ID, S_LOCK);
sendSketchInfo("Door switch", "1.0");
}
or this way?
Code: Select all
void presentation() {
sendSketchInfo("Door switch", "1.0");
present(CHILD_ID, S_LOCK);
}
This is at least the first way to start. I would assume that the node are first presented for the controller and created. The node are the updated with the sketch info.
Br
Flemming
Re: Strange behaviour in creating Nodes
Posted: Thursday 30 June 2016 13:26
by gizmocuz
Preferred are the examples , it does actually not matter as the two things are totally not related to each other, as long as you first present, and then update a value
Re: Strange behaviour in creating Nodes
Posted: Thursday 30 June 2016 14:28
by Lemme
Reading your answer makes me a little confused...
You wrote:
'Preferred are the examples , it does actually not matter as the two things are totally not related to each other'.
This is how the examples are constructed. The very first time a node are presented to Domiticz, Domoticz recieves first 'sendSketchInfo' and then 'present', and according to your statement that is OK as the two things are totally not related to each other.
Example A
Code: Select all
void presentation() {
sendSketchInfo("Door switch", "1.0");
present(CHILD_ID, S_LOCK);
}
But then you write:
'as long as you first present, and then update a value'.
That statement indicates that the sequence are actually important. And that would mean that below example would be right. First the node are presented/created, and then the value are updated. Here the values are text strings - "Door switch" and "1.0".
Example B
Code: Select all
void presentation() {
present(CHILD_ID, S_LOCK);
sendSketchInfo("Door switch", "1.0");
}
Does these comments makes any sense?
Sorry to be a pain about this...but I really need such a basic thing to be handled correct. Getting inconsistent results when creating the nodes drives me crazy. So - based on my comments, should I use example A or B?
Br
Lemme
Re: Strange behaviour in creating Nodes
Posted: Friday 01 July 2016 14:10
by Lemme
I have now done a bunch of tests with virtual nodes as you suggested. And you are right, it makes no difference what comes first.
That leaves me to the conclusion that the issue is with the v.2 development version of MySensors. I did some testing last night with the stable 1.5.4 version, and here all the nodes were created correctely.
It could be that when the MySensors v.2.0 are released, there will be some adjustments to Domoticz.
Best regards
Lemme
Re: Strange behaviour in creating Nodes
Posted: Monday 01 August 2016 20:21
by tlpeter
Lemme, i have the same issue.
I changed my two nodes to 2.0.0 and the info is correct with child id 0 and child id 255 for the node and it shows the version.
Now i made a new node and it only shows the child id 0 and not the 255 anymore.
Somehow i cannot get this showed up in Domoticz anymore
Re: Strange behaviour in creating Nodes
Posted: Monday 01 August 2016 20:36
by trixwood
Not sure if this helps but I use
https://github.com/mysensors/MySensors/ ... Config.ino
To get a clean eeprom. Just to make sure no traces are left from my experimenting.
Maybe in your case there are traces of older mysensors nodes stuff in the eeprom?
Re: Strange behaviour in creating Nodes
Posted: Thursday 11 August 2016 22:09
by Lemme
Hi Trixwood
In my case i erased the node every time. So that can not be it.
Br
Lemme