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. Controllers
  3. Domoticz
  4. Requesting value from Domoticz

Requesting value from Domoticz

Scheduled Pinned Locked Moved Domoticz
39 Posts 9 Posters 13.1k Views 11 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.
  • dbemowskD dbemowsk

    I pull the thermostat mode from my thermostat bridge node like this:

        request( CHILD_ID_MODE, V_TEXT );
    

    I have never used the destination attribute, so I can't speak to it's use, but using the childSensorId and variableType works for me. You still need to use the technique I described to set the MySensors child node from the dummy sensor though.

    loic13L Offline
    loic13L Offline
    loic13
    wrote on last edited by
    #12

    Hi @dbemowsk,
    I'm trying to figure out the message format in the receive() function. Could you show an example of your receive() function ? I couldn't find the received message format.
    Thank's

    1 Reply Last reply
    0
    • dbemowskD Offline
      dbemowskD Offline
      dbemowsk
      wrote on last edited by
      #13

      You are going to use 2 things. message.type and message.data. The message.type in my scenario is V_TEXT, and message.data is the payload, which in my case is O, H, C or A, but can be whatever you pass from Domoticz. The code in your receive function would look something like this:

      if (message.type == V_TEXT) {
        Serial.println("Received data" + String(message.data));
        //Here you would do something with message.data
      }
      

      If you have more than one child sensor sending V_TEXT data, you would then use an if statement or a switch/case to check message.sensor for the child ID of the sensor and process each as above.

      if (message.type == V_TEXT) {
        if (message.sensor == 1) {
          Serial.println("Received data from child 1" + String(message.data));
          //Here you would do something with message.data for the first child
        } else if (message.sensor == 2) {
          Serial.println("Received data from child 2" + String(message.data));
          //Here you would do something with message.data for the second child
        }
      }
      

      Let us know if you have trouble.

      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

      loic13L 1 Reply Last reply
      0
      • dbemowskD dbemowsk

        You are going to use 2 things. message.type and message.data. The message.type in my scenario is V_TEXT, and message.data is the payload, which in my case is O, H, C or A, but can be whatever you pass from Domoticz. The code in your receive function would look something like this:

        if (message.type == V_TEXT) {
          Serial.println("Received data" + String(message.data));
          //Here you would do something with message.data
        }
        

        If you have more than one child sensor sending V_TEXT data, you would then use an if statement or a switch/case to check message.sensor for the child ID of the sensor and process each as above.

        if (message.type == V_TEXT) {
          if (message.sensor == 1) {
            Serial.println("Received data from child 1" + String(message.data));
            //Here you would do something with message.data for the first child
          } else if (message.sensor == 2) {
            Serial.println("Received data from child 2" + String(message.data));
            //Here you would do something with message.data for the second child
          }
        }
        

        Let us know if you have trouble.

        loic13L Offline
        loic13L Offline
        loic13
        wrote on last edited by
        #14

        That is perfect thanks a lot.

        1 Reply Last reply
        0
        • dbemowskD dbemowsk

          I pull the thermostat mode from my thermostat bridge node like this:

              request( CHILD_ID_MODE, V_TEXT );
          

          I have never used the destination attribute, so I can't speak to it's use, but using the childSensorId and variableType works for me. You still need to use the technique I described to set the MySensors child node from the dummy sensor though.

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by A Former User
          #15

          @dbemowsk

          At the moment I'm trying to send a text value from Domoticz with MySensors Gateway to one of my nodes.

          I need to implement the "request" function in this node. So here's my question: what value did you assign to "CHILD_ID_MODE". I presume that's the ID of the dummy selector described in another topic on this forum? How did you obtain this value? Is it available somewhere in Domoticz UI?

          Now I request a text value, but all I get is a blank message, cause I don't know what I should insert as "uint8_t childSensorId".

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

            The child ID is something you define when you present the sensors of the node

            ? 1 Reply Last reply
            0
            • gohanG gohan

              The child ID is something you define when you present the sensors of the node

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #17

              @gohan Yes, I understand, but when I create a dummy text sensor I can't define its child ID. Can I find it somewhere?

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

                You have to create a sensor in the sensor node sketch, assign a child ID to it and present it like the others sensors during setup, then it should show on the controller. I can't be more specific because I haven't worked on text sensors yet

                ? 1 Reply Last reply
                0
                • gohanG gohan

                  You have to create a sensor in the sensor node sketch, assign a child ID to it and present it like the others sensors during setup, then it should show on the controller. I can't be more specific because I haven't worked on text sensors yet

                  ? Offline
                  ? Offline
                  A Former User
                  wrote on last edited by A Former User
                  #19

                  @gohan Dummy sensors are created in Domoticz, they don't use the MySensors library, so one doesn't upload any sketches to Arduino :)

                  What I want to achieve specifically is to send outside temperature received from WeatherUnderground to one of my MySensors nodes.

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

                    I know, but if you don't create a sensor able to receive the value, you can't send anything to it through the mysensors network

                    ? 1 Reply Last reply
                    0
                    • gohanG gohan

                      I know, but if you don't create a sensor able to receive the value, you can't send anything to it through the mysensors network

                      ? Offline
                      ? Offline
                      A Former User
                      wrote on last edited by
                      #21

                      @gohan hey, now I get it!

                      got it working the way I wanted, thank you so much :D

                      mar.conteM 1 Reply Last reply
                      1
                      • gohanG Offline
                        gohanG Offline
                        gohan
                        Mod
                        wrote on last edited by
                        #22

                        Just for my curiosity, why are you using the temperature from weather underground? Is it just displayed on a screen?

                        ? 1 Reply Last reply
                        0
                        • gohanG gohan

                          Just for my curiosity, why are you using the temperature from weather underground? Is it just displayed on a screen?

                          ? Offline
                          ? Offline
                          A Former User
                          wrote on last edited by A Former User
                          #23

                          @gohan I'm doing a project for my master's thesis.

                          There's a mathematical thermal model of a building running on MySensors node. I wanted to supply it with an information about actual outside temperature to have accurate results.

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

                            A real mysensors project would require an external node with temperature and humidity sensor 😁

                            ? 1 Reply Last reply
                            0
                            • gohanG gohan

                              A real mysensors project would require an external node with temperature and humidity sensor 😁

                              ? Offline
                              ? Offline
                              A Former User
                              wrote on last edited by
                              #25

                              @gohan This model is just a small part of my project. But I get your concept.

                              There's already a DHT11 node running inside my house, measuring quantities that you've mentioned.

                              1 Reply Last reply
                              1
                              • ? A Former User

                                @gohan hey, now I get it!

                                got it working the way I wanted, thank you so much :D

                                mar.conteM Offline
                                mar.conteM Offline
                                mar.conte
                                wrote on last edited by mar.conte
                                #26

                                @tomek_olo
                                Sorry what is the way for send from domoticz child -node to other node through lua script for example Tanks

                                M.C.

                                ? 1 Reply Last reply
                                0
                                • mar.conteM mar.conte

                                  @tomek_olo
                                  Sorry what is the way for send from domoticz child -node to other node through lua script for example Tanks

                                  ? Offline
                                  ? Offline
                                  A Former User
                                  wrote on last edited by A Former User
                                  #27

                                  @mar.conte I don't understand your question. Can you clarify, please?

                                  mar.conteM 1 Reply Last reply
                                  0
                                  • ? A Former User

                                    @mar.conte I don't understand your question. Can you clarify, please?

                                    mar.conteM Offline
                                    mar.conteM Offline
                                    mar.conte
                                    wrote on last edited by
                                    #28

                                    @tomek_olo
                                    Sorry what is the way for send from domoticz child -node to other node through lua script for example Tanks

                                    M.C.

                                    ? 1 Reply Last reply
                                    0
                                    • mar.conteM mar.conte

                                      @tomek_olo
                                      Sorry what is the way for send from domoticz child -node to other node through lua script for example Tanks

                                      ? Offline
                                      ? Offline
                                      A Former User
                                      wrote on last edited by A Former User
                                      #29

                                      @mar.conte

                                      OK, I'll try to describe everything I've done to get it working:

                                      1. I'm presenting MySensors node to Domoticz as S_INFO: "present(CHILD_ID, S_INFO);"
                                      2. Next step is to add this node in your Domoticz. It should be visible at first in "Devices" as a "Text" device. After you add it it will be present in the "Utility" tab.
                                      3. Now you have to edit a text value of this device in Domoticz. (I think that's what interests you but in reverse) I'm using a "Device" script that updates this text value with outside temperature every time the weather is updated:

                                      commandArray = {}
                                      local tempOut = devicechanged["Outside_Temperature"]
                                      local tempOutIdx = 25

                                      if ( devicechanged["Outside"]) then
                                      commandArray['UpdateDevice'] = otherdevices_idx['TextNode']..'|1|'..tempOut
                                      end

                                      1. Now when I want to download this new value to my node I use "request( CHILD_ID, V_TEXT );" and inside "receive()" function:

                                      if (message.type == V_TEXT) {
                                      if (message.sensor == CHILD_ID) {
                                      outTemp = message.getFloat();
                                      }
                                      }

                                      That's all, it's complicated. If you have any questions feel free to ask. I'll do my best to help.

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

                                        If the temperature sensor is also running on a mysensors node, you can send the value from the node to the one with lcd screen directly without using the controller.

                                        1 Reply Last reply
                                        0
                                        • mar.conteM Offline
                                          mar.conteM Offline
                                          mar.conte
                                          wrote on last edited by
                                          #31

                                          For send message to child node wich isnt present in device list? In other words i have a node wich is in device list and the child 's node called S_custom with id 200 .... the node id is 101...

                                          M.C.

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


                                          6

                                          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