Am I setting up my Shelly1 and Embedded MQTT broker correctly?

mqtt
shelly
embedded-broker
Tags: #<Tag:0x00007f51e0604850> #<Tag:0x00007f51e06045d0> #<Tag:0x00007f51e06043a0>

(Jonatan Stridh) #1

I can’t seem to get things to work…
My goal is to be able to control my Shelly1 using Openhab.
I installed the Embedded broker, created a Thing using PaperUI and it says it’s Online.
I also installed the MQTT bindings and made a Generic MQTT Thing, linking the embedded broker and with a channel containing my shelly information:

MQTT state topic:
shellies/shelly1-XXXXXX/relay/0

MQTT command topic:
shellies/shelly1-XXXXXX/relay/0/command

Made a Item using textfile:

Switch  MyShellies_Shellyone    "Shelly One"    <light>     ["Lighting"]    {channel="mqtt:topic:MyShellies:shellyone"}

Now for my Shelly1 configuration:
I updated to the latest firmware: v1.4.8@e44d9e2c
Set the MQTT settings to:

Username: <blank>
Password: <blank>
Server: 127.0.0.1

and didn’t touch the rest.

I tried MQTT.fx on the same PC as the broker, connected it successfully to the broker and scanned for subscribed topics and saw the command line from my Item. (shellies/shelly1-XXXXXX/relay/0/command)

Nothing is happening to the Shelly1 device though…
I can’t connect to the broker from another PC using MQTT.fx either. But maybe I’m not suppose to?

Can someone please tell me what I’m doing wrong?

(Openhab 2.4.0 is installed on a Win 10 laptop)


(Jürgen Baginski) #2

If both PCs are on the same LAN, you should be able to connect MQTTfx to the broker (the ip to set for the broker connection in MQTTfx is NOT localhost then!!!)

You reported to " saw the command line from my Item. (shellies/shelly1-XXXXXX/relay/0/command)". Then you should be able to post a command to the shelly from MQTTfx, that way you can check if the command you afre using is correct and that the shelly is working on it. If you have that try to set this command onto the channel.

As for the setup of openhab for MQTT. Having any MQTT broker running (embedded or other), you need a MQTT Broker Thing in order to connect to the broker AND Generic MQTT Things, which will represent the Shelly.