Last active
December 10, 2016 07:57
-
-
Save hollie/631b7351532210fced976f358cb1ff38 to your computer and use it in GitHub Desktop.
Example code for MisterHouse: react to xPL-enabled motion detector
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# In items.mht: | |
# XPL_SENSOR, hollie-jeenodes.nessie:room31, motion_berging, Berging, motion | |
# in user code | |
if ($motion_berging->state_changed()) { | |
my $state = $motion_berging->state(); | |
if ($plafond_berging->get_set_by() =~ /^web/ && $plafond_berging->state() ne 'off') { | |
# Was set on by web interface, don't react to motion detector right now to allow forcing the light to steady 'on' via web interface | |
} else { | |
if ($state eq 'on') { | |
$plafond_berging->bri(100); | |
} else { | |
$plafond_berging->set('off'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment