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. General Discussion
  3. WiFi gateway, MQTT, openhab

WiFi gateway, MQTT, openhab

Scheduled Pinned Locked Moved General Discussion
10 Posts 5 Posters 4.2k Views 3 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.
  • M Offline
    M Offline
    moskovskiy82
    wrote on last edited by
    #1

    I have finished building a wifi gateway as instructed. Now facing a simple problem as it seems a small lack of documentation is in there.

    Sensors transmit data via nrf24 to the wifi gateway. Which than encapsulates it into some tcp-ip and sends it straight to the network?
    So to make this work with openhab i need some intermidiate translator which will receive the data and transfer it into MQTT which openhab can understand?

    Can this translator be installed onto the same system as openhab? Any plans onto bringing MQTT into the wifi esp code?

    1 Reply Last reply
    0
    • dakkyD Offline
      dakkyD Offline
      dakky
      wrote on last edited by
      #2

      http://www.mysensors.org/controller/openhab

      OpenHab support only Serial GW or mqtt. So this leaves you to 3 options:

      1. Use the serial GW: connect your arduino GW directly to yout openhab host (raspi?)
      2. Use the Mqtt sketch: In this setup the arduino serves as mqtt broker
      3. Use the mqtt CLIENT sketch: IN this setup, your arduino acts as mqtt client and delivers message (sensors values and commands) to an external mqtt broker

      I personally prefer option 3:

      • easier to debug (read messages directly on the broker)
      • more flexible, u can send 3dparty messages to the broker (from scripts, hardware which supports mqtt etc) and deliver them to openhab

      Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
      Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

      Software: MySensors 2.0development

      1 Reply Last reply
      0
      • M Offline
        M Offline
        moskovskiy82
        wrote on last edited by
        #3

        Well 3 seems the way to go than..
        So all i need to do is compile (with options in the sketch changed) and upload the sketch to ESP8266?

        Sketch:
        https://github.com/mysensors/Arduino/blob/development/libraries/MySensors/examples/GatewayESP8266MQTTClient/GatewayESP8266MQTTClient.ino

        1 Reply Last reply
        0
        • dakkyD Offline
          dakkyD Offline
          dakky
          wrote on last edited by dakky
          #4

          I did not use wlan module (see my signature), but should be the same + wlan settings.
          And, of course, setup an external mqtt broker. I used mosquitto, simple apt-get get foo on the openhab host.

          @hek posted a howto:
          http://forum.mysensors.org/topic/2352/guide-setting-up-and-testing-mqtt-client-gateway

          Controller: Raspberry Pi 2 :: Openhab2 :: with @TimO MySensors Binding
          Gateway: Arduino MEGA 2560 R3 :: W5100 :: Ethernet GW

          Software: MySensors 2.0development

          1 Reply Last reply
          0
          • M Offline
            M Offline
            moskovskiy82
            wrote on last edited by
            #5

            Well the 3rd otion compiled just nicely. The only problem is that as an MQTT client - the gateway doesn't assign any Node ID.

            I think this can be overcome by hardcoding the ID's for every sensor.

            I wonder if we will see some mysensors binding in openhab or a proper MQTT+ESP gateway with NODE ID assignment in the near future

            KukulinK 1 Reply Last reply
            0
            • M moskovskiy82

              Well the 3rd otion compiled just nicely. The only problem is that as an MQTT client - the gateway doesn't assign any Node ID.

              I think this can be overcome by hardcoding the ID's for every sensor.

              I wonder if we will see some mysensors binding in openhab or a proper MQTT+ESP gateway with NODE ID assignment in the near future

              KukulinK Offline
              KukulinK Offline
              Kukulin
              wrote on last edited by
              #6

              @moskovskiy82 said:
              The only problem is that as an MQTT client - the gateway doesn't assign any Node ID.

              I think this can be overcome by hardcoding the ID's for every sensor.

              Hi, is there any guide how to hardcode IDs for Node and sensors?
              My MQTT client gateway is talking to Mosquitto broker, my DHT sensor is talking to gateway but I never get correct data from sensor even if it measure and always send same information - see log from debug :

              Starting sensor (RNNNA-, 2.0.0-beta)
              Radio init successful.
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=fail:
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
              Init complete, id=255, parent=0, distance=1
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
              T: 28.30
              req id
              send: 255-255-0-0 s=255,c=3,t=3,pt=0,l=0,sg=0,st=ok:
              H: 80.70
              

              and same time log from MQTT gateway client:

              HHQA8~hl,|.i:p0;255;3;0;9;Starting gateway (RNNGE-, 2.0.0-beta)
              0;255;3;0;9;Radio init successful.
              scandone
              state: 0 -> 2 (b0)
              .state: 2 -> 3 (0)
              state: 3 -> 5 (10)
              add 0
              aid 8
              pm open phy_2,type:2 0 0
              cnt 
              ..
              connected with KAKV005, channel 2
              ip:192.168.1.210,mask:255.255.255.0,gw:192.168.1.1
              .IP: 192.168.1.210
              0;255;3;0;9;Init complete, id=0, parent=0, distance=0
              IP: 192.168.1.210
              0;255;3;0;9;Attempting MQTT connection...
              0;255;3;0;9;MQTT connected
              0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
              0;255;3;0;9;Sending message on topic: mg1-out/255/255/3/0/3
              0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
              0;255;3;0;9;Sending message on topic: mg1-out/255/255/3/0/3
              0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
              0;255;3;0;9;Sending message on topic: mg1-out/255/255/3/0/3
              0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
              0;255;3;0;9;Sending message on topic: mg1-out/255/255/3/0/3
              0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
              0;255;3;0;9;Sending message on topic: mg1-out/255/255/3/0/3
              0;255;3;0;9;read: 255-255-0 s=255,c=3,t=3,pt=0,l=0,sg=0:
              0;255;3;0;9;Sending message on topic: mg1-out/255/255/3/0/3
              
              
              1 Reply Last reply
              0
              • KukulinK Offline
                KukulinK Offline
                Kukulin
                wrote on last edited by
                #7

                Hi, it is fixed, I'm just blind. I did not see how to initialize mysensors in development branch example. I switched to master branch and can set gw.begin(NULL,nodeID);
                Can someone explain me how to do same for humidity sketch in development branch?
                Thanks

                DwaltD 1 Reply Last reply
                0
                • KukulinK Kukulin

                  Hi, it is fixed, I'm just blind. I did not see how to initialize mysensors in development branch example. I switched to master branch and can set gw.begin(NULL,nodeID);
                  Can someone explain me how to do same for humidity sketch in development branch?
                  Thanks

                  DwaltD Offline
                  DwaltD Offline
                  Dwalt
                  wrote on last edited by
                  #8

                  @Kukulin said:

                  Hi, it is fixed, I'm just blind. I did not see how to initialize mysensors in development branch example. I switched to master branch and can set gw.begin(NULL,nodeID);
                  Can someone explain me how to do same for humidity sketch in development branch?
                  Thanks

                  #define MY_NODE_ID xx

                  Veralite UI5 :: IBoard Ethernet GW :: MyS 1.5

                  1 Reply Last reply
                  0
                  • KukulinK Offline
                    KukulinK Offline
                    Kukulin
                    wrote on last edited by
                    #9

                    Thank you.

                    1 Reply Last reply
                    0
                    • kklickerK Offline
                      kklickerK Offline
                      kklicker
                      wrote on last edited by
                      #10

                      Hi. I know this topic is a few months old now, but I'm wondering if you were able to accomplish what you wanted to do. I have a wifi gateway set up and would like to do something similar but with Home Genie as the broker running on a Raspberry PI. Did you have to modify the MQTT Client code much to fit your needs? I'm new to MySensors, but I've been researching topics as much as possible before I dive into the code. Can you point me to the version of the client code that worked for you? I would appreciate any help or tips as I am eager to set up several sensors around the house and perhaps a relay to control a garage door. Thanks.

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


                      23

                      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