i’m trying to make a smart fire sensor to send notifications if any fire detected . i built up my sensor using esp8266 module and burned the software image to it .
then i checked it using mqtt broker and it seemed to be working well as shown .
after that i tried to bind it with openhab but it doesn’t give me any response .
i think the problem is with my configuration files .
those are :
things file :
What is the topic that FIRE DETECTED! is published to? Your configuration suggests it should be stat/mofiresensor/POWER, but your MQTT.fx would suggest it is something else…
Your Thing definition is also slightly off. It should look something like
You probably want to keep an eye out for channel names being case sensitive, string / String. Really that’s a poor choice of name, it’ll only confuse things later.
Absolutely, from MQTT.fx it is apparent that your topic for the “FIRE DETECTED!” string is just mofiresensor, so for that topic to register it should be
stateTopic="mofiresensor"
not sure why you didn’t set the topic similar to the LWT topic in your ESP8266, e.g.
tele/mofiresensor/state
or something like that.
With “#” you subsribed to all topics in MQTT.fx, the top line at the bottom bit, which you circled - top circle line going through it, is the topic, the second line shows the subsription, 3rd line obviously date and time, what is in the black area below is the payload.
Then in your items it need to be lower case “string”, as @rossko57 points out
channel="mqtt:…:string"
Not typing it all, can’t even copy and paste from your pictures
Generally for this type of on/off, true/false sensor, it is better off to use a Switch rather than a String. I also happen to build a smoke sensor with ESP as well, using the MQ-2 sensor. Mine is a bit more complicated as it has to handle the ramping up until the sensor is stable, as well as the occasional high value spike (but no smoke). Here’s my MQTT file:
Type number : smokeValue "Bedroom3 Smoke"
[stateTopic="esp/bedroom3/smoke/value"]
Type switch : smokeState "Bedroom3 Smoke State"
[stateTopic="esp/bedroom3/smoke/state", on="1", off="0"]