Library 1.6 devel - How query the parent node?
-
Hello,
I'm using succesfully the new development library.
If I set the parent to AUTO and enable the debug mode, I can see which parent was choosen.
I would like to save this output to a variable.
Can I query (maybe during presentation) the parent I get during the discovery? How?
Thanks'Simon
-
You should be able to query query parent id through:
_nc.parentNodeId
Hmm. we should probably add a new method getParentId() or something to make it a bit more publicly accessible .
-
Ok, thank you!
Should be enough something like that?int parntNode = _nc.parentNodeId;
L'll give it a try.
Thank's!
Simon
PS: I've seen I could query as well 'distance'
-
Hello @hek
I was able to query the parentnode. I would like to send this information to the Gateway and then save/display it into my controller.
How i s the best way to send these informations? They are not really related to a sensor, are more custom.I could define it something like that:
// parent MyMessage msgNodeVar1(CHILD_ID_NODE, V_VAR1) // distance MyMessage msgNodeVar1(CHILD_ID_NODE, V_VAR2)
but under which sub-type present it?
present(CHILD_ID_NODE, S_<WHICHONE???>);
Then into loop() with a time I could then send these informations:
parentNode = _nc.parentNodeId; send(msgNodeVar1.set(parentNode, 1)); distance = _nc.distance; send(msgNodeVar2.set(distance, 1));
So, to be clean, which subtype should I use for the presentation?
Thanks!
Simon
-
The parent node-id is sent automatically during node presentation (and can be retrieved from a running node by sending an I_PRESENTATION to the node).
But to answer your question, The VAR_X can be used with any device type.
-
@hek
I can retrive the parent node by requesting it, that's ok. I have no idea how to do that (if you can point me to an example...)
BTW, if I would like to inform the Controller (OpenHAB) on which parent is used by a node (I'm using MQTTClient as GW) I need to present and register this information as written by me before or there is another way as well?Thanks!
simon
Suggested Topics
-
Day 1 - Status report
Announcements • 23 Mar 2014, 22:45 • hek 24 Mar 2014, 20:12 -
Echo request is not set
Troubleshooting • 12 Aug 2024, 15:36 • kamilb85 3 Sept 2024, 08:58 -
JSN SR04T - Temperature Influencing Readings
Troubleshooting • 6 Sept 2019, 07:51 • Timbergetter 5 days ago -
Forum Search not working?
Troubleshooting • 4 Oct 2023, 23:33 • Gibber 2 Sept 2024, 20:28 -
JSN-SR04T-V3.0 Coax cable extended
Troubleshooting • 13 days ago • bocalexandru 12 days ago -
Compiling Sensor code using BME280 and ESP8266
Troubleshooting • 26 Feb 2025, 00:32 • dpcons 26 Feb 2025, 06:22