EspEasy MQTT

Hi all looking for some help, i have set up esp with espeasy and have it linked up so one of the GPIO pins can monitor weather there is power or not basically like a switch however i wont need to control this as a switch i just need the state of the GPIO pin / switch. my problem is i cant get Openhab to see what state the switch is in over MQTT. espeasy looks to have linked the my broker and is sending the information but nothings happening in openhab. i am use code that i have used for my sonoff switch and am not sure if that what i am doing wrong.

this is the log from openhab

2018-03-11 12:33:38.767 [WARN ] [] - given new state is NULL, couldn't post update for 'F2_Fire_1'

this is the code am using in my items

Switch   F2_Fire_1          "Alarm"            <light>         (F2_Fire, gLight)            { mqtt=">[mqttoh2: { mqtt=">[mqttoh2:cmnd/Alarm/fire/fire:command:*:default],
            <[mqttoh2:stat/Alarm/fire/fire:state:default]" }

this is the log from espeasy

799910 : MQTT : Topic: /Alarm/fire/fire
799910 : MQTT : Payload: 0

am not sure if i need to add rules in to the espeasy but any help would be amazing

Hi Chris,

I’m also using ESPEasy with mqtt to transmit data from an esp8266 node (wemos-1) to openHAB. Here the declaration of the items:

Number TmpBuro  "Temp. Buro [%.2f °C]"    <temperature> (gDatalog) { mqtt="<[home:/wemos-1/SHT-30/Temperature:state:REGEX((.*?))]" }

Number HumBuro  "Humi. Buro [%.2f °C]"    <humidity>    (gDatalog) { mqtt="<[home:/wemos-1/SHT-30/Humidity:state:REGEX((.*?))]" }

What looks strange in your item is that you have twice the declaration { mqtt=>"[mqttoh2: have you tried with:

Switch   F2_Fire_1          "Alarm"            <light>         (F2_Fire, gLight)  { mqtt=">[mqttoh2:cmnd/Alarm/fire/fire:command:*:default], <[mqttoh2:stat/Alarm/fire/fire:state:default]" }

In my example the first parameter is the node name and the declaration how to format the string sent in mqtt can be found in the ESPEasy under menu Tools/Advanced:


I hope this example can help.

hello thank you for your reply, have tried what you have said and still no luck. am not sure if its the way ESPeasy is sending 1 and 0 as values instead of ON and OFF.

the problem i have is i am using the above declaration but i do not think am using it in the right way. i want this to be more of a sensor then a switch and just let me know if there is power going to the connected GPIO pin on the wemos.

thanks for you help

Hi Chris,

using the MAP transformation service you can map the 0 to OFF and 1 to ON as describe in

In my example you would replace the REGEX(…) with MAP(