EspEasy with openhab and mqtt not working

Moderators: Voyager, BertB, rtenklooster, Stuntteam, grovkillen, TD-er

Post Reply
Message
Author
kevin9r
Normal user
Posts: 5
Joined: 11 Sep 2018, 08:30

EspEasy with openhab and mqtt not working

#1 Post by kevin9r » 11 Sep 2018, 08:37

Hello,
i try to connect my espeasy devices with openhab. The openhab is on a rpi.
I have install mosquitto and configured it already. I have set the configuration in the espeasy device. I can connect to the mqtt broker and i see the devices there if i make a subscribe over mqttfx.
Now i try to change a pin state first over mqttfx. I make a publish with this command:
/Strassenlicht/GPIO/13:command:ON:1

but it isn't working. On the Esp is the newest espeasy system installed. Over http i can change the gpio pin states. I think my mqtt command is wrong but i couldn't find other commands.

Thanks for your help!

User avatar
grovkillen
Normal user
Posts: 2256
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: EspEasy with openhab and mqtt not working

#2 Post by grovkillen » 11 Sep 2018, 10:20

Have you looked into the wiki section regarding commands?
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kevin9r
Normal user
Posts: 5
Joined: 11 Sep 2018, 08:30

Re: EspEasy with openhab and mqtt not working

#3 Post by kevin9r » 11 Sep 2018, 13:24

Hello,
thanks for your reply! Yes, the http command works fine. I had tried more mqtt commands. From the wiki i think correct is this:
/Strassenlicht/control?cmd=GPIO,13,1

But it doesn't work... Had tried this in mqttfx and this as a openhanded item:
Switch switch1 "Strassenlicht" { mqtt=">[jedyn:Strassenlicht/control?cmd=GPIO,12,1],
<[jedyn:Strassenlicht/control?cmd=GPIO,12,1]" }

nothing works... only http

User avatar
grovkillen
Normal user
Posts: 2256
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: EspEasy with openhab and mqtt not working

#4 Post by grovkillen » 11 Sep 2018, 13:39

I don't know what you're exact topics are that your controller settings is using but this is how you should do it:

topic

Code: Select all

Strassenlicht/cmd
message/payload

Code: Select all

GPIO,12,1
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kevin9r
Normal user
Posts: 5
Joined: 11 Sep 2018, 08:30

Re: EspEasy with openhab and mqtt not working

#5 Post by kevin9r » 11 Sep 2018, 13:44

So my mqtt command should be:
Strassenlicht/cmd GPIO,13,1?

This is not working. I had put my config in attachments and my try too
Attachments
15366662476172136408086338399049.jpg
15366662476172136408086338399049.jpg (4.38 MiB) Viewed 462 times
15366661171008988987924260772376.jpg
15366661171008988987924260772376.jpg (4.55 MiB) Viewed 462 times

User avatar
grovkillen
Normal user
Posts: 2256
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: EspEasy with openhab and mqtt not working

#6 Post by grovkillen » 11 Sep 2018, 13:50

I suggest you do screenshots instead of photos.

You have the following setting /%sysname%/# according to your picture. so the topic should then be:

Code: Select all

/Strassenlicht/cmd
Please observe that leading front slash!!

And the payload should then be:

Code: Select all

GPIO,12,1
Or whatever pin you want to control.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

kevin9r
Normal user
Posts: 5
Joined: 11 Sep 2018, 08:30

Re: EspEasy with openhab and mqtt not working

#7 Post by kevin9r » 11 Sep 2018, 17:13

/Strassenlicht/cmd GPIO,13,1 is not working and

/Strassenlicht/cmd/GPIO,13,1 isnt working too... :oops:

randytsuch
Normal user
Posts: 33
Joined: 05 Jun 2017, 05:32

Re: EspEasy with openhab and mqtt not working

#8 Post by randytsuch » 11 Sep 2018, 17:21

Format needs to be
topic: /ESP_EASY/cmd
payload: gpio,12,1

Its not clear from your screenshot what the topic is, and what the payload is.
MQTT messages always have a topic and a payload.

For gpio, you can also do this
topic: /ESP00/gpio/12
payload of 0 or 1

It will work, but not recommended, the first way works for any command, the 2nd only works for gpio.

BTW, you should really remove the first "/" from everything (esp side and openhab side), but as long as you are consistent, you have it both places or don't have it both places, it should work.

I also found a mqtt sniffer program to REALLY help figure out mqtt problems. It shows exactly what is being sent.

kevin9r
Normal user
Posts: 5
Joined: 11 Sep 2018, 08:30

Re: EspEasy with openhab and mqtt not working

#9 Post by kevin9r » 11 Sep 2018, 17:31

okay thanks for your information. I couldn't find much information at the internet and i had tried a lot of possibilities. Can you tell me where i find the information about the topic and the payload? Depent it on the mqttbroker? Or is it in the ESPEasy configuration?

User avatar
grovkillen
Normal user
Posts: 2256
Joined: 19 Jan 2017, 12:56
Location: Hudiksvall, Sweden
Contact:

Re: EspEasy with openhab and mqtt not working

#10 Post by grovkillen » 11 Sep 2018, 17:37

The topic and payload I suggested should work. Seems like how you're sending the info is the problem. Please use another MQTT client since the one you're using seems a bit vague on how to do things.
ESP Easy Flasher [flash tool and wifi setup at flash time]
ESP Easy Webdumper [easy screendumping of your units]
ESP Easy Netscan [find units]
Official shop: https://firstbyte.shop/
Sponsor ESP Easy, we need you :idea: :idea: :idea:

randytsuch
Normal user
Posts: 33
Joined: 05 Jun 2017, 05:32

Re: EspEasy with openhab and mqtt not working

#11 Post by randytsuch » 11 Sep 2018, 21:41

You really should get a mqtt sniffer
https://www.hivemq.com/blog/seven-best- ... ient-tools

It will take a few minutes to figure out how to setup and get it working, but it makes it SO much easier when you can actually see what's going on.

And you can use them to send stuff too.

I've used both mqtt.fx and mqttlens from the list above, and they both work fine for helping to debug mqtt problems.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest