Home detection & Fibaro dimmer 2 button pressed

Moderator: leecollings

Post Reply
hansaplast31
Posts: 31
Joined: Sunday 03 January 2016 0:32
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Home detection & Fibaro dimmer 2 button pressed

Post 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?
User avatar
emme
Posts: 909
Joined: Monday 27 June 2016 11:02
Target OS: Raspberry Pi / ODroid
Domoticz version: latest
Location: Milano, Italy
Contact:

Re: Home detection & Fibaro dimmer 2 button pressed

Post 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.
The most dangerous phrase in any language is:
"We always done this way"
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest