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. Request Value from Node

Request Value from Node

Scheduled Pinned Locked Moved Development
15 Posts 4 Posters 2.1k Views 4 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.
  • gohanG Offline
    gohanG Offline
    gohan
    Mod
    wrote on last edited by
    #2

    take a look at this https://www.mysensors.org/build/pulse_power

    SoloamS 1 Reply Last reply
    0
    • gohanG gohan

      take a look at this https://www.mysensors.org/build/pulse_power

      SoloamS Offline
      SoloamS Offline
      Soloam
      Hardware Contributor
      wrote on last edited by
      #3

      @gohan Ii can see the request:

          } else if (sendTime && !pcReceived) {
              // No pulse count value received. Try requesting it again
              request(CHILD_ID, V_VAR1);
              lastSend=now;
          }
      

      But I can't seem to understand where is being processed, in the receive function no validation is preformed to check if it's a request or a actuation. In this case I presume that It's irrelevant (because is a informative node only), but in the case of a nodes with actuators, I need to know if the message that is arriving is a actuator (set) or a request.

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

        It is checking if it is a V_VAR1 message, the other messages use different variable types

        SoloamS 1 Reply Last reply
        0
        • gohanG gohan

          It is checking if it is a V_VAR1 message, the other messages use different variable types

          SoloamS Offline
          SoloamS Offline
          Soloam
          Hardware Contributor
          wrote on last edited by
          #5

          @gohan I see, it's the same solution that i'm using at the moment, it would be nice to have a flag in the requests replay, that would allow to make a cleaner code, without having to use dummy variables.

          Thank You @gohan

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

            I am using the pulse power meter but I didn't use any dummy variable. Also the controller plays a role too.

            SoloamS 1 Reply Last reply
            0
            • gohanG gohan

              I am using the pulse power meter but I didn't use any dummy variable. Also the controller plays a role too.

              SoloamS Offline
              SoloamS Offline
              Soloam
              Hardware Contributor
              wrote on last edited by
              #7

              @gohan you don't use a dummy variable (VAR_1)? So who do you know when the message arrives if it's a request?

              rozpruwaczR 1 Reply Last reply
              0
              • SoloamS Soloam

                @gohan you don't use a dummy variable (VAR_1)? So who do you know when the message arrives if it's a request?

                rozpruwaczR Offline
                rozpruwaczR Offline
                rozpruwacz
                wrote on last edited by
                #8

                I think that @Soloam is asking how can a gateway request a value from the node not how node can request a value from gateway. If so then You must hadle it in the receive funtion (https://www.mysensors.org/download/sensor_api_20#requesting-data). The request message has distinct command type (https://www.mysensors.org/download/serial_api_20). You can get the message command type with getCommand method - unfortunetly this is not documented ... why ?

                SoloamS 1 Reply Last reply
                0
                • rozpruwaczR rozpruwacz

                  I think that @Soloam is asking how can a gateway request a value from the node not how node can request a value from gateway. If so then You must hadle it in the receive funtion (https://www.mysensors.org/download/sensor_api_20#requesting-data). The request message has distinct command type (https://www.mysensors.org/download/serial_api_20). You can get the message command type with getCommand method - unfortunetly this is not documented ... why ?

                  SoloamS Offline
                  SoloamS Offline
                  Soloam
                  Hardware Contributor
                  wrote on last edited by Soloam
                  #9

                  @rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?

                  1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?

                  mfalkviddM rozpruwaczR 2 Replies Last reply
                  0
                  • SoloamS Soloam

                    @rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?

                    1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?

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

                    @soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.

                    SoloamS rozpruwaczR 2 Replies Last reply
                    0
                    • mfalkviddM mfalkvidd

                      @soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.

                      SoloamS Offline
                      SoloamS Offline
                      Soloam
                      Hardware Contributor
                      wrote on last edited by
                      #11

                      @mfalkvidd thank you, that will do the job! I leave the ideia to a isReq()! :)

                      Thank you all

                      1 Reply Last reply
                      1
                      • SoloamS Soloam

                        @rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?

                        1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?

                        rozpruwaczR Offline
                        rozpruwaczR Offline
                        rozpruwacz
                        wrote on last edited by
                        #12

                        @soloam said in Request Value from Node:

                        @rozpruwacz You are rigth, I Want GW => Node Request or Node => Node Requests, and I've seen the command type in the notes, but who can I access that command value in the code?
                        1;1;2;0;2;0 - Requesting Node 1 Child 1 variable V_STATUS, Who do I know that the Command is 2 (request) ?

                        as I said You need to use getCommand method on the message object.

                        1 Reply Last reply
                        0
                        • mfalkviddM mfalkvidd

                          @soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.

                          rozpruwaczR Offline
                          rozpruwaczR Offline
                          rozpruwacz
                          wrote on last edited by rozpruwacz
                          #13

                          @mfalkvidd said in Request Value from Node:

                          @soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.

                          Is this mGetCommand is official API ? because it does not look like. I wouldn't use undocumented methods, because they may disapear in new releases.

                          mfalkviddM 1 Reply Last reply
                          0
                          • rozpruwaczR rozpruwacz

                            @mfalkvidd said in Request Value from Node:

                            @soloam looks like you should be able to use mGetCommand and check for C_SET / C_REQ.

                            Is this mGetCommand is official API ? because it does not look like. I wouldn't use undocumented methods, because they may disapear in new releases.

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

                            @rozpruwacz yes it is.

                            1 Reply Last reply
                            0
                            • rozpruwaczR Offline
                              rozpruwaczR Offline
                              rozpruwacz
                              wrote on last edited by
                              #15

                              I didn't see that before, thanks :)

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


                              15

                              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