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. Domoticz now supports the MySensors MQTT Gateway

Domoticz now supports the MySensors MQTT Gateway

Scheduled Pinned Locked Moved Domoticz
23 Posts 7 Posters 15.7k 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.
  • siklosiS Offline
    siklosiS Offline
    siklosi
    wrote on last edited by
    #7

    My biggest "problem" with domoticz and Mysensors setup is upgrading nodes. Right now procedure Im using is stopping gw in domoticz, running ser2net on rpi. On my desktop i strat Myscontroller and connect via tcp/ip to rpi/ser2net. After upgrading node i stop ser2net and start gw in domoticz. Is it possible to upgrade node with mqtt? That would remove need to stop gw in domoticz.

    J 1 Reply Last reply
    0
    • J jpaulin

      @MikeF
      Domoticz can now interpret the MySensors MQTT format from a MySensors MQTT Client Gateway without JSON stuff, it's straight forward. To make it work just change the Topic Prefix in the MySensors Gateway and the rest is solved under the hood. Auto discovery etc works now as any other MySensors Gateway with Domoticz.

      Change in your MQTT GW setup:

      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "mygateway1-out"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "mygateway1-in"
      

      To:

      #define MY_MQTT_PUBLISH_TOPIC_PREFIX "domoticz/in/MyMQTT"
      #define MY_MQTT_SUBSCRIBE_TOPIC_PREFIX "domoticz/out/MyMQTT"
      

      The MQTT Publish and Subscribe topic prefixes are hardcoded in Domoticz.
      And of course an MQTT broker is needed.

      M Offline
      M Offline
      MikeF
      wrote on last edited by
      #8

      @jpaulin said:

      @MikeF
      Domoticz can now interpret the MySensors MQTT format from a MySensors MQTT Client Gateway without JSON stuff, it's straight forward. To make it work just change the Topic Prefix in the MySensors Gateway and the rest is solved under the hood. Auto discovery etc works now as any other MySensors Gateway with Domoticz.

      Thanks for this, @jpaulin - I'll build an MQTT / ethernet gateway and see how I get on.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        MikeF
        wrote on last edited by MikeF
        #9
        This post is deleted!
        1 Reply Last reply
        0
        • M Offline
          M Offline
          MikeF
          wrote on last edited by
          #10
          This post is deleted!
          1 Reply Last reply
          0
          • M Offline
            M Offline
            MikeF
            wrote on last edited by
            #11

            Got this working OK. I built a MQTT / W5100 gateway as per the instructions in the MySensors Build section, and changed the topic prefixes and controller IP address in the example sketch.

            Initially this failed, as I had connected Vcc on the W5100 to 5V instead of 3.3V, and I had the prefixes the wrong way round (i.e., /out instead of /in).

            (BTW: I'm using MySensors 2.1.0 and Domoticz 3.6371 - latest / recent beta.)

            J 1 Reply Last reply
            1
            • siklosiS siklosi

              My biggest "problem" with domoticz and Mysensors setup is upgrading nodes. Right now procedure Im using is stopping gw in domoticz, running ser2net on rpi. On my desktop i strat Myscontroller and connect via tcp/ip to rpi/ser2net. After upgrading node i stop ser2net and start gw in domoticz. Is it possible to upgrade node with mqtt? That would remove need to stop gw in domoticz.

              J Offline
              J Offline
              jpaulin
              wrote on last edited by
              #12

              @siklosi
              mqtt wouldn't do the job to upgrade your nodes or gw. One alternative I'm using. I have some ESP8266-01 mqtt gw working with ota, with sensors wired directly to the gw and put in places hard to reach. They are upgraded over the air directly from the Arduino IDE over WIFI. Following this example explains how. https://github.com/mysensors/MySensors/tree/master/examples/GatewayESP8266OTA

              1 Reply Last reply
              0
              • M MikeF

                Got this working OK. I built a MQTT / W5100 gateway as per the instructions in the MySensors Build section, and changed the topic prefixes and controller IP address in the example sketch.

                Initially this failed, as I had connected Vcc on the W5100 to 5V instead of 3.3V, and I had the prefixes the wrong way round (i.e., /out instead of /in).

                (BTW: I'm using MySensors 2.1.0 and Domoticz 3.6371 - latest / recent beta.)

                J Offline
                J Offline
                jpaulin
                wrote on last edited by
                #13

                @MikeF excelent you finally got it up and running. It's easy to get confused with in/out - topic format swapped between MySensors and Domoticz.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  MLs
                  wrote on last edited by MLs
                  #14

                  Hey, I've been trying for a few weeks now to get Domoticz to talk to MQTT GW. Without success. It connects to the RPI 2 B directly. If you look in the log for mosquitto it will connect there. Sometimes I get socket error and disconnects. But no connection to Domoticz.

                  What are I doing wrong? Have reinstalled the software at RPI 2 B many times without any difference.

                  Log mosquitto

                  Insert Code Here
                  ```1484960555: New connection from 192.168.0.178 on port 1883.
                  1484960555: New client connected from 192.168.0.178 as mysensors-1 (c1, k15).
                  1484960921: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484961568: Client mysensors-1 has exceeded timeout, disconnecting.
                  1484961568: Socket error on client mysensors-1, disconnecting.
                  1484962722: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484964523: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484966324: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484968125: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484969926: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484971727: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484973528: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484975329: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484977130: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484978931: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484980732: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484982533: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484984334: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484986135: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484987936: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484989737: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                  1484990881: New connection from 192.168.0.178 on port 1883.
                  1484990881: New client connected from 192.168.0.178 as mysensors-1 (c1, k15).
                  1484990917: Socket error on client mysensors-1, disconnecting.
                  

                  And W5100 GW log

                  Insert Code Here
                  0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.0
                  0;255;3;0;9;TSM:INIT
                  0;255;3;0;9;TSF:WUR:MS=0
                  0;255;3;0;9;TSM:INIT:TSP OK
                  0;255;3;0;9;TSM:INIT:GW MODE
                  0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
                  0;255;3;0;9;MCO:REG:NOT NEEDED
                  IP: 192.168.0.178
                  0;255;3;0;9;MCO:BGN:STP
                  0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
                  IP: 192.168.0.178
                  0;255;3;0;9;Attempting MQTT connection...
                  0;255;3;0;9;MQTT connected
                  0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/0/255/0/0/18
                  0;255;3;0;9;TSF:MSG:READ,21-21-0,s=1,c=1,t=0,pt=7,l=5,sg=0:14.0
                  0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/21/1/1/0/0
                  0;255;3;0;9;TSF:MSG:READ,21-21-0,s=0,c=1,t=1,pt=7,l=5,sg=0:40.0
                  0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/21/0/1/0/1
                  
                  And Domoticz Log
                  
                  

                  Domoticz Log

                  2017-01-21 09:38:08.641 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 09:47:34.718 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 09:49:40.736 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 09:59:06.819 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:01:12.836 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:10:39.914 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:12:45.932 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:22:12.010 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:24:18.028 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:33:44.106 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:35:50.124 (MySensors Lan) Temp + Humidity (TempHumSrum)
                  2017-01-21 10:41:40.606 MQTT: Connecting to 192.168.0.178:1883
                  2017-01-21 10:43:47.836 Error: MQTT: Failed to start, return code: 14 (Check IP/Port)```
                  

                  //Mattias

                  J 1 Reply Last reply
                  0
                  • M MLs

                    Hey, I've been trying for a few weeks now to get Domoticz to talk to MQTT GW. Without success. It connects to the RPI 2 B directly. If you look in the log for mosquitto it will connect there. Sometimes I get socket error and disconnects. But no connection to Domoticz.

                    What are I doing wrong? Have reinstalled the software at RPI 2 B many times without any difference.

                    Log mosquitto

                    Insert Code Here
                    ```1484960555: New connection from 192.168.0.178 on port 1883.
                    1484960555: New client connected from 192.168.0.178 as mysensors-1 (c1, k15).
                    1484960921: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484961568: Client mysensors-1 has exceeded timeout, disconnecting.
                    1484961568: Socket error on client mysensors-1, disconnecting.
                    1484962722: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484964523: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484966324: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484968125: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484969926: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484971727: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484973528: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484975329: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484977130: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484978931: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484980732: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484982533: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484984334: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484986135: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484987936: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484989737: Saving in-memory database to /var/lib/mosquitto/mosquitto.db.
                    1484990881: New connection from 192.168.0.178 on port 1883.
                    1484990881: New client connected from 192.168.0.178 as mysensors-1 (c1, k15).
                    1484990917: Socket error on client mysensors-1, disconnecting.
                    

                    And W5100 GW log

                    Insert Code Here
                    0;255;3;0;9;MCO:BGN:INIT GW,CP=RNNGA--,VER=2.1.0
                    0;255;3;0;9;TSM:INIT
                    0;255;3;0;9;TSF:WUR:MS=0
                    0;255;3;0;9;TSM:INIT:TSP OK
                    0;255;3;0;9;TSM:INIT:GW MODE
                    0;255;3;0;9;TSM:READY:ID=0,PAR=0,DIS=0
                    0;255;3;0;9;MCO:REG:NOT NEEDED
                    IP: 192.168.0.178
                    0;255;3;0;9;MCO:BGN:STP
                    0;255;3;0;9;MCO:BGN:INIT OK,TSP=1
                    IP: 192.168.0.178
                    0;255;3;0;9;Attempting MQTT connection...
                    0;255;3;0;9;MQTT connected
                    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/0/255/0/0/18
                    0;255;3;0;9;TSF:MSG:READ,21-21-0,s=1,c=1,t=0,pt=7,l=5,sg=0:14.0
                    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/21/1/1/0/0
                    0;255;3;0;9;TSF:MSG:READ,21-21-0,s=0,c=1,t=1,pt=7,l=5,sg=0:40.0
                    0;255;3;0;9;Sending message on topic: domoticz/in/MyMQTT/21/0/1/0/1
                    
                    And Domoticz Log
                    
                    

                    Domoticz Log

                    2017-01-21 09:38:08.641 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 09:47:34.718 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 09:49:40.736 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 09:59:06.819 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:01:12.836 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:10:39.914 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:12:45.932 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:22:12.010 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:24:18.028 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:33:44.106 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:35:50.124 (MySensors Lan) Temp + Humidity (TempHumSrum)
                    2017-01-21 10:41:40.606 MQTT: Connecting to 192.168.0.178:1883
                    2017-01-21 10:43:47.836 Error: MQTT: Failed to start, return code: 14 (Check IP/Port)```
                    

                    //Mattias

                    J Offline
                    J Offline
                    jpaulin
                    wrote on last edited by jpaulin
                    #15

                    @MLs In your Domoticz log I see messages with the format "MySensors Lan". Have you chosen correctly the new MySensors MQTT Type in Domoticz? You should see "MySensorsMQTT" messages in the log. This new hardware choice is only available through the new Domoticz Beta version, for the moment.

                    Hardware setup screen:
                    0_1485095777911_Domoticz Setup.png

                    Select "MySensors gateway with MQTT interface." Add the Mosquitto IP address and Port address 1883. It is recommended to first clear the cache in your web browser. Otherwise the screen in your browser sometimes fails to show the new fields correctly.

                    I would as well recommend to install an MQTT debugging software. Personally I'm using MQTT-Spy. It's a java application, easy to install on e.g. a PC, connected to the same WiFi network, to listen to your MQTT traffic remotely what's going through your Mosquitto broker in your RPI. Then there's no need to connect to the nodes, gateways or RPI when checking the mqtt events.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      MLs
                      wrote on last edited by MLs
                      #16

                      Yes, i have lan to because I have several GW.

                      0_1485098286725_Domoticz_Hardware.png

                      And I turn them off when I do not try to solve the problem to reduce the log in Domoticz.
                      I'll try a MQTT debugging software.

                      But I think my problem lies in the software at RPI 2 B. Thus, communication between MQTT and Domoticz.

                      //Mattias

                      J 1 Reply Last reply
                      0
                      • M MLs

                        Yes, i have lan to because I have several GW.

                        0_1485098286725_Domoticz_Hardware.png

                        And I turn them off when I do not try to solve the problem to reduce the log in Domoticz.
                        I'll try a MQTT debugging software.

                        But I think my problem lies in the software at RPI 2 B. Thus, communication between MQTT and Domoticz.

                        //Mattias

                        J Offline
                        J Offline
                        jpaulin
                        wrote on last edited by
                        #17

                        @MLs Check this thread from the Domoticz forum about Mosquitto issues with return code 14 (seen in your log).
                        https://www.domoticz.com/forum/viewtopic.php?t=14263

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          MLs
                          wrote on last edited by
                          #18

                          Thanks for the link but has already read it and also other pages with solutions to problems regarding MQTT.
                          Now I will not use MQTT but still want to identify the problem I have.

                          //Mattias

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

                            I'm running mysensors mqtt gateway on rpi3, it is publishing to the topic specified in the domoticz configuration guide, I can see the messages being published in mqtt but nothing is showing up in domoticz; looking at the log I can only see the controller connecting without errors ; if I publish data to a dummy sensor as described in the guide it works, so there must be something wrong in the processing of the mysensors messages. Any ideas where to look?

                            T 1 Reply Last reply
                            0
                            • gohanG gohan

                              I'm running mysensors mqtt gateway on rpi3, it is publishing to the topic specified in the domoticz configuration guide, I can see the messages being published in mqtt but nothing is showing up in domoticz; looking at the log I can only see the controller connecting without errors ; if I publish data to a dummy sensor as described in the guide it works, so there must be something wrong in the processing of the mysensors messages. Any ideas where to look?

                              T Offline
                              T Offline
                              Toyman
                              wrote on last edited by Toyman
                              #20

                              @gohan
                              Unlike ordinary MQTT gateway that deals with messages to/from all devices, Mysensors MQTT Gateway will only publish messages to the sensors created VIA itself. So, just creating a dummy sensor in Domoticz will not work.
                              You have to create a virtual node by publishing to domotinz/in/MyMQTT
                              For example (based on Serial API example): domoticz/in/MyMQTT/12/6/0/0/3/"My Light"

                              "MyLight" is a payload

                              This will create a virtual node #12, child #6. Create a switch based on the node.

                              THEN you can monitor the node, by monitoring domoticz/out/MyMQTT/12/6/1/0/2/

                              it will publish "1" or "0"

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

                                I am trying to follow the guide -> https://www.domoticz.com/wiki/MySensors#Configuring_Domoticz_to_use_the_MQTT-gateway but actually I am now noticing that is missing the device type "MySensors Gateway with MQTT interface" and in fact I mistakenly added the normal MQTT Client gateway.... I wonder why it has been removed...

                                T 1 Reply Last reply
                                0
                                • gohanG gohan

                                  I am trying to follow the guide -> https://www.domoticz.com/wiki/MySensors#Configuring_Domoticz_to_use_the_MQTT-gateway but actually I am now noticing that is missing the device type "MySensors Gateway with MQTT interface" and in fact I mistakenly added the normal MQTT Client gateway.... I wonder why it has been removed...

                                  T Offline
                                  T Offline
                                  Toyman
                                  wrote on last edited by
                                  #22

                                  @gohan the guide was created long time ago, while Mysensors MQTT gateway was added in December

                                  gohanG 1 Reply Last reply
                                  0
                                  • T Toyman

                                    @gohan the guide was created long time ago, while Mysensors MQTT gateway was added in December

                                    gohanG Offline
                                    gohanG Offline
                                    gohan
                                    Mod
                                    wrote on last edited by gohan
                                    #23

                                    @Toyman
                                    The page has been modified on 3 December 2016, it isn't that obsolete

                                    PS I found it, I had to manually update to beta version. I'll test it in the following days

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


                                    11

                                    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