0

Fibaro Smoke Sensor in Practice – How to code your smoke alarm

by boomx6. April 2016

On-road-test?  What does that mean, will you learn in the following article …

Let´s go straight to business. Once I sat on my couch and asked my son about his supper. His short, but also precise answer was „ a bread roll, like yesterday“. Great, what I managed to do yesterday, would be as easy today. At least that was what I thought.  So I went to the kitchen, emptied the microwave, put the bread roll in and started it. Then I went back to the living-room and my child … the microwave will call me, when the bread roll is ready to eat.

The real life test of smoke sensor – definitely passed it!

Surprisingly, this time not only the microwave called me, when the timer was finished. In the same moment, also the Fibaro smoke sensor in the hallway was activated. At first I did not spend a lot of thoughts on it, maybe my first false alarm. But as soon as i opened the room door and mentioned the stench, I instantly knew that this was not a false alarm.

the problem

The offender has apparently not survived

The whole hallway was filled with smoke and my sprint ended almost in the door frame, because I was not able to see as far as an arm´s length. But I made it to the microwave and realized that luckily no fire broke out. In the meantime the alarm sound did not stand back to my child´s crying. Therefore a notorious, nerved sound of 90dB filled the flat. Not so nice. As this was not enough, my neighbours seemed to notice something. Anyway, my door bell was activated moments later. The mystery, if the unusual sound or the inconvinient smell led their way, will stay unsolved forever. The following question, if everything is okay, should became redundant in the moment I rashly opened the door, followed by a huge cloud of smoke.

To get rid of the smoke, I teared up all windows in the flat. The negative point by doing that, was the circulation of smoke in every other room, caused by the wind.  Immediately every smoke sensor in almost every other room was activated and started to ring.

sm_last_breach

Smoke alarm triggered last 5 days ago

The LUA-Script

The reason I told you this story is obvious. Even the smallest mistake in usage of some devices, like microwaves, can cause a fire. In my case I forgot to activate the hot-air function, so the bread roll was grilled by 1000 watt. But let the funny described accident behind us and talk about the serious issue of fire/smoke detection. This incident was my motivation to finally finish the smoke sensor script, which should allow me to activate a centrally placed siren and to send a push notification, with

The script will be triggered via a change of the smoke sensor´s status. That means, the script will be activated, when for example the smoke sensor with ID 102 detects smoke and changes the content of getValue from 0 to 1. To embed all of your smoke sensor in this scene, you have to register all specific ID´s in the first lines (line 1-9):

Next step is to register your smartphones and sirens ID. This happens in line 10 & 11:

It is not neccessary to change more within the script, but I want to explain the rest of the script anyway, in order to inform you about it´s functioning.
If a smoke sensor triggers the scene, the script works from top to bottom. The first automatically started task is:

This task detects the trigger, the smoke sensor which activated the scene. The next line

writes the ID of  the triggered device in the local variable „smokeID“. With the smokeID we can read the getValue of the smoke sensor, for security reasons. This happens with the following line:

The local variable „smoke“ is now filled with a value. This is either 0 or 1. In this case 0 means that no smoke was detected. Value 1 means detected smoke. This is again tested with help of an if-request in line 17:

If the scene was triggered, without a real smoke detection, the script will be stopped and ended with:

Should smoke be detected, getRoomNameByDeviceID(smokeID) identifies the room of the triggering device, starts the siren and send a push notification to a registered smartphone.

For security reasons, the siren will not be deactivated by this script. In my opinion, smoke alarms and therfore the siren should be deactivated manually.

icon fire alarm

icon

IMPORTANT: Test your script.

It is very important that you test the script, before you start to use it. It is not even neccessary to use a smoke sensor (also it is possible). The script works for example with a door/window sensor, too. Therefore you just need to register the door/window sensor`s ID. If then the sensor is opened, the scene will be activated.

If you have further, reasonable ideas, we happily await your comments.

About The Author
boomx
boomx

Leave a Response