Sensors: Fire Sensor MQTT OpenHAB ESP8266 Software
Fire Sensor MQTT OpenHAB ESP8266
Software:
ssh into your pi or whatever your server may be.
The first thing we are going to do is create the Fire Sensor item.
So type in sudo nano /etc/openhab2/items/home.items and press enter, you may need to type in admin password.
Then type in the comment //Fire Sensors then underneath that we are going to create the fire sensor item.
So type in String MKFireSensor1 "House [%s]" <fire> { mqtt="<[broker:MK-SmartHouse/utilities/MK-FireSensor1:state:default]" }
And press enter.
Now press control x then y and enter.
Next up is the sitemap file so we can see the status of the device.
Type in sudo nano /etc/openhab2/sitemaps/home.sitemap and press enter.
So go to the bottom underneath the “OutSide” closing bracket and type in
Frame label="Fire Detectors"
{
Text item=MKFireSensor1
}
and press enter,
Let's make it send a notification to the mobile devices when it detects a fire.
In ssh type in sudo nano /etc/openhab2/rules/home.rules and press enter.
At the bottom of the file type in
//Fire Detected In The House
rule "Fire Sensor"
when
Item MKFireSensor1 received update
then
if(MKFireSensor1.state == "FIRE DETECTED!")
{
sendBroadcastNotification("FIRE DETECTORS: HOUSE FIRE DETECTOR ACTIVATED")
}
end
Now press control x then y and enter.