-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpirthing1_on.php
More file actions
executable file
·30 lines (25 loc) · 1022 Bytes
/
pirthing1_on.php
File metadata and controls
executable file
·30 lines (25 loc) · 1022 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
# A simple, non-conditional script for PIRThing (https://github.com/kenkl/pirthing). PIRThing, based on
# MotionNightlight (https://github.com/kenkl/MotionNightlight), is an ESP8266 that has a PIR sensor and will call an on or
# off script here based on its logic/timings. Which unit(s) it affects are then expressed here, letting PIRThing control
# different lights with different behaviours without reflashing PIRThing itself.
include 'functions.php';
include 'pirthing1_vars.php';
if(!ison($tl1)) { #if it's already on, let's not do anything (conditional changes could be A Thing in else?)
if(activetime()) {
saveHueState($tl1); # Leave a marker that the light is turned on by PIRThing.
oneState('true',$tl1,64,0,254);
}
else {
echo "{$nowtime} - Do not.\n";
}
}
else {
# light is on. bail.
echo "light is on. no.\n";
}
# The bathroom nightlight thing.
oneState('true',10,1,0,254);
# AIO hook - track activation behaviour
setToggle("testtoggle", 1);
?>