Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. MySensors - Get Temperature value from another node through the Gateway

MySensors - Get Temperature value from another node through the Gateway

Scheduled Pinned Locked Moved Development
36 Posts 7 Posters 5.7k Views 6 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Joe13
    wrote on last edited by
    #12

    anyone who has tried pulling value from GW or controller to a different node, please let me know on how you did it. thanks

    K 1 Reply Last reply
    0
    • J Joe13

      anyone who has tried pulling value from GW or controller to a different node, please let me know on how you did it. thanks

      K Offline
      K Offline
      kimot
      wrote on last edited by kimot
      #13

      @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.

      J 1 Reply Last reply
      1
      • K kimot

        @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.

        J Offline
        J Offline
        Joe13
        wrote on last edited by Joe13
        #14

        @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

        1 Reply Last reply
        1
        • ben999B Offline
          ben999B Offline
          ben999
          wrote on last edited by ben999
          #15

          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

          rejoe2R 1 Reply Last reply
          0
          • ben999B ben999

            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

            rejoe2R Offline
            rejoe2R Offline
            rejoe2
            wrote on last edited by
            #16

            @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.

            Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

            ben999B 1 Reply Last reply
            2
            • rejoe2R rejoe2

              @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.

              ben999B Offline
              ben999B Offline
              ben999
              wrote on last edited by
              #17

              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

              rejoe2R 1 Reply Last reply
              0
              • ben999B 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));
                

                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

                rejoe2R Offline
                rejoe2R Offline
                rejoe2
                wrote on last edited by
                #18

                @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.

                Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                ben999B 1 Reply Last reply
                2
                • rejoe2R rejoe2

                  @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.

                  ben999B Offline
                  ben999B Offline
                  ben999
                  wrote on last edited by
                  #19

                  @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 )

                  rejoe2R 1 Reply Last reply
                  0
                  • ben999B ben999

                    @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 )

                    rejoe2R Offline
                    rejoe2R Offline
                    rejoe2
                    wrote on last edited by rejoe2
                    #20

                    @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...

                    Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                    ben999B 1 Reply Last reply
                    1
                    • rejoe2R rejoe2

                      @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...

                      ben999B Offline
                      ben999B Offline
                      ben999
                      wrote on last edited by ben999
                      #21

                      @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:

                      rejoe2R 1 Reply Last reply
                      1
                      • ben999B ben999

                        @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:

                        rejoe2R Offline
                        rejoe2R Offline
                        rejoe2
                        wrote on last edited by
                        #22

                        @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.

                        Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                        1 Reply Last reply
                        1
                        • J Offline
                          J Offline
                          Joe13
                          wrote on last edited by Joe13
                          #23

                          @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))
                          
                          rejoe2R 1 Reply Last reply
                          0
                          • J Joe13

                            @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))
                            
                            rejoe2R Offline
                            rejoe2R Offline
                            rejoe2
                            wrote on last edited by rejoe2
                            #24

                            @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.

                            Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                            J 1 Reply Last reply
                            1
                            • rejoe2R rejoe2

                              @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.

                              J Offline
                              J Offline
                              Joe13
                              wrote on last edited by
                              #25

                              @rejoe2 Completely understand and thanks for your time on all this. Probably i am not getting something very basic here.
                              this is the code that i am using to send the data to GW. i juse put in a constant num to send for VAR 1

                              MyMessage pcMsg(0,V_VAR1);
                              send(pcMsg.set(50));
                              

                              and in my LCD node, which doesnt have any physical sensor, trying to get that VAR1 value like below

                              request(0, V_VAR1);
                              
                              void receive(const MyMessage &message) {
                                // We only expect one type of message from controller. But we better check anyway.
                                if (message.type==V_VAR1) {
                              
                                  
                                   // Write some debug info
                                   Serial.print("Incoming change for sensor:");
                                   Serial.print(message.sensor);
                                   Serial.print(", New status: ");
                                   Serial.println(message.getLong());
                                 } 
                              }
                              

                              but the Serial monitor always shows 0 and just trying to figure out why. I am quite sure that it is probably a really minor change that needs to be done

                              Requested temp from gw VAR1223055 TSF:MSG:READ,0-0-1,s=0,c=2,t=24,pt=0,l=0,sg=0:
                              Incoming change for sensor:0, New status: 0
                              
                              rejoe2R K 2 Replies Last reply
                              0
                              • J Joe13

                                @rejoe2 Completely understand and thanks for your time on all this. Probably i am not getting something very basic here.
                                this is the code that i am using to send the data to GW. i juse put in a constant num to send for VAR 1

                                MyMessage pcMsg(0,V_VAR1);
                                send(pcMsg.set(50));
                                

                                and in my LCD node, which doesnt have any physical sensor, trying to get that VAR1 value like below

                                request(0, V_VAR1);
                                
                                void receive(const MyMessage &message) {
                                  // We only expect one type of message from controller. But we better check anyway.
                                  if (message.type==V_VAR1) {
                                
                                    
                                     // Write some debug info
                                     Serial.print("Incoming change for sensor:");
                                     Serial.print(message.sensor);
                                     Serial.print(", New status: ");
                                     Serial.println(message.getLong());
                                   } 
                                }
                                

                                but the Serial monitor always shows 0 and just trying to figure out why. I am quite sure that it is probably a really minor change that needs to be done

                                Requested temp from gw VAR1223055 TSF:MSG:READ,0-0-1,s=0,c=2,t=24,pt=0,l=0,sg=0:
                                Incoming change for sensor:0, New status: 0
                                
                                rejoe2R Offline
                                rejoe2R Offline
                                rejoe2
                                wrote on last edited by
                                #26

                                @joe13 As you are doing the data transfer through the controller: How did you transfer the info from Node A, V_VAR1@Child X to Node B, V_VAR1@Child Y? If you are issuing request(), you are asking the controller to send the later info.
                                How to manage that is not a MySensors question - it's controller specific. @FHEM, one would use typically a "notify"-function to copy incoming info from one node to the other.

                                Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                                1 Reply Last reply
                                1
                                • J Joe13

                                  @rejoe2 Completely understand and thanks for your time on all this. Probably i am not getting something very basic here.
                                  this is the code that i am using to send the data to GW. i juse put in a constant num to send for VAR 1

                                  MyMessage pcMsg(0,V_VAR1);
                                  send(pcMsg.set(50));
                                  

                                  and in my LCD node, which doesnt have any physical sensor, trying to get that VAR1 value like below

                                  request(0, V_VAR1);
                                  
                                  void receive(const MyMessage &message) {
                                    // We only expect one type of message from controller. But we better check anyway.
                                    if (message.type==V_VAR1) {
                                  
                                      
                                       // Write some debug info
                                       Serial.print("Incoming change for sensor:");
                                       Serial.print(message.sensor);
                                       Serial.print(", New status: ");
                                       Serial.println(message.getLong());
                                     } 
                                  }
                                  

                                  but the Serial monitor always shows 0 and just trying to figure out why. I am quite sure that it is probably a really minor change that needs to be done

                                  Requested temp from gw VAR1223055 TSF:MSG:READ,0-0-1,s=0,c=2,t=24,pt=0,l=0,sg=0:
                                  Incoming change for sensor:0, New status: 0
                                  
                                  K Offline
                                  K Offline
                                  kimot
                                  wrote on last edited by
                                  #27

                                  @joe13
                                  First, you send to controller command to store V_VAR1 for node X ( your temp node )
                                  Secondly you ask controller for V_VAR1 of node Z ( different node ! - your LCD)
                                  And there is nothing stored, so it returns 0.
                                  You must write some scripts in controller to write correct value for correct V_VAR.

                                  For example if temperature from node X changed ( or periodically every minute etc )
                                  copy this temperature to V_VAR1 of your LCD node Z.
                                  How you "copy" this, depends on controller sw ability.
                                  Then, if LCD node asks controller for V_VAR1, it obtain what you want.

                                  1 Reply Last reply
                                  1
                                  • K Offline
                                    K Offline
                                    kimot
                                    wrote on last edited by kimot
                                    #28

                                    Here are types, which can be requested from Domoticz for example:

                                    else if (message_type == MT_Req)
                                    	{
                                    		//Request a variable
                                    		std::string tmpstr;
                                    		switch (sub_type)
                                    		{
                                    		case V_STATUS:
                                    		case V_PERCENTAGE:
                                    		case V_RGB:
                                    		case V_RGBW:
                                    			if (GetSwitchValue(node_id, child_sensor_id, sub_type, tmpstr))
                                    				SendNodeCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
                                    			break;
                                    		case V_VAR1:
                                    		case V_VAR2:
                                    		case V_VAR3:
                                    		case V_VAR4:
                                    		case V_VAR5:
                                    			//send back a previous stored custom variable
                                    			tmpstr = "";
                                    			GetVar(node_id, child_sensor_id, sub_type, tmpstr);
                                    			//SendNodeSetCommand(node_id, child_sensor_id, message_type, (_eSetType)sub_type, tmpstr, true, 1000);
                                    			SendNodeCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
                                    			break;
                                    		case V_TEXT:
                                    			{
                                    				//Get Text sensor value from the database
                                    				bool bExits = false;
                                    				tmpstr = GetTextSensorText(node_id, child_sensor_id, bExits);
                                    				SendNodeCommand(node_id, child_sensor_id, message_type, sub_type, tmpstr);
                                    			}
                                    			break;
                                    		default:
                                    			while (1==0);
                                    			break;
                                    		}
                                    		while (1==0);
                                    	}
                                    	else {
                                    		//Unhandled message type
                                    		while (1==0);
                                    	}
                                    
                                    

                                    There is V_TEXT too.
                                    I do not find like handle V_VAR1 in Domoticz, but if create TEXT node with V_TEXT, then I am able store temperature from different node into this V_TEXT of another node, which can be requested by MySensors.

                                    1 Reply Last reply
                                    1
                                    • J Offline
                                      J Offline
                                      Joe13
                                      wrote on last edited by Joe13
                                      #29

                                      Thanks for all the info. I have not yet started scripting in the Controller. But what you guys have mentioned above makes sense, that passing value from Node A to VAR1 needs to be transferred to Node B VAR1 through the controller. Let me play around with all the info provided above. Probably looks like i would have to do node-node. But my understanding has improved now.
                                      @kimot is that request code that you mentioned to be part of the MySensors code in the node or is that a Domoticz input?

                                      1 Reply Last reply
                                      0
                                      • J Offline
                                        J Offline
                                        Joe13
                                        wrote on last edited by Joe13
                                        #30

                                        As an update.
                                        Finally after wrapping my head around the topic and knowing that you cant just send a value from one node in a VAR1 and expect it to just retain that value and get it in another node, i used the node - node communication and it worked!!!.

                                        so my send sketch is

                                        send(pcMsg.setDestination(1).setSensor(101).set(temperature,1));
                                        

                                        and receive sketch is

                                        void loop() 
                                        {
                                           request(0, V_VAR1);
                                         }
                                        
                                        void receive(const MyMessage &message) {
                                        
                                         if (message.type==V_VAR1) {
                                           if (message.sensor==101) {
                                        
                                           
                                            // Write some debug info
                                            Serial.print("Incoming change for sensor:");
                                            Serial.print(message.sensor);
                                            Serial.print("\n");
                                            Serial.print(", New status: ");
                                            Serial.println(message.getFloat());
                                           }
                                          } 
                                        

                                        I am able to get the value from the second node. But was just wondering why '0' is used in the request(0, V_VAR1) call when the value is being directly sent from the 1st node to the 2nd node

                                        rejoe2R 1 Reply Last reply
                                        1
                                        • J Joe13

                                          As an update.
                                          Finally after wrapping my head around the topic and knowing that you cant just send a value from one node in a VAR1 and expect it to just retain that value and get it in another node, i used the node - node communication and it worked!!!.

                                          so my send sketch is

                                          send(pcMsg.setDestination(1).setSensor(101).set(temperature,1));
                                          

                                          and receive sketch is

                                          void loop() 
                                          {
                                             request(0, V_VAR1);
                                           }
                                          
                                          void receive(const MyMessage &message) {
                                          
                                           if (message.type==V_VAR1) {
                                             if (message.sensor==101) {
                                          
                                             
                                              // Write some debug info
                                              Serial.print("Incoming change for sensor:");
                                              Serial.print(message.sensor);
                                              Serial.print("\n");
                                              Serial.print(", New status: ");
                                              Serial.println(message.getFloat());
                                             }
                                            } 
                                          

                                          I am able to get the value from the second node. But was just wondering why '0' is used in the request(0, V_VAR1) call when the value is being directly sent from the 1st node to the 2nd node

                                          rejoe2R Offline
                                          rejoe2R Offline
                                          rejoe2
                                          wrote on last edited by
                                          #31

                                          @joe13 The request() call in your loop() is no longer neccessary. Receiving what is sent from another node is handled without that...

                                          Controller: FHEM; MySensors: 2.3.1, RS485,nRF24,RFM69, serial Gateways

                                          J 1 Reply Last reply
                                          2
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          19

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.1k

                                          Posts


                                          Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                          • Login

                                          • Don't have an account? Register

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • MySensors
                                          • OpenHardware.io
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular