Help with OpenHab, EspEasy Mqtt item

Hi, I’m a NOOB with this and can’t figure out what I’m doing wrong.
OpenHabian2 and MQTT on RPi 3, a Sonoff with ESPeasy.

In items:
Switch Sonoff1 {mqtt=">[mymosquitto:/Sonoff_1/gpio/12:command:ON:1],>[mymosquitto:/Sonoff_1/gpio/12:command:OFF:0]"}
will let me turn on and off the Sonoff in OpenHab.

But if I set up the ESPeasy as follows:

and the item as:
Switch Sonoff1 {mqtt=">[mymosquitto:/Sonoff_1/SonoffSwitch/Command:command:ON:1],>[mymosquitto:/Sonoff_1/SonoffSwitch/Command:command:OFF:0]”}

I can’t turn the Sonoff On or Off.
I have the same issue with a NodeMCU (ESPeasy) and a LED, so I must be doing something wrong, but I just don’t see it.
Any help appreciated.

I had the same problem and sticked with the gpio command. I think it’s more a question for the espeasy forum, than openhab.

You might be right. When I look at MQTT Spy, it shows MQTT receives it. Just looks like ESPeasy doesn’t do anything with it. If anyone with OpenHab has previous experiences with this (other than mrwee :slight_smile: ) let me know.
Will post at ESPeasy forum 2morrow. Cheers.

Just FYI.
The ESPeasy is setup for “MQTT-OpenHab” and my MQTT ipaddress.
Now still at work, so unable to post a picture of it, sorry.

You can also install the ‘MQTT import’ plugin on espeasy, then it can subscribe to different subjects.

ON:1.00 and

Thanks for the info. Tried the 1.00 and 0.00, but no go.
Will continue to search for a solution. And still need to post on ESPeasy (work got in the way of hobby :cry:)

FYI. Have now posted on ESPeasy forum.

I received the following reply at the ESPaesy Forum:

*Take a look at the command reference:

GPIO (pinnumber),(value) is a command,
(devicename) (valuename),(value) is not - it is a sensor which sends its value back to the broker.

If you want to use something less cryptic in Openhab then wrap the gpio command in a rule and call that via mttq. :wink: "

Still digesting the answer… being a Newbie… :slight_smile:

This is my working configuration:

Switch	SSR "SSR on nodeMCU (ESP Easy mqtt)" <poweroutlet> { mqtt=">[broker:esp1/gpio/2:command:ON:0], >[broker:esp1/gpio/2:command:OFF:1]" }

On ESP Easy I have Pin mode 2 (D4): Output High because of the type of the SSR I’m using.
You don’t need to configure “Device”.
As I can see you’re controlling output from OH, but on ESP Easy you have an input.

This is what I got to work for a Sonoff basic. There is actually two parts to it. First is sending the command from OpenHAB to the Sonoff. Second half gets the updates of the switches status and updates the switch display in OpenHAB . This way if the Sonoff’s button is pressed to turn on/off the relay, OpenHAB will show the correct state.

Switch mySwitch01 "Desk Light" (gMH_Office) {mqtt=">[mosquitto:/so_switch01/gpio/12:command:ON:1],>[mosquitto:/so_switch01/gpio/12:command:OFF:0],<[mosquitto:/so_switch01/lightState/Switch:command:OFF:0],<[mosquitto:/so_switch01/lightState/Switch:command:ON:1]"}

1 Like

Thanks Frank_Wolfe

It works :slight_smile:



I try to build a basic project using espeasy + RPI3 with openhabian 2,1 and mosquito. everything is going fine but relay not working, I can turn on and off relay using espeasy commands using web browser all screens shots are attache can some one tell me where i am wrong.

additionally i want to add timer on this relay with save the relay state during power failure

esp easy mega controller settings

esp easy mega jog settings

@sny2ksa please read my earlier post

Thanks a lot andrew.