LCD Node - display temp from other sensor - How?



  • Please provide example
    Thank you


  • Hero Member

    @cadet Two ways I can think of

    1. you can push the data from the other temp sensor node using a direct node to node message.

    2. You can have your lcd node request the temperature directly from the remote temp node.

    The format of both can be seen on the API Page

    You can see some examples of Request Here

    I have not sent node to node temp readings before but have used it for binary switch nodes, the format will be the same though. have a look at these projects

    AC Power controller with node to node remotes

    Outdoors Touch Switch light controller

    Synchronising Light switch



  • @Boots33
    Thank you for answer
    But I need some help.

    node 5 send temp
    node 11 recv
    TSF:MSG:READ,5-5-11,s=0,c=1,t=27,pt=1,l=1,sg=0:1
    What I need write in void receive section ?

    Andrey


  • Hero Member

    @cadet

    It will depend on what other messages you are expecting to receive. If this is the only temperature message you are expecting then something as simple as...

    void receive(const MyMessage &message) {
      
     if (message.type == V_TEMP) {
    
        //put code here to be executed when the new temperature arrives  
     
       }
     }
    

    The message you have in your post is not a V_TEMP type though, it is of type V_VAR4



  • @Boots33
    Thanks
    And how to send v_temp message ? To 11 node
    )

    Is this correct for receive section and display ?

    void receive(const MyMessage &message) {
      
      if (message.type == V_TEMP) {
        temper = V_TEMP;
        //put code here to be executed when the return from the request arrives 
        Serial.print(temper);
        lcd.setCursor(2, 3); 
        lcd.print(temper);  
       }
     }```


  • @cadet
    Now node 5 send
    TSF:MSG:SEND,5-5-11-11,s=0,c=1,t=0,pt=7,l=5,sg=0,ft=0,st=OK:26.0
    to node 11
    Correct ?
    this is code from node 5
    send(msg.setSensor(0).set(temperature, 1)); // to controller
    send(msg.setSensor(0).set(temperature, 1).setDestination(11)); // to 11 node



  • @cadet

    11 node recv
    TSF:MSG:READ,5-5-11,s=0,c=1,t=0,pt=7,l=5,sg=0:26.0


  • Hero Member

    @cadet You can send on the fly if you like, the message bellow is for a binary switch but the format is the same.
    You would need to use V_TEMP instead of V_STATUS and put the temp in the .set at the end

    0_1498081911873_node.jpg

    To receive, using your code as an example

    void receive(const MyMessage &message) {
      
      if (message.type == V_TEMP) {
        temper = message.getFloat();
        //put code here to be executed when the return from the request arrives 
        Serial.print(temper);
        lcd.setCursor(2, 3); 
        lcd.print(temper);  
       }
     }
    

    And temper would need to be declared as a float of course.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.