MySensors - Get Temperature value from another node through the Gateway
-
I would approach the problem on the opposite direction, I'd send the temperature to gateway and also to the node with display, so if your temperature node is a sleeping node it would just send when it wakes up and you get your temperature displayed
@gohan but isn't there a way to get the Temp from the Gateway. I am getting some sort of Receive msg (based on the my initial post) but the value is 0.
in this way, i can request the temp from the GW whenever required and not ask the node to send the data every few mins -
The gateway doesn't store any data. You could request data from controller if you have one running.
@gohan Yes that would be great. i have Domoticz running and the temp shows up there. could you let me know how I can get the temp from the controller.
I found this link and that is the code that i initially tried https://www.domoticz.com/forum/viewtopic.php?t=9708
but gives an O/P of 0 -
I have never done it myself, but I'd start looking at the pulse energy meter as it has a function to retrieve a sensor value from controller
The code in that post is for the old mysensors version
@gohan i did convert it to the 2.1V but the result is the same. so if you were to do something like this, show all the temps from different rooms(nodes) on a central LCD placed in the hall, how would you go about it. I am just a beginner so an ideal way would be great.
The Pulse energy meter code tell " Received last pulse count from gw:" so could it be possible to get values from GW. -
As said before I'd go for the node to node communication, so send the temperature also to the lcd node, or you could also use an esp8266 and read the the mqtt messages from topic domoticz/out that domoticz sends every time there is a change in the controller data.
-
As said before I'd go for the node to node communication, so send the temperature also to the lcd node, or you could also use an esp8266 and read the the mqtt messages from topic domoticz/out that domoticz sends every time there is a change in the controller data.
-
anyone who has tried pulling value from GW or controller to a different node, please let me know on how you did it. thanks
@joe13
I think, you must send temperature ( for later resending) to domoticz like V_VAR1 for storing it, and then requested it again like V_VAR1. Do not use V_TEMP for this.
Look at V_VAR like universal variable for storing anything.
At your code examples is not evident, what you put to V_VAR1 first, maybe nothing, so do not be disappointed, if you read 0 back.
At EnergyCounter Sensor you can see:MyMessage wattMsg(CHILD_ID,V_WATT); MyMessage kwhMsg(CHILD_ID,V_KWH); MyMessage pcMsg(CHILD_ID,V_VAR1); !!!!!! .... send(wattMsg.set(watt)); send(kwhMsg.set(kwh, 4)); // Send kwh value to gw send(pcMsg.set(pulseCount)); // Send pulse count value to gw !!!!!! ..... request(CHILD_ID, V_VAR1);So it sends to domoticz not only W and kWh for displaying it, but pulse for storing and reading later too.
But like wrote gohan, I think better way is sending temperature from node twice - to domoticz and to LCD node. This will work even if domoticz will bee down.
-
@joe13
I think, you must send temperature ( for later resending) to domoticz like V_VAR1 for storing it, and then requested it again like V_VAR1. Do not use V_TEMP for this.
Look at V_VAR like universal variable for storing anything.
At your code examples is not evident, what you put to V_VAR1 first, maybe nothing, so do not be disappointed, if you read 0 back.
At EnergyCounter Sensor you can see:MyMessage wattMsg(CHILD_ID,V_WATT); MyMessage kwhMsg(CHILD_ID,V_KWH); MyMessage pcMsg(CHILD_ID,V_VAR1); !!!!!! .... send(wattMsg.set(watt)); send(kwhMsg.set(kwh, 4)); // Send kwh value to gw send(pcMsg.set(pulseCount)); // Send pulse count value to gw !!!!!! ..... request(CHILD_ID, V_VAR1);So it sends to domoticz not only W and kWh for displaying it, but pulse for storing and reading later too.
But like wrote gohan, I think better way is sending temperature from node twice - to domoticz and to LCD node. This will work even if domoticz will bee down.
@kimot that part i missed. thanks for pointing that out. I will give this option also a try. its just that the other sensors that are in the other rooms are already set in place and I do not want to pluck them out and recode them. So pulling the values from the GW would have been an advantage. But anyways, if that is the way to go, then Ill probably do that.
Thanks everyone for your inputs -
Hi all,
Sorry to jump in. If my post is off-topic please say so and i will start a new thread
I am in the process of doing the same: a temp/hum node and a node with LCD displaying temp and hum
Many-many questions :
- all messages (even node-to-node ones) go through gateway and controller ?
- sending
request(CHILD_ID, V_VAR1)does not mention the node's ID... i just can't get my head round this... there could be many sensors handling the same variable type with the same child id... ? So how do we know we will be getting data from the right node and sensor (child) ? - sending
request(CHILD_ID, V_VAR1)will actually ask the controller to ask the node to send its data? Or does it request data straight from node? - isn't there a simple way for nodes to fetch data (data coming from itself and from other nodes) from controller?
Thanks for your help
-
Hi all,
Sorry to jump in. If my post is off-topic please say so and i will start a new thread
I am in the process of doing the same: a temp/hum node and a node with LCD displaying temp and hum
Many-many questions :
- all messages (even node-to-node ones) go through gateway and controller ?
- sending
request(CHILD_ID, V_VAR1)does not mention the node's ID... i just can't get my head round this... there could be many sensors handling the same variable type with the same child id... ? So how do we know we will be getting data from the right node and sensor (child) ? - sending
request(CHILD_ID, V_VAR1)will actually ask the controller to ask the node to send its data? Or does it request data straight from node? - isn't there a simple way for nodes to fetch data (data coming from itself and from other nodes) from controller?
Thanks for your help
@ben999 If you do node-to-node communication, the message does not necessarily need a controller; it is routed through the lowest common repeater node (this might be the gateway). Eg. if you have two nodes 5 and 6 that are communicating over node 4 with the gw, the gw may not even see the message.
Coding then looks like this:send(SisternodeMsg.setDestination(MY_SISTER_NODE_ID).setSensor(CHILD_ID_SISTER_TEMP).set(temperature, 1));In case you use a controller, you would have to map the values through the controller's functionality (eg. put temperature value #2 from node 5 to value2100 on node 6 so this can be requested from node #6 using it's own ID and child ID 100 - V_VAR2.
In both cases you have to code appropriate receive()-functionality.
-
@ben999 If you do node-to-node communication, the message does not necessarily need a controller; it is routed through the lowest common repeater node (this might be the gateway). Eg. if you have two nodes 5 and 6 that are communicating over node 4 with the gw, the gw may not even see the message.
Coding then looks like this:send(SisternodeMsg.setDestination(MY_SISTER_NODE_ID).setSensor(CHILD_ID_SISTER_TEMP).set(temperature, 1));In case you use a controller, you would have to map the values through the controller's functionality (eg. put temperature value #2 from node 5 to value2100 on node 6 so this can be requested from node #6 using it's own ID and child ID 100 - V_VAR2.
In both cases you have to code appropriate receive()-functionality.
If you do node-to-node communication, the message does not necessarily need a controller; it is routed through the lowest common repeater node (this might be the gateway). Eg. if you have two nodes 5 and 6 that are communicating over node 4 with the gw, the gw may not even see the message.
Coding then looks like this:send(SisternodeMsg.setDestination(MY_SISTER_NODE_ID).setSensor(CHILD_ID_SISTER_TEMP).set(temperature, 1));That makes sense, big thumbs up, thanks a lot
On the other hand I didn't understant a word of that... sorry...
Could you please detail a wee bit more? And also please explain who is doing what...In case you use a controller, you would have to map the values through the controller's functionality (eg. put temperature value #2 from node 5 to value2100 on node 6 so this can be requested from node #6 using it's own ID and child ID 100 - V_VAR2.
I should be able to do that :)
In both cases you have to code appropriate receive()-functionality.
Thanks a lot for your help
-
If you do node-to-node communication, the message does not necessarily need a controller; it is routed through the lowest common repeater node (this might be the gateway). Eg. if you have two nodes 5 and 6 that are communicating over node 4 with the gw, the gw may not even see the message.
Coding then looks like this:send(SisternodeMsg.setDestination(MY_SISTER_NODE_ID).setSensor(CHILD_ID_SISTER_TEMP).set(temperature, 1));That makes sense, big thumbs up, thanks a lot
On the other hand I didn't understant a word of that... sorry...
Could you please detail a wee bit more? And also please explain who is doing what...In case you use a controller, you would have to map the values through the controller's functionality (eg. put temperature value #2 from node 5 to value2100 on node 6 so this can be requested from node #6 using it's own ID and child ID 100 - V_VAR2.
I should be able to do that :)
In both cases you have to code appropriate receive()-functionality.
Thanks a lot for your help
@ben999 I also had a hard time to sort things out wrt. to node-to-node communication. But in the end, its simple:
You just have to use appropriate send()- and recieve() commands in the nodes. Example for the temperature part, using the node numbers from above:- For the one providing the needed info (node 5): This one is measuring temp and sends this to node 6: In the code for this node use additionally to the "normal" send() the above code and replace "MY_SISTER_NODE_ID" with 6 and "CHILD_ID_SISTER_TEMP" let's say with 101 (or use appropriate #define's).
- In the receive() part of Node 6 you have to sort things by using the correspondant Child ID as follows:
if (message.sensor == 101) {...I personally prefer using "speaking names" like CHILD_ID_SISTER_TEMP and define them in the header, that's what's behind the first send() code-snipplet, but that's just a question of style.
-
@ben999 I also had a hard time to sort things out wrt. to node-to-node communication. But in the end, its simple:
You just have to use appropriate send()- and recieve() commands in the nodes. Example for the temperature part, using the node numbers from above:- For the one providing the needed info (node 5): This one is measuring temp and sends this to node 6: In the code for this node use additionally to the "normal" send() the above code and replace "MY_SISTER_NODE_ID" with 6 and "CHILD_ID_SISTER_TEMP" let's say with 101 (or use appropriate #define's).
- In the receive() part of Node 6 you have to sort things by using the correspondant Child ID as follows:
if (message.sensor == 101) {...I personally prefer using "speaking names" like CHILD_ID_SISTER_TEMP and define them in the header, that's what's behind the first send() code-snipplet, but that's just a question of style.
@rejoe2 GREAT! You gave sense to all that. Is it what some clever blokes refer to "dummy sensor" method?
May I ask some more @rejoe2 ?
How would you retrieve a value DIRECTLY FROM the controller?
Say that node 5 and 6 sleep most of their time... so they never get to speak directly to each other. Then the controller would be the mail box... I already send temp data to the controller and get it displayed in PaperUI and iOS app (using openHab). How would node 6 fetch this piece of data?Once more, thanks a lot for your time and patience (it's not easy eaducating people :D )
-
@rejoe2 GREAT! You gave sense to all that. Is it what some clever blokes refer to "dummy sensor" method?
May I ask some more @rejoe2 ?
How would you retrieve a value DIRECTLY FROM the controller?
Say that node 5 and 6 sleep most of their time... so they never get to speak directly to each other. Then the controller would be the mail box... I already send temp data to the controller and get it displayed in PaperUI and iOS app (using openHab). How would node 6 fetch this piece of data?Once more, thanks a lot for your time and patience (it's not easy eaducating people :D )
@ben999 You are welcome.
For "indirect" communication you may use the V_VARx-method already mentionned. This requires the controller to have the requested info stored at the right place (eg. FHEM would store V_VAR1 of Child 101 in a reading named "value1101" of the respective device).
Then just use the EnergyMeterPulse-sketch as example how to ask info from nodes side to be send from controller while not sleeping.
That should do the trick.Just one remark: Having a display and a sleeping node doesn't fit to well together imo :grinning:
EDIT: To make things more clear: the V_VARx has to be stored in the values of the requesting node, so if the display is attached to node 6, your controller has to provide the values as reading on node 6...
-
@ben999 You are welcome.
For "indirect" communication you may use the V_VARx-method already mentionned. This requires the controller to have the requested info stored at the right place (eg. FHEM would store V_VAR1 of Child 101 in a reading named "value1101" of the respective device).
Then just use the EnergyMeterPulse-sketch as example how to ask info from nodes side to be send from controller while not sleeping.
That should do the trick.Just one remark: Having a display and a sleeping node doesn't fit to well together imo :grinning:
EDIT: To make things more clear: the V_VARx has to be stored in the values of the requesting node, so if the display is attached to node 6, your controller has to provide the values as reading on node 6...
@rejoe2 Dude!!! It worked! Awesome :D Node-to-node is now understood and tested :)
Now i need (for my personal benefit) to get my node to fetch data from controller
FHEM seems to be some type of controller software like Openhab and so many others... ? Next move is to discover where and how data is stored within openhab...Once again @rejoe2 thank you very much for passing on your knowledge
Just one remark: Having a display and a sleeping node doesn't fit to well together imo 😀
I just wanted to make sure you would not lead me to any other way :D as i wanted to understand both ways of sharing data between nodes
Thank you so much for that :+1: -
@rejoe2 Dude!!! It worked! Awesome :D Node-to-node is now understood and tested :)
Now i need (for my personal benefit) to get my node to fetch data from controller
FHEM seems to be some type of controller software like Openhab and so many others... ? Next move is to discover where and how data is stored within openhab...Once again @rejoe2 thank you very much for passing on your knowledge
Just one remark: Having a display and a sleeping node doesn't fit to well together imo 😀
I just wanted to make sure you would not lead me to any other way :D as i wanted to understand both ways of sharing data between nodes
Thank you so much for that :+1:@ben999 said in MySensors - Get Temperature value from another node through the Gateway:
Thx for reporting about getting this to work as expected!FHEM seems to be some type of controller software like Openhab and so many others... ?
FHEM is - as mentionned in my signature - also a controller software. It's written in perl (which is very special) and a very flexible solution allowing a broad spectrum of hardware to be integrated, but unfortunately not very famous outside Germany (as most posts in the forum are in german). But questions in english are also answered, see fhem.de for more details, if you're interested.
-
@rejoe2 i got to understand quite some things from all what you have shared and thanks for that. just a bit more confusion left.
so i have node 1N/child id 1C to send the temp value to the LCD node 4N / child id 4C, so is the below correct.send(1N.setDestination(4).setSensor(4C).set(temperature, 1));And if node 1N / child id 1C is to send the temp value to GW(DOMOTICZ), is the below correct and how can node 4/child 4C (LCD) retreive this value from GW.
MyMessage pcMsg(1C,V_VAR1); send(pcMsg.set(TEMP from this sensor)) -
@rejoe2 i got to understand quite some things from all what you have shared and thanks for that. just a bit more confusion left.
so i have node 1N/child id 1C to send the temp value to the LCD node 4N / child id 4C, so is the below correct.send(1N.setDestination(4).setSensor(4C).set(temperature, 1));And if node 1N / child id 1C is to send the temp value to GW(DOMOTICZ), is the below correct and how can node 4/child 4C (LCD) retreive this value from GW.
MyMessage pcMsg(1C,V_VAR1); send(pcMsg.set(TEMP from this sensor))@joe13 Your naming convention ist a bit confusing.
In general, for sending info to the controller, you can use the "short" send() command in the form they are included in the examples from the Build section.
The additional parts between the points (setDestination() and setSensor()) just change the default values (setDestination usually is "0" for the GW; setSensor() is typically defined in the ...Msg() in each sketches header section (in your example: pcMsg()). V_VAR1 btw seems not to be the right type for this kind of message (Temp).
You may have a look at the "Temperature" sketch: This is a good official example how to use the setSensor() variable dynamically.Hope this helps to light out the remaining questions, it's quite hard for me to explain all these things. I myself learned about these mechanisms by studiing the examples and doing some (...) tests, but I'm not an educated programmer, so I am not able to lead you to the right keywords for theoretical backgroud.