Page 1 of 1

Home detection & Fibaro dimmer 2 button pressed

Posted: Tuesday 16 January 2018 9:40
by hansaplast31
Hi there,

I would like to build a (sophisticated) Lua script that detects if somebody is at home. I am already tracking the mobile phones via location services, but I also would like to use my fibaro dimmer 2 (z-wave) to detect if somebody is home. For that I need to know if the light is switched on or off, whether it was done by some kind of trigger (from Domoticz) or if somebody just pressed the switch connected to dimmer.
so basically what I want to do a check after finding testing devicechanged['dimmer x']. how would this be achievable?

Re: Home detection & Fibaro dimmer 2 button pressed

Posted: Tuesday 16 January 2018 9:48
by emme
I was looking fot solution like yours, but could not find any way to achieve it...
ZWave does not provide the origin of the issued command (byNetwork or byDevice), so the only way I could find is a user variable that must be updated by any script that actually uses that device

if you trigger the device by script you update the variable
if you trigger the device locally or by app (click on device) you won't
anytime you trigger the device you should run a script to check the timedifference between local time and variable lastupdate
if less than 1sec it means it has been triggered by script, if over 1sec than most probably it was a local activation.