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. General Discussion
  3. Display node: how to set up

Display node: how to set up

Scheduled Pinned Locked Moved General Discussion
33 Posts 6 Posters 8.6k Views 10 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.
  • PetjepetP Offline
    PetjepetP Offline
    Petjepet
    wrote on last edited by Petjepet
    #1

    Hello,

    I would like to create a display node (1602 or 2004) with the possibility to show measurements of other node(s).
    How do I approach on this? What is the way to work with MySensors.

    I would like the display node to be available in the living room with the ability to show for example the data from my weather station (multi sensor node). On top af that this display node can act as repeater node.

    Will in such case this node receive data directly from the weather station node or do I have to retrieve the data for this node from the pimatic database?
    How do I implement this?

    Thanks for any suggestions :simple_smile:

    mfalkviddM 1 Reply Last reply
    0
    • PetjepetP Petjepet

      Hello,

      I would like to create a display node (1602 or 2004) with the possibility to show measurements of other node(s).
      How do I approach on this? What is the way to work with MySensors.

      I would like the display node to be available in the living room with the ability to show for example the data from my weather station (multi sensor node). On top af that this display node can act as repeater node.

      Will in such case this node receive data directly from the weather station node or do I have to retrieve the data for this node from the pimatic database?
      How do I implement this?

      Thanks for any suggestions :simple_smile:

      mfalkviddM Offline
      mfalkviddM Offline
      mfalkvidd
      Mod
      wrote on last edited by mfalkvidd
      #2

      @Petjepet have you looked at the display example? It shows time and temperature fetched from the controller. Seems quite similar to what you want to build.

      PetjepetP cadetC 2 Replies Last reply
      0
      • mfalkviddM mfalkvidd

        @Petjepet have you looked at the display example? It shows time and temperature fetched from the controller. Seems quite similar to what you want to build.

        PetjepetP Offline
        PetjepetP Offline
        Petjepet
        wrote on last edited by
        #3

        @mfalkvidd yes I did and believe it is showing the RTC data of that same node. It gets the time initially from the controller by a specific for the system time available function 'requestTime()'.

        How would I for example get the temperature from a particular node in this display node?
        So how to refer to that particular node and the temperature attribute in the sketch of the display node?
        Is there a kind of function 'requestValue(NodeId, SensorId)'?

        mfalkviddM 1 Reply Last reply
        0
        • mfalkviddM mfalkvidd

          @Petjepet have you looked at the display example? It shows time and temperature fetched from the controller. Seems quite similar to what you want to build.

          cadetC Offline
          cadetC Offline
          cadet
          wrote on last edited by
          #4

          @mfalkvidd
          Example show temp from DS3232 RTC

          1 Reply Last reply
          0
          • PetjepetP Petjepet

            @mfalkvidd yes I did and believe it is showing the RTC data of that same node. It gets the time initially from the controller by a specific for the system time available function 'requestTime()'.

            How would I for example get the temperature from a particular node in this display node?
            So how to refer to that particular node and the temperature attribute in the sketch of the display node?
            Is there a kind of function 'requestValue(NodeId, SensorId)'?

            mfalkviddM Offline
            mfalkviddM Offline
            mfalkvidd
            Mod
            wrote on last edited by
            #5

            @Petjepet yes. See https://www.mysensors.org/download/sensor_api_20#requesting-data

            PetjepetP 2 Replies Last reply
            0
            • mfalkviddM mfalkvidd

              @Petjepet yes. See https://www.mysensors.org/download/sensor_api_20#requesting-data

              PetjepetP Offline
              PetjepetP Offline
              Petjepet
              wrote on last edited by
              #6

              @mfalkvidd Thanks! I'll have a look.

              1 Reply Last reply
              0
              • mfalkviddM mfalkvidd

                @Petjepet yes. See https://www.mysensors.org/download/sensor_api_20#requesting-data

                PetjepetP Offline
                PetjepetP Offline
                Petjepet
                wrote on last edited by
                #7

                @mfalkvidd to start right:

                The function 'void receive(const MyMessage &message)'
                This will catch all data being send from nodes?
                I will have to identify what type the data is and from which node and sensor the data came and if the node is correct use that data to update the display with?

                The function 'void request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);'
                This function will request directly data from a particular node and sensor.
                Probably not the way to go when the sensors are battery nodes since this function will activate the battery nodes often.

                The receive function would fit better but I have to investigate how to determine the node and sensor the data received is coming from. Is there an example for this?

                1 Reply Last reply
                0
                • mfalkviddM Offline
                  mfalkviddM Offline
                  mfalkvidd
                  Mod
                  wrote on last edited by
                  #8

                  the receive function will be called every time the node receives a message destined for that node.

                  The message object can be examined by checking the contents of the message. More information: https://forum.mysensors.org/topic/6351/interperating-messages-from-controller/4

                  Nodes that are sleeping will not be woken up. They are sleeping, so they can't know that they should wake up.

                  The easiest way is probably to either have the other nodes send the data to the display node, or have the other nodes send the data to the controller and let the display node query the controller.

                  This thread might give some more information https://forum.mysensors.org/topic/826/node-to-node-communication

                  PetjepetP 1 Reply Last reply
                  0
                  • mfalkviddM mfalkvidd

                    the receive function will be called every time the node receives a message destined for that node.

                    The message object can be examined by checking the contents of the message. More information: https://forum.mysensors.org/topic/6351/interperating-messages-from-controller/4

                    Nodes that are sleeping will not be woken up. They are sleeping, so they can't know that they should wake up.

                    The easiest way is probably to either have the other nodes send the data to the display node, or have the other nodes send the data to the controller and let the display node query the controller.

                    This thread might give some more information https://forum.mysensors.org/topic/826/node-to-node-communication

                    PetjepetP Offline
                    PetjepetP Offline
                    Petjepet
                    wrote on last edited by
                    #9

                    @mfalkvidd thanks for the info.

                    I came up with this and verification of the sketch is ok in Arduino IDE:

                    void receive(const MyMessage &message)
                    {
                      // Explore message
                      if (message.sender == 38) // weatherstation node
                      {
                        switch (message.sensor)
                        {
                          case 0:  // Humidity sensor
                          {
                            lcd.setCursor ( 0, 1 );  
                            lcd.print("Hum: ");
                            lcd.print(message.getFloat());
                            lcd.print("%");
                          }
                          case 1:  // Temperature sensor
                          {   
                            lcd.setCursor ( 0, 0 );  
                            lcd.print("Temp: ");
                            lcd.print(message.getFloat());
                            lcd.write(223); // Degree-sign
                            lcd.print("C");
                          }
                          case 2:  // Light sensor
                          {
                            lcd.setCursor ( 8, 1 );  
                            lcd.print("L: ");
                            lcd.print(message.getUInt());
                            lcd.print("Lux");
                          }
                          case 3:  // Barometer sensor
                          {   
                            lcd.setCursor ( 8, 0 );  
                            lcd.print("P: ");
                            lcd.print(message.getFloat());
                            lcd.print("mBar");
                          }
                          case 4:  // Barometer Temperature sensor
                          {
                          }
                          case 5:  // Rain sensor
                          {
                          }
                        }
                      }
                    }
                    

                    Is this the way to approach ?

                    I still have some questions about the concept:

                    • When I use the 'receive' function in this display node, will the message still be received by the gateway?

                    • In general: can messages sent by one node be receive and evaluated by multiple other nodes in parallel?

                    mfalkviddM 1 Reply Last reply
                    0
                    • PetjepetP Petjepet

                      @mfalkvidd thanks for the info.

                      I came up with this and verification of the sketch is ok in Arduino IDE:

                      void receive(const MyMessage &message)
                      {
                        // Explore message
                        if (message.sender == 38) // weatherstation node
                        {
                          switch (message.sensor)
                          {
                            case 0:  // Humidity sensor
                            {
                              lcd.setCursor ( 0, 1 );  
                              lcd.print("Hum: ");
                              lcd.print(message.getFloat());
                              lcd.print("%");
                            }
                            case 1:  // Temperature sensor
                            {   
                              lcd.setCursor ( 0, 0 );  
                              lcd.print("Temp: ");
                              lcd.print(message.getFloat());
                              lcd.write(223); // Degree-sign
                              lcd.print("C");
                            }
                            case 2:  // Light sensor
                            {
                              lcd.setCursor ( 8, 1 );  
                              lcd.print("L: ");
                              lcd.print(message.getUInt());
                              lcd.print("Lux");
                            }
                            case 3:  // Barometer sensor
                            {   
                              lcd.setCursor ( 8, 0 );  
                              lcd.print("P: ");
                              lcd.print(message.getFloat());
                              lcd.print("mBar");
                            }
                            case 4:  // Barometer Temperature sensor
                            {
                            }
                            case 5:  // Rain sensor
                            {
                            }
                          }
                        }
                      }
                      

                      Is this the way to approach ?

                      I still have some questions about the concept:

                      • When I use the 'receive' function in this display node, will the message still be received by the gateway?

                      • In general: can messages sent by one node be receive and evaluated by multiple other nodes in parallel?

                      mfalkviddM Offline
                      mfalkviddM Offline
                      mfalkvidd
                      Mod
                      wrote on last edited by
                      #10

                      @Petjepet yes that could be the right approach, assuming you have nodes 1-5 sending data to that display node.

                      Depending on you network setup, they gateway may receive and forward the message.

                      Broadcast messages are possible (by sending to destination node 255). I am not sure how they work though, I have never used them myself.

                      PetjepetP 1 Reply Last reply
                      0
                      • mfalkviddM mfalkvidd

                        @Petjepet yes that could be the right approach, assuming you have nodes 1-5 sending data to that display node.

                        Depending on you network setup, they gateway may receive and forward the message.

                        Broadcast messages are possible (by sending to destination node 255). I am not sure how they work though, I have never used them myself.

                        PetjepetP Offline
                        PetjepetP Offline
                        Petjepet
                        wrote on last edited by Petjepet
                        #11

                        @mfalkvidd actually it is one node having 5 sensors.

                        My setup is one gateway with multiple nodes (4 PIRs, 1 Temperature, 1 Humidity and the weather station with 5 sensors).
                        These nodes just use the standard 'send' function. This is a broadcast, isn't it, since no destination node is provided in this function?

                        The gateway picks up these messages of the nodes (as I can see them in my controller Pimatic) and I hope the display node will pick the message up as well.
                        Or does the receive function only pick up dedicated sent messages from other nodes?
                        If this is the case I will have the display node to query the controller. No clue how to do that.

                        I'll build the display node tomorrow to test the sketch I have now and see if it receives the data of node 38 (weather station and its 5 sensors).

                        mfalkviddM 1 Reply Last reply
                        0
                        • PetjepetP Petjepet

                          @mfalkvidd actually it is one node having 5 sensors.

                          My setup is one gateway with multiple nodes (4 PIRs, 1 Temperature, 1 Humidity and the weather station with 5 sensors).
                          These nodes just use the standard 'send' function. This is a broadcast, isn't it, since no destination node is provided in this function?

                          The gateway picks up these messages of the nodes (as I can see them in my controller Pimatic) and I hope the display node will pick the message up as well.
                          Or does the receive function only pick up dedicated sent messages from other nodes?
                          If this is the case I will have the display node to query the controller. No clue how to do that.

                          I'll build the display node tomorrow to test the sketch I have now and see if it receives the data of node 38 (weather station and its 5 sensors).

                          mfalkviddM Offline
                          mfalkviddM Offline
                          mfalkvidd
                          Mod
                          wrote on last edited by
                          #12

                          @Petjepet said in Display node: how to set up:

                          @mfalkvidd actually it is one node having 5 sensors.

                          Yes, you're right. Sorry about the confusion.

                          My setup is one gateway with multiple nodes (4 PIRs, 1 Temperature, 1 Humidity and the weather station with 5 sensors).
                          These nodes just use the standard 'send' function. This is a broadcast, isn't it, since no destination node is provided in this function?

                          No. The default destination for messages is the gateway, so they will only be received by the gateway.

                          The gateway picks up these messages of the nodes (as I can see them in my controller Pimatic) and I hope the display node will pick the message up as well.

                          No the display node will not receive the messages unless the messages have the node as destination (message.setDestination() )

                          Or does the receive function only pick up dedicated sent messages from other nodes?

                          Correct

                          If this is the case I will have the display node to query the controller. No clue how to do that.

                          Use the request function

                          PetjepetP 1 Reply Last reply
                          0
                          • mfalkviddM mfalkvidd

                            @Petjepet said in Display node: how to set up:

                            @mfalkvidd actually it is one node having 5 sensors.

                            Yes, you're right. Sorry about the confusion.

                            My setup is one gateway with multiple nodes (4 PIRs, 1 Temperature, 1 Humidity and the weather station with 5 sensors).
                            These nodes just use the standard 'send' function. This is a broadcast, isn't it, since no destination node is provided in this function?

                            No. The default destination for messages is the gateway, so they will only be received by the gateway.

                            The gateway picks up these messages of the nodes (as I can see them in my controller Pimatic) and I hope the display node will pick the message up as well.

                            No the display node will not receive the messages unless the messages have the node as destination (message.setDestination() )

                            Or does the receive function only pick up dedicated sent messages from other nodes?

                            Correct

                            If this is the case I will have the display node to query the controller. No clue how to do that.

                            Use the request function

                            PetjepetP Offline
                            PetjepetP Offline
                            Petjepet
                            wrote on last edited by Petjepet
                            #13

                            @mfalkvidd I'm getting there in time :)
                            Thanks for all the patience you have in explaining.

                            Using the message.setDestination() function would then be an option to implement/add in the weather station node for each of the 5 sensors?
                            The drawback would be to reprogram the weatherstation which is fully operational now.

                            Using the resquest function in the display node would want to activate the weather station (being a battery node in my garden) which uses the sleep mode and that would not work as documented.

                            As said before I would also want to use the display node as a repeater.
                            This would make it a kind of gateway in passing through data.
                            Is there a possibility there to evaluate the weather station node data?

                            You also mentioned a way to get the data from the controller (Pimatic in my case).
                            How can I request data from the controller/gateway?
                            Or is there a way to let the controller/gateway send the data to the display node?

                            Maybe I'm looking at this issue in the wrong way.
                            All I would like to do is display data from a battery operated sensor node on another node.

                            mfalkviddM 1 Reply Last reply
                            0
                            • PetjepetP Petjepet

                              @mfalkvidd I'm getting there in time :)
                              Thanks for all the patience you have in explaining.

                              Using the message.setDestination() function would then be an option to implement/add in the weather station node for each of the 5 sensors?
                              The drawback would be to reprogram the weatherstation which is fully operational now.

                              Using the resquest function in the display node would want to activate the weather station (being a battery node in my garden) which uses the sleep mode and that would not work as documented.

                              As said before I would also want to use the display node as a repeater.
                              This would make it a kind of gateway in passing through data.
                              Is there a possibility there to evaluate the weather station node data?

                              You also mentioned a way to get the data from the controller (Pimatic in my case).
                              How can I request data from the controller/gateway?
                              Or is there a way to let the controller/gateway send the data to the display node?

                              Maybe I'm looking at this issue in the wrong way.
                              All I would like to do is display data from a battery operated sensor node on another node.

                              mfalkviddM Offline
                              mfalkviddM Offline
                              mfalkvidd
                              Mod
                              wrote on last edited by
                              #14

                              @Petjepet said in Display node: how to set up:

                              @mfalkvidd I'm getting there in time :)
                              Thanks for all the patience you have in explaining.

                              Using the message.setDestination() function would then be an option to implement/add in the weather station node for each of the 5 sensors?
                              The drawback would be to reprogram the weatherstation which is fully operational now.

                              Yes

                              Using the resquest function in the display node would want to activate the weather station (being a battery node in my garden) which uses the sleep mode and that would not work as documented.

                              As said before I would also want to use the display node as a repeater.
                              This would make it a kind of gateway in passing through data.
                              Is there a possibility there to evaluate the weather station node data?

                              Maybe. I don't know unfortunately.

                              You also mentioned a way to get the data from the controller (Pimatic in my case).
                              How can I request data from the controller/gateway?

                              I think you can just request the data from the gateway and the controller will respond but I am not sure.

                              Or is there a way to let the controller/gateway send the data to the display node?

                              Some controllers have the ability to do stuff when messages are received. I think Domoticz uses lua for that. I have not done anything similar myself though.

                              The pimatic area of the MySensors forum seems to be a very quiet place :(

                              1 Reply Last reply
                              0
                              • gohanG Offline
                                gohanG Offline
                                gohan
                                Mod
                                wrote on last edited by
                                #15

                                Reprogramming the weather station it would only be a matter of adding the extra send commands to the display.
                                I was also thinking that this would be a case where mqtt would come handy, since you can get all the sensor data from pretty much anything that has an ip connection to the mqtt server.

                                1 Reply Last reply
                                0
                                • PetjepetP Offline
                                  PetjepetP Offline
                                  Petjepet
                                  wrote on last edited by
                                  #16

                                  @gohan I would like to leave the weather station reprogramming as the last option since it was built in the v1.5 period and calibrated. Never try to repair a working device :)

                                  In general I would like to develop a solution where display nodes can be added to the network not having to change other nodes for that. The independency of using display nodes without having to change sensor nodes would be great to achieve.

                                  @mfalkvidd I'll try to find out how to request data from the gateway/controller of a specific node. As long as the Pimatic controller is showing the data there must be a way to get it from there. Search the Pimatic forum for now.

                                  gohanG Boots33B 2 Replies Last reply
                                  1
                                  • PetjepetP Petjepet

                                    @gohan I would like to leave the weather station reprogramming as the last option since it was built in the v1.5 period and calibrated. Never try to repair a working device :)

                                    In general I would like to develop a solution where display nodes can be added to the network not having to change other nodes for that. The independency of using display nodes without having to change sensor nodes would be great to achieve.

                                    @mfalkvidd I'll try to find out how to request data from the gateway/controller of a specific node. As long as the Pimatic controller is showing the data there must be a way to get it from there. Search the Pimatic forum for now.

                                    gohanG Offline
                                    gohanG Offline
                                    gohan
                                    Mod
                                    wrote on last edited by
                                    #17

                                    @Petjepet
                                    If you want more flexibility, I think mqtt is the best solution as you can add as many displays as you want, you could make an esp8266 mqtt gateway with display and nrf24 radio (if needed) or just an esp8266 with display with simple mqtt client (not mysensors) that subscribes to topics in the mqtt server and displays values.

                                    1 Reply Last reply
                                    0
                                    • PetjepetP Offline
                                      PetjepetP Offline
                                      Petjepet
                                      wrote on last edited by Petjepet
                                      #18
                                      This post is deleted!
                                      1 Reply Last reply
                                      0
                                      • gohanG Offline
                                        gohanG Offline
                                        gohan
                                        Mod
                                        wrote on last edited by
                                        #19

                                        Did you try to add some serial print in order to check if that code in receive function is actually executed?

                                        1 Reply Last reply
                                        0
                                        • PetjepetP Petjepet

                                          @gohan I would like to leave the weather station reprogramming as the last option since it was built in the v1.5 period and calibrated. Never try to repair a working device :)

                                          In general I would like to develop a solution where display nodes can be added to the network not having to change other nodes for that. The independency of using display nodes without having to change sensor nodes would be great to achieve.

                                          @mfalkvidd I'll try to find out how to request data from the gateway/controller of a specific node. As long as the Pimatic controller is showing the data there must be a way to get it from there. Search the Pimatic forum for now.

                                          Boots33B Offline
                                          Boots33B Offline
                                          Boots33
                                          Hero Member
                                          wrote on last edited by Boots33
                                          #20

                                          @Petjepet I have not done a lot with the request feature but here is how I understand it works.

                                          A node can make a request to the controller for information about its own child sensors by using request in its sketch. Typically this would be in the loop section of the sketch. The request is issued with the following line.

                                          request( sensorId, messageType)

                                          So if you had a binary switch sensor with a child id of 1 and you wanted to check on its status you would write it like this.

                                           request( 1,   V_STATUS);
                                          

                                          The request is then processed by your controller and the result is returned to the node that sent the request. You then need to have code on that node to do something with this information.

                                          As you have already noted this is where the void receive function is used.

                                          So for our example of a binary switch we could use something as simple as this

                                          void receive(const MyMessage &message) {
                                            
                                            if (message.type == V_STATUS) {
                                          
                                              //put code here to be executed when the return from the request arrives   
                                             }
                                           }
                                          

                                          If you have more than one child sensor that you are expecting returns from you could extend the code using message.sensor to test for which sensor the return is for.

                                           void receive(const MyMessage &message) {
                                          
                                            if (message.type == V_STATUS) { 
                                              switch (message.sensor) {
                                               case 1:                          //incoming message is for  sensor 1
                                                   // put code here to be executed when the message is for sensor 1
                                                 break;
                                               case 2:                       //incoming message is for sensor  2
                                                   // put code here to be executed when the message is for sensor 2
                                                 break;       
                                             }   
                                           }
                                          }
                                          
                                          

                                          If you wanted to separate returns from a request from normal messages from your controller. You can use message.getCommand()
                                          If you look in the send and receive serial data for your node you will see the command type for a request shown as c=2 , so you just need to test for type 2 commands.

                                           void receive(const MyMessage &message) {
                                          
                                               if (message.type == V_STATUS) { 
                                                 if (message.getCommand() == 2){
                                                   // put code here to be executed when the message is from a request
                                                 }
                                                 else {                                                             //process the message as per normal
                                                    switch (message.sensor) {
                                                       case 1:                                                     //incoming message is for  sensor 1
                                                         // put code here to be executed when the message is for sensor 1
                                                         break;
                                                       case 2:                                                     //incoming message is for sensor  2
                                                         // put code here to be executed when the message is for sensor 2
                                                         break;       
                                                    }   
                                                 }
                                               }
                                           }
                                          
                                          

                                          Making a direct request to another node is also possible. To do that you can use the optional third parameter in the request statement which is for the node id that you are requesting information from.

                                          The default is set to 0 which is the gateway but you can use the node id to select another destination.

                                          So if we wanted information from a binary switch sensor with an id of 1 which is on a node with an id of 20 we would do this

                                           request( 1, V_STATUS,  20);
                                          

                                          The gateway will rout this request to the desired node but it will be up to you to have code on that node to both read the request and then send a reply back to the node that asked for the information. Of course you will also need code on the sending node to process the request when it is returned

                                          PetjepetP gohanG 2 Replies Last reply
                                          3
                                          Reply
                                          • Reply as topic
                                          Log in to reply
                                          • Oldest to Newest
                                          • Newest to Oldest
                                          • Most Votes


                                          10

                                          Online

                                          11.7k

                                          Users

                                          11.2k

                                          Topics

                                          113.0k

                                          Posts


                                          Copyright 2019 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