As I’m renting out part of my house, it’s important for me to know if anyone tries to tamper with the smoke-alarms. Fibaro smoke sensor has a tamper-switch, but it doesn’t look like Telldus Live supports an event for the tamper yet – or I don’t know how to.
So my goal was to try writing a LUA-script for the first time, and this is the result:
-- File: SmokeSensor.lua -- Define the names on your devices here: local smokesensor = "SmokeSensorTest" local deviceManager = require "telldus.DeviceManager" function onZwaveMessageReceived(device, flags, cmdClass, cmd, data) if device:name() ~= smokesensor then return end if (cmd == 5 and cmdClass == 113) then if list.len(data) < 7 then return end -- data is the notification type -- data is the status. -- Notification type 7 is "Home Security" -- Status for notification type 7: -- 0: Event inactive -- 3: Tampering, Product covering removed local notification_type = data local status = data -- print("Device: %s", smokesensor) print("Device: %s. Flags: %s. cmdClass: %s. cmd: %s. Data: %s", device, flags, cmdClass, cmd, data) print("Notification type: %s. Status: %s", notification_type, status) if (notification_type == 7) then if (status == 0) then print("Event inactive") elseif (status == 3) then print("Tampering, Product covering removed") end end end end
I don’t have any documentation for the data-parameters, so I’m not sure how stable this script is yet. Please see this forum thread for any updates: http://forum.telldus.com/viewtopic.php?f=16&t=6436. I’ll try to update this article also, if I change anything.
I’m not sure how to report which smoke sensor has been tampered with. The only way I see right now, is to create a dummy device for each smoke sensor, and an event for each dummy device. Maybe I’ll split up my home i zones or apartment to prevent having to many devices and events. It would be great if Telldus would allow triggering event or URL directly from the LUA-script.