Fire detection script by checking room temperatures

Moderator: leecollings

Post Reply
User avatar
psubiaco
Posts: 233
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

Fire detection script by checking room temperatures

Post by psubiaco »

Hi,
has anyone written a LUA script for Domoticz that checks room temperatures, and in case that a room temperature increases too fast, send a fire alarm by Telegram, Email, internal siren, ...?
Thanks.
Last edited by psubiaco on Monday 04 April 2022 11:55, edited 1 time in total.
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
User avatar
McMelloW
Posts: 434
Joined: Monday 20 November 2017 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.1
Location: Harderwijk, NL
Contact:

Re: Fire detection checking room temperatures

Post by McMelloW »

There is an example in the DzVents wiki. Very simple

Code: Select all

return
{
    on =
    {
        devices = {
            'myDetector',
            'roomTemp'
    }
},
    execute = function(domoticz, device)
        if ((device.name == 'myDetector' and device.active) or
            (device.name == 'roomTemp' and device.temperature >= 45)) then
            domoticz.notify('Fire', 'The room is on fire', domoticz.PRIORITY_EMERGENCY)
        end
    end
}
Greetings McMelloW
User avatar
psubiaco
Posts: 233
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

Re: Fire detection checking room temperatures

Post by psubiaco »

hmm, that's too basic example!

I've decided to write a new script that detects fire by checking the rooms temperature:
* read a configuration file with the list of room name, temperature sensor name, deltaT to trigger the alarm
* stores in a variable, json encoded, the list of average temperature for each room
* when in one or more rooms the Temperature > Average_temperature + deltaT => send notification by Telegram
* works with both simple temperature and temperature+humidity(+barometric) sensors.

You can find the fire detector scripts in https://github.com/CreasolTech/domoticz_lua_scripts : they have to be placed into Domoticz scripts/lua directory:

* script_time_fireAlarm.lua => lua script triggered every minute
* config_fireAlarm.lua => configuration file
* globalvariables.lua => another configuration file with telegram API information and something else
* globalfunctions.lua => some functions that are used from my scripts

I'm just checking the script now... if you have any suggestions, please let me know!
I hope this script can be helpful even for you!!
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
User avatar
psubiaco
Posts: 233
Joined: Monday 20 August 2018 9:38
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Italy
Contact:

Re: Fire detection checking room temperatures

Post by psubiaco »

I've updated the fire detection script again. You can download from github https://github.com/CreasolTech/domoticz_lua_scripts
Paolo
--
I use DomBus modules to charge EV car, get a full alarm system, control heat pump, fire alarm detection, lights and much more. Video
Facebook page - Youtube channel
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest