Skip to content
  • 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. When requesting with request() function what reply should I expect?
  • Getting Started
  • Controller
  • Build
  • Hardware
  • Download/API
  • Forum
  • Store

When requesting with request() function what reply should I expect?

Scheduled Pinned Locked Moved General Discussion
10 Posts 2 Posters 2.7k Views 1 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.
  • palande.vaibhavP Offline
    palande.vaibhavP Offline
    palande.vaibhav
    wrote on last edited by palande.vaibhav
    #1

    Hello all,

    I am requesting the status of a switch with child ID 1 from another sensor node ID 2.

    I used request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
    In my case variable type is V_LIGHT so its request(1, 2, 2).

    I can see the sensor node 1 sending message and sensor node 2 receiving message in the debug log but sensor node doesn't send anything back to the requesting node.

    Now what kind of message should I expect from the node? OR I should write some code in the receiving node to create a response?

    Thank You

    sundberg84S 1 Reply Last reply
    0
    • palande.vaibhavP palande.vaibhav

      Hello all,

      I am requesting the status of a switch with child ID 1 from another sensor node ID 2.

      I used request(uint8_t childSensorId, uint8_t variableType, uint8_t destination);
      In my case variable type is V_LIGHT so its request(1, 2, 2).

      I can see the sensor node 1 sending message and sensor node 2 receiving message in the debug log but sensor node doesn't send anything back to the requesting node.

      Now what kind of message should I expect from the node? OR I should write some code in the receiving node to create a response?

      Thank You

      sundberg84S Offline
      sundberg84S Offline
      sundberg84
      Hardware Contributor
      wrote on last edited by
      #2

      @palande.vaibhav - without any major knowledge in this, i use request() against the controller and receive() to get the message back. Maybe you need to use recieve() in node 2 and code some reply in that function?

      Controller: Proxmox VM - Home Assistant
      MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
      MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
      RFLink GW - Arduino Mega + RFLink Shield, 433mhz

      palande.vaibhavP 1 Reply Last reply
      0
      • sundberg84S sundberg84

        @palande.vaibhav - without any major knowledge in this, i use request() against the controller and receive() to get the message back. Maybe you need to use recieve() in node 2 and code some reply in that function?

        palande.vaibhavP Offline
        palande.vaibhavP Offline
        palande.vaibhav
        wrote on last edited by
        #3

        @sundberg84
        I have void receive() in node 2. But to code something I need to know what I am listening to.

        Is that just a bool message with the state of the switch saying its ON or OFF??

        What do you have in the void receive() function you are using?

        sundberg84S 2 Replies Last reply
        0
        • palande.vaibhavP palande.vaibhav

          @sundberg84
          I have void receive() in node 2. But to code something I need to know what I am listening to.

          Is that just a bool message with the state of the switch saying its ON or OFF??

          What do you have in the void receive() function you are using?

          sundberg84S Offline
          sundberg84S Offline
          sundberg84
          Hardware Contributor
          wrote on last edited by
          #4

          @palande.vaibhav

          This is from my rainsensor and its < 2.0.
          Its expecting V_VAR1 (pulsecounter) from controller database.

          //Read if we have a incoming message.
          void receive(const MyMessage &msg) {
              if (msg.type==V_VAR1) {
              hwPulseCounter = msg.getULong();
              hwRainVolume = hwPulseCounter;
              pcReceived = true;
              Serial.print("Received last pulse count from gw: ");
              Serial.println(hwPulseCounter);   
              }
          }```

          Controller: Proxmox VM - Home Assistant
          MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
          MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
          RFLink GW - Arduino Mega + RFLink Shield, 433mhz

          palande.vaibhavP 1 Reply Last reply
          0
          • palande.vaibhavP palande.vaibhav

            @sundberg84
            I have void receive() in node 2. But to code something I need to know what I am listening to.

            Is that just a bool message with the state of the switch saying its ON or OFF??

            What do you have in the void receive() function you are using?

            sundberg84S Offline
            sundberg84S Offline
            sundberg84
            Hardware Contributor
            wrote on last edited by
            #5

            @palande.vaibhav https://github.com/mysensors/MySensorsArduinoExamples/blob/master/examples/RainGauge/RainGauge.ino#L546
            Is another example - i think this is 2.0 code

            Controller: Proxmox VM - Home Assistant
            MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
            MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
            RFLink GW - Arduino Mega + RFLink Shield, 433mhz

            1 Reply Last reply
            0
            • sundberg84S sundberg84

              @palande.vaibhav

              This is from my rainsensor and its < 2.0.
              Its expecting V_VAR1 (pulsecounter) from controller database.

              //Read if we have a incoming message.
              void receive(const MyMessage &msg) {
                  if (msg.type==V_VAR1) {
                  hwPulseCounter = msg.getULong();
                  hwRainVolume = hwPulseCounter;
                  pcReceived = true;
                  Serial.print("Received last pulse count from gw: ");
                  Serial.println(hwPulseCounter);   
                  }
              }```
              palande.vaibhavP Offline
              palande.vaibhavP Offline
              palande.vaibhav
              wrote on last edited by palande.vaibhav
              #6

              @sundberg84
              OK. And does your request() function looks just like mine?
              So, are you requesting V_VAR1 from the node?

              sundberg84S 1 Reply Last reply
              0
              • palande.vaibhavP palande.vaibhav

                @sundberg84
                OK. And does your request() function looks just like mine?
                So, are you requesting V_VAR1 from the node?

                sundberg84S Offline
                sundberg84S Offline
                sundberg84
                Hardware Contributor
                wrote on last edited by
                #7

                @palande.vaibhav - Nope, im requestion v_var from the controller. Thats what im unsure about...

                Controller: Proxmox VM - Home Assistant
                MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                palande.vaibhavP 1 Reply Last reply
                0
                • sundberg84S sundberg84

                  @palande.vaibhav - Nope, im requestion v_var from the controller. Thats what im unsure about...

                  palande.vaibhavP Offline
                  palande.vaibhavP Offline
                  palande.vaibhav
                  wrote on last edited by
                  #8

                  @sundberg84
                  Can you share your snippet of code where you have request() function?

                  1 Reply Last reply
                  0
                  • sundberg84S Offline
                    sundberg84S Offline
                    sundberg84
                    Hardware Contributor
                    wrote on last edited by
                    #9

                    https://forum.mysensors.org/topic/1950/domotiocz-rain-gauge/2

                    Controller: Proxmox VM - Home Assistant
                    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                    palande.vaibhavP 1 Reply Last reply
                    0
                    • sundberg84S sundberg84

                      https://forum.mysensors.org/topic/1950/domotiocz-rain-gauge/2

                      palande.vaibhavP Offline
                      palande.vaibhavP Offline
                      palande.vaibhav
                      wrote on last edited by palande.vaibhav
                      #10

                      @sundberg84 As far as I understand by looking at the code you have sensor on the same node which is requesting the pulse count from the GW??

                      OR you have reed switch on this node and sensor is on some other node? In the debug prints do you see a READ message in the serial monitor for your node which has reed switch?

                      With me, I am sending the request() from node 1 to node 2. I can see SEND message in serial monitor of node 1 and READ message in the serial monitor of GW and also a SEND message in GW serial monitor and READ message in node 2. So the message is reaching node 2 successfully but my node 2 is not sending any reply to that message.

                      So, node 1 is sending to GW, GW is receiving it and sending it to node 2, node 2 is receiving the message but node 2 is not replying. Is this what is supposed to happen? OR node 2 is actually supposed to send a reply back to node 1?

                      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.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
                      • OpenHardware.io
                      • Categories
                      • Recent
                      • Tags
                      • Popular