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. Troubleshooting
  3. Domoticz TEXT sensor triggering

Domoticz TEXT sensor triggering

Scheduled Pinned Locked Moved Troubleshooting
45 Posts 10 Posters 8.4k 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.
  • SushukkaS Offline
    SushukkaS Offline
    Sushukka
    wrote on last edited by
    #1

    Hello,
    This is already very well discussed topic, but I would like to broaden the scope a little bit without stealing anyones thread. So here it goes.
    There has been now several cases in my microcontroller journey with MySensors and Domoticz where I need to pass some command or code to some node for further processing. For example I want to have different lighting or user modes in some node. I create a dummy sensor on Domoticz and selector swith on that. After that I define a V_TEXT sensor on the node. Now I can simply update the TEXT sensor via the selector swith (Json commands) and the TEXT sensor variable will be updated. However, the information will not be passed to the node without explicitly requesting it from the node.

    MySensors/Domo support lots of ready made devices like RGB, switches, dimmers etc, but sometimes that's not just enough. The best way to pass information via controller is now by using V_TEXT/S_INFO sensor type, but it has a major downfall that Domoticz wont trigger anything when one of this type of sensors is updated. This forces MySensors users to do all kind of gimmicks with receive command triggering switches, dimmer hacking etc. All of which makes Domoticz ugly and kind a hacked.

    So what are the alternatives? I don't know, suggestions fellow MySenors users? The dummiest way is to make a poll requesting the TEXT info in regular manner. Works, but too inefficient. Other way is the dimmer type of hacking on Domo. I haven't used MQTT yet, could it be useful here? All the sensors and nodes are anyway MySensors ones so I assume that the Domo trigger problem persist. How about creating some generic lua script on Domo sending the information when it gets changed? Is it even possible to access this Domo/MySensors communication level ?

    SushukkaS 1 Reply Last reply
    0
    • SushukkaS Sushukka

      Hello,
      This is already very well discussed topic, but I would like to broaden the scope a little bit without stealing anyones thread. So here it goes.
      There has been now several cases in my microcontroller journey with MySensors and Domoticz where I need to pass some command or code to some node for further processing. For example I want to have different lighting or user modes in some node. I create a dummy sensor on Domoticz and selector swith on that. After that I define a V_TEXT sensor on the node. Now I can simply update the TEXT sensor via the selector swith (Json commands) and the TEXT sensor variable will be updated. However, the information will not be passed to the node without explicitly requesting it from the node.

      MySensors/Domo support lots of ready made devices like RGB, switches, dimmers etc, but sometimes that's not just enough. The best way to pass information via controller is now by using V_TEXT/S_INFO sensor type, but it has a major downfall that Domoticz wont trigger anything when one of this type of sensors is updated. This forces MySensors users to do all kind of gimmicks with receive command triggering switches, dimmer hacking etc. All of which makes Domoticz ugly and kind a hacked.

      So what are the alternatives? I don't know, suggestions fellow MySenors users? The dummiest way is to make a poll requesting the TEXT info in regular manner. Works, but too inefficient. Other way is the dimmer type of hacking on Domo. I haven't used MQTT yet, could it be useful here? All the sensors and nodes are anyway MySensors ones so I assume that the Domo trigger problem persist. How about creating some generic lua script on Domo sending the information when it gets changed? Is it even possible to access this Domo/MySensors communication level ?

      SushukkaS Offline
      SushukkaS Offline
      Sushukka
      wrote on last edited by
      #2

      @sushukka Strangely quiet here. :) This seems to be kind a common problem as there are many workarounds built because of this. However, I haven't seen no reasoning anywhere why the TEXT sensor update in Domoticz will not trigger any event to send the update to the node.
      I opened/continued a thread also on Domoticz forum:
      https://www.domoticz.com/forum/viewtopic.php?f=28&t=22801&p=177364#p177364
      Some LUA scripting maybe needed, but not sure yet. Still I see this a very crucial shortcoming as there are lots of cases where you need to pass parameters/commands etc. short information between Domo and MySensors nodes.

      1 Reply Last reply
      0
      • Nca78N Offline
        Nca78N Offline
        Nca78
        Hardware Contributor
        wrote on last edited by
        #3

        Hello,

        I don't think you will get response about the "why" questions on Domoticz here :)
        It's great for setting up easily your home automation setup, but there are some strange design choices/behaviours that quickly add up to make it some kind of a lua scripts nightmare. But that's another discussion :D
        Sorry not to have a solution to give you, I'm still using Domoticz but as soon as I'll find time I'll switch to something else.

        SushukkaS 1 Reply Last reply
        0
        • Nca78N Nca78

          Hello,

          I don't think you will get response about the "why" questions on Domoticz here :)
          It's great for setting up easily your home automation setup, but there are some strange design choices/behaviours that quickly add up to make it some kind of a lua scripts nightmare. But that's another discussion :D
          Sorry not to have a solution to give you, I'm still using Domoticz but as soon as I'll find time I'll switch to something else.

          SushukkaS Offline
          SushukkaS Offline
          Sushukka
          wrote on last edited by Sushukka
          #4

          @nca78 Thanks for the feedback. I have had similar feeling towards Domoticz for some while. What controller would you suggest? Have been watching OpenHab more closely now, but the conversion work required... :confounded:

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

            You could use a binary switch on the node that you can trigger to have the node request the text value you want. Not the ideal solution but it would just require a minor change. Otherwise you would have to start bothering the domoticz developers 😁

            SushukkaS 1 Reply Last reply
            0
            • gohanG gohan

              You could use a binary switch on the node that you can trigger to have the node request the text value you want. Not the ideal solution but it would just require a minor change. Otherwise you would have to start bothering the domoticz developers 😁

              SushukkaS Offline
              SushukkaS Offline
              Sushukka
              wrote on last edited by
              #6

              @gohan True...I'm just trying to find a way to avoid that darned dummy switch here and there mess. Have been playing with them too much lately. Domoticz developers seems to be also pretty slow to react to any suggestions. Ok, I don't pay to them, but HA and OpenHAB feels a bit more active nevertheless. Probably need to go the dummy hack path again, sigh. Probably have to change the controller soon as every this type of hack makes the conversion even harder in future.

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

                Life sucks, I know 😁

                I see your point, my suggestion was merely a workaround to the node running but if you foresee domoticz limitations a problem for the future, maybe it could be worth moving to another controller now that you don't have too many nodes around

                SushukkaS 1 Reply Last reply
                0
                • SushukkaS Sushukka

                  @nca78 Thanks for the feedback. I have had similar feeling towards Domoticz for some while. What controller would you suggest? Have been watching OpenHab more closely now, but the conversion work required... :confounded:

                  tbowmoT Offline
                  tbowmoT Offline
                  tbowmo
                  Admin
                  wrote on last edited by
                  #8

                  @sushukka

                  you could try the different controllers out, checking their capabilities.

                  For my part, I switched off domoticz more than one month ago, after I had converted my limited automation scripts over to node-red. Today I deleted the domoticz docker container as well.. No need for it to take up disk space :) I have kept the configuration volume for domoticz, so I can spin up a new instance of it in minutes..

                  1 Reply Last reply
                  0
                  • monteM Offline
                    monteM Offline
                    monte
                    wrote on last edited by monte
                    #9

                    @sushukka You can use netcat or socket connection from python script to send message directly to mysensors GW, omitting domoticz. Then you can link this script to your dummy switch in domoticz. It works.

                    netcat:

                    netcat <gw ip> <port>
                    

                    python:

                    #!/usr/bin/python3
                    
                    import socket
                    from time import sleep
                    
                    def gwsend(hostname, port, content):
                        s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                        s.connect((hostname, port))
                        sleep(1)
                        s.sendall(content)
                        s.shutdown(socket.SHUT_WR)
                        s.close()
                    
                    
                    string = str.encode("some text")  # Your TEXT message
                    gwsend("127.0.0.1", 5003, b"2;1;1;1;47;" + string + b"\n")
                    
                    
                    
                    SushukkaS 1 Reply Last reply
                    0
                    • gohanG gohan

                      Life sucks, I know 😁

                      I see your point, my suggestion was merely a workaround to the node running but if you foresee domoticz limitations a problem for the future, maybe it could be worth moving to another controller now that you don't have too many nodes around

                      SushukkaS Offline
                      SushukkaS Offline
                      Sushukka
                      wrote on last edited by Sushukka
                      #10

                      @gohan said in Domoticz TEXT sensor triggering:

                      Life sucks, I know 😁

                      I see your point, my suggestion was merely a workaround to the node running but if you foresee domoticz limitations a problem for the future, maybe it could be worth moving to another controller now that you don't have too many nodes around

                      Around a hundred sensors now and growing...not very excited of the conversion work... :confused: However, started some planning already and now MySensors GW is converted from serial to W5100/MQTT and Node-red has been installed. Have had plans to test it for a some while, but now really started playing with it. Seems that you can do all kind of nice middle-level stuff with it. :muscle:

                      Plan now is to test some other controller via MQTT but only by subscribing to the MySensors queue.

                      Also interesting to hear that people have switched totally to Nodered ( @tbowmo do you still have some controller or just Node-red gui/dashboard). Is there some ready-made interpreters for MySensors messages or need one define them all manually?

                      And @monte, I definitely think your solution is the coolest one...but I know that if I take this alluring path, I'll end even deeper with the domo hacking I want to get rid off. :grin:

                      1 Reply Last reply
                      0
                      • tbowmoT Offline
                        tbowmoT Offline
                        tbowmo
                        Admin
                        wrote on last edited by
                        #11

                        @Sushukka

                        I have switched completely to nodered, my automation is done in flows (you can check it out on github).

                        There is a set of mysensors nodes for nodered, that decode / encode MySensors serial protocol, and MySensors MQTT topics, and also enables you to create dummy mysensors nodes, and inject that data into your streams, they can be found on the forum here, or on npmjs.com.

                        What I do not have, is the ability to hand out new node-id's (yet) I am investigating how to do that in a sensible way, so that data is persisted across restarts / re-deploys of node-red.

                        1 Reply Last reply
                        0
                        • monteM monte

                          @sushukka You can use netcat or socket connection from python script to send message directly to mysensors GW, omitting domoticz. Then you can link this script to your dummy switch in domoticz. It works.

                          netcat:

                          netcat <gw ip> <port>
                          

                          python:

                          #!/usr/bin/python3
                          
                          import socket
                          from time import sleep
                          
                          def gwsend(hostname, port, content):
                              s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                              s.connect((hostname, port))
                              sleep(1)
                              s.sendall(content)
                              s.shutdown(socket.SHUT_WR)
                              s.close()
                          
                          
                          string = str.encode("some text")  # Your TEXT message
                          gwsend("127.0.0.1", 5003, b"2;1;1;1;47;" + string + b"\n")
                          
                          
                          
                          SushukkaS Offline
                          SushukkaS Offline
                          Sushukka
                          wrote on last edited by
                          #12

                          @monte I need to move to a next project so before conversion to Node-red and/or OpenHAB, how would you use netcat type of injection with MQTT? I mean now I have MySensors in W5100/MQTT mode and I want to send an update to my V_TEXT sensor via MQTT. Easiest way to do this with Domoticz would be by triggering some script. Sending an MQTT update via Python is probably easy (dunno, haven't done yet), but I have no idea how to form the message so that it would be in correct MySensors format...My node id is 31 and the text sensor child is 1:

                          #define MY_NODE_ID     31
                          #define LED_MODE_ID     1 
                          MyMessage msgLedMode(LED_MODE_ID, V_TEXT);
                          

                          The payload is some number between -1 to 56. Really appreciate your help. :relieved:

                          monteM 1 Reply Last reply
                          0
                          • SushukkaS Sushukka

                            @monte I need to move to a next project so before conversion to Node-red and/or OpenHAB, how would you use netcat type of injection with MQTT? I mean now I have MySensors in W5100/MQTT mode and I want to send an update to my V_TEXT sensor via MQTT. Easiest way to do this with Domoticz would be by triggering some script. Sending an MQTT update via Python is probably easy (dunno, haven't done yet), but I have no idea how to form the message so that it would be in correct MySensors format...My node id is 31 and the text sensor child is 1:

                            #define MY_NODE_ID     31
                            #define LED_MODE_ID     1 
                            MyMessage msgLedMode(LED_MODE_ID, V_TEXT);
                            

                            The payload is some number between -1 to 56. Really appreciate your help. :relieved:

                            monteM Offline
                            monteM Offline
                            monte
                            wrote on last edited by
                            #13

                            @sushukka I have limited knowledge of mqtt, I'm not using it in my setup, with ncat you can only talk directly to tcp/udp socket and mqtt is built above it. But there is mqtt library for python, and guides for using it. http://www.steves-internet-guide.com/into-mqtt-python-client/ try to follow those steps, I will try too :)

                            1 Reply Last reply
                            0
                            • tbowmoT Offline
                              tbowmoT Offline
                              tbowmo
                              Admin
                              wrote on last edited by
                              #14

                              @Sushukka

                              mqtt publish example in python

                              import paho.mqtt.publish as publish
                              payload = 'Hey there'
                              publish.single('mys-out/1/1/1/0/47', payload, hostname=<mqtthost>, port=<mqttport, retain=False)
                              

                              'mys-out/99/1/1/0/47' is the MQTT topic, and is decoded as follows:
                              99: Node ID
                              1: ChildId
                              1: command (Set in this case)
                              0: ACK (None in this case)
                              47: V_TYPE (V_TEXT in this case)

                              Above pretty much follows the MySensors serial protocol, as found here, only difference is that sensor payload, and sensor id / msg type etc. is split into two parameters in MQTT (as in payload and topic), and doesn't come in as a single string.

                              SushukkaS 1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                pjr
                                wrote on last edited by
                                #15

                                How about presenting additional S_BINARY/V_STATUS in your node. In domoticz when text changes set this to ON/OFF. From there you now its time to request text from domoticz.

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

                                  That's what I suggest 2 days ago 😁

                                  1 Reply Last reply
                                  0
                                  • K Offline
                                    K Offline
                                    kimot
                                    wrote on last edited by
                                    #17

                                    I think, all this is not Domoticz problem, but mysensors problem.
                                    Mysensors gateways has not got any universal input interface.
                                    This is, why I am not using pure mysensors solution.
                                    Imagine, that your gateway understood something like this:

                                    http://MS_GATEWAY/cmd?node=10&sensor=1&value=80

                                    And translate it to mysensors network message, which sends value 80 to sensor number 1 of node number 10.
                                    Then you can send into your node everything not only from Domoticz, but from simply Android application and etc.
                                    With ESP8266 gateway you need only "ESP8266HTTPClient" library to parse this http call for example.

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

                                      If the node requests the TEXT to domoticz, it gets the value, so domoticz can actually handle it, the problem is that it does not send the TEXT value if something changes the variable but only if the node requests it.

                                      K 1 Reply Last reply
                                      0
                                      • K kimot

                                        I think, all this is not Domoticz problem, but mysensors problem.
                                        Mysensors gateways has not got any universal input interface.
                                        This is, why I am not using pure mysensors solution.
                                        Imagine, that your gateway understood something like this:

                                        http://MS_GATEWAY/cmd?node=10&sensor=1&value=80

                                        And translate it to mysensors network message, which sends value 80 to sensor number 1 of node number 10.
                                        Then you can send into your node everything not only from Domoticz, but from simply Android application and etc.
                                        With ESP8266 gateway you need only "ESP8266HTTPClient" library to parse this http call for example.

                                        monteM Offline
                                        monteM Offline
                                        monte
                                        wrote on last edited by
                                        #19

                                        @kimot then it would be a controller itself, not a gateway. You need gateway anyway (sick rhyme), or you would need to use only powerful enough hardware to implement web server to handle requests as you suggest. But it wouldn't be backward compatible with arduino gateways, thus it's not the way for now, maybe in the future we will come to it.

                                        K 1 Reply Last reply
                                        0
                                        • gohanG gohan

                                          If the node requests the TEXT to domoticz, it gets the value, so domoticz can actually handle it, the problem is that it does not send the TEXT value if something changes the variable but only if the node requests it.

                                          K Offline
                                          K Offline
                                          kimot
                                          wrote on last edited by
                                          #20

                                          @gohan
                                          But this is what I wrote.
                                          If anything changes in Domoticz ( not only TEXT value, but anything ), Domoticz sends http call into gateway and thats all.
                                          For example - you changed setpoint in Domoticz and it seds it immediately into mysensors gateway.

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


                                          22

                                          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