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. how to read other device status with arduino?

how to read other device status with arduino?

Scheduled Pinned Locked Moved Development
5 Posts 2 Posters 1.3k Views 2 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.
  • L Offline
    L Offline
    leeoz
    wrote on last edited by leeoz
    #1

    Hey,
    I'm using veraEdge with arduino gateway and I have a few temperature sensors on my network.
    Ive search the forums and examples but could find a way to do what I want.

    Let say I have arduino1 has a DHT sensor and is a S_TEMP device #11 on my network
    and arduino2 has LCD and is set to be S_HVAC device #12 on my network

    I would like to show on arduino2 LCD the temperature read by arduino1.
    Can u please help?

    BartEB L 2 Replies Last reply
    0
    • L leeoz

      Hey,
      I'm using veraEdge with arduino gateway and I have a few temperature sensors on my network.
      Ive search the forums and examples but could find a way to do what I want.

      Let say I have arduino1 has a DHT sensor and is a S_TEMP device #11 on my network
      and arduino2 has LCD and is set to be S_HVAC device #12 on my network

      I would like to show on arduino2 LCD the temperature read by arduino1.
      Can u please help?

      BartEB Offline
      BartEB Offline
      BartE
      Contest Winner
      wrote on last edited by BartE
      #2

      @leeoz there are two ways to achieve this

      1. The easy way:
        Each time the temperature is changed in arduino1 and the controller is updated with a
        message like this:
      gw.send(msgTemp.set(((float)temperature / 10.0), 1)); 
      

      Also send a message to arduino2 something like this:
      arduino1 code:

      // This can be the sensor ID on arduino2 device #12 (but if you do not check each integer between 1-254 will do)
      #define MYSENSOR_TEMP_LCD  1
      MyMessage msgTempNode2 (MYSENSOR_TEMP_LCD,  V_TEMP);  
      
      void loop ()
      {
          gw.process();
          ... do stuff
         if (oldtemperature  != temperature)
         {     // inform the gateway we have a new temp.
              gw.send(msgTemp.set(((float)temperature / 10.0), 1)); 
          
              gw.wait(100); // give the gateway some time to process the 1ste message
      
             // inform our LCD slave node also about the temp. change
             msgTempNode2.setDestination(12); // This is the node ID on arduino2 
             gw.send(msgTempNode2.set(((float)temperature / 10.0), 1),; 
             oldtemperature  = temperature;
        }
      
          ... do some more stuff
      }
      

      The LCD arduino should handle the incoming TEMP message, arduino2 code:

      void incomingMessage(const MyMessage &message) {
         if (message.isAck()) {
              Serial.println(F("GW ack"));
         }
         switch (message.type) {
            case V_TEMP:
                Serial.print("New temperature received : ");
                Serial.println(message.getFloat());
                ... do some stuff to update your LCD screen
                break; 
        }
      }
      

      2)The second more complex way is to request the temperature from arduino2 to arduino1
      arduino1 code:

      // This can be the sensor ID on arduino2 device #12 (but if you do not check each integer between 1-254 will do)
      #define MYSENSOR_TEMP_LCD  1
      MyMessage msgTempNode2 (MYSENSOR_TEMP_LCD,  V_TEMP);  
      
      void loop ()
      {
          gw.process();
          ... do stuff
         if (oldtemperature  != temperature)
         {     // inform the gateway we have a new temp.
              gw.send(msgTemp.set(((float)temperature / 10.0), 1)); 
              // Store the temp.
              oldtemperature  = temperature;
        }
         ... do more stuff
      }
      
      void incomingMessage(const MyMessage &message) {
          if (mGetCommand(message) == C_REQ) {
               MyMessage answerMsg;
               Serial.print("Incoming request for sensor: ");
               Serial.println(message.sensor);
               mSetCommand(answerMsg, C_SET);
               answerMsg.setSensor(message.sensor);
               answerMsg.setDestination(message.sender);
               switch (message.sensor) {
                 case MYSENSOR_TEMP:
                     answerMsg.setType(V_TEMP);
                     gw.send(answerMsg.set((float)(oldtemperature/ 10.0), 1));
                     break;
              }
          } else {
              if (message.isAck()) {
                  Serial.println(F("GW ack"));
              }
              switch (message.type) {
                  ... handle other messages
              }
         }
      }
      

      arduino2 code:

      void loop ()
      {
        gw.process();
          ... do stuff
         if (time_to_poll_for_temp())
         {     // Request for temperature
               gw.request(MYSENSOR_TEMP, V_TEMP, 12);   // This is the node ID on arduino2 
        }
      }
      
      void incomingMessage(const MyMessage &message) {
         if (message.isAck()) {
              Serial.println(F("GW ack"));
         }
         switch (message.type) {
            case V_TEMP:
                Serial.print("New temperature received : ");
                Serial.println(message.getFloat());
                ... do some stuff to update your LCD screen
                break; 
        }
      }
      ``
      1 Reply Last reply
      1
      • L leeoz

        Hey,
        I'm using veraEdge with arduino gateway and I have a few temperature sensors on my network.
        Ive search the forums and examples but could find a way to do what I want.

        Let say I have arduino1 has a DHT sensor and is a S_TEMP device #11 on my network
        and arduino2 has LCD and is set to be S_HVAC device #12 on my network

        I would like to show on arduino2 LCD the temperature read by arduino1.
        Can u please help?

        L Offline
        L Offline
        leeoz
        wrote on last edited by
        #3

        @BartE
        Tnx for the respose, great.
        Also, if i would like to request value from vera?
        So i use the gw.request(VeraDeviceID, V_TEMP,??)

        Also for solution 2, on the request from arduino2 code,
        gw.request(MYSENSOR_TEMP, V_TEMP, 12);
        MYSENSOR_TEMP is what?
        And why did u type 12? The sensor id is 11...

        I think that in general i dont understad the use of gw.request()

        BartEB 1 Reply Last reply
        0
        • L leeoz

          @BartE
          Tnx for the respose, great.
          Also, if i would like to request value from vera?
          So i use the gw.request(VeraDeviceID, V_TEMP,??)

          Also for solution 2, on the request from arduino2 code,
          gw.request(MYSENSOR_TEMP, V_TEMP, 12);
          MYSENSOR_TEMP is what?
          And why did u type 12? The sensor id is 11...

          I think that in general i dont understad the use of gw.request()

          BartEB Offline
          BartEB Offline
          BartE
          Contest Winner
          wrote on last edited by BartE
          #4

          @leeoz said:

          @BartE
          Tnx for the respose, great.
          Also, if i would like to request value from vera?
          So i use the gw.request(VeraDeviceID, V_TEMP,??)

          Requesting Vera is not possible, there is no request interface between the GW and Vera

          Also for solution 2, on the request from arduino2 code,
          gw.request(MYSENSOR_TEMP, V_TEMP, 12);
          MYSENSOR_TEMP is what?
          Just a sensor ID on your arduino1
          And why did u type 12? The sensor id is 11...

          True, this should have been 11

          I think that in general i dont understad the use of gw.request()

          gw,request() sends a message to a different node requesting for data, the requested node has to process this message and respond with a second message. Look at this link at the "Requesting data" paragraph

          L 1 Reply Last reply
          0
          • BartEB BartE

            @leeoz said:

            @BartE
            Tnx for the respose, great.
            Also, if i would like to request value from vera?
            So i use the gw.request(VeraDeviceID, V_TEMP,??)

            Requesting Vera is not possible, there is no request interface between the GW and Vera

            Also for solution 2, on the request from arduino2 code,
            gw.request(MYSENSOR_TEMP, V_TEMP, 12);
            MYSENSOR_TEMP is what?
            Just a sensor ID on your arduino1
            And why did u type 12? The sensor id is 11...

            True, this should have been 11

            I think that in general i dont understad the use of gw.request()

            gw,request() sends a message to a different node requesting for data, the requested node has to process this message and respond with a second message. Look at this link at the "Requesting data" paragraph

            L Offline
            L Offline
            leeoz
            wrote on last edited by
            #5

            @BartE
            Ok, I think I got it all. Great tnx a lot

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


            18

            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