diff --git a/DimmerBed/README.md b/DimmerBed/README.md new file mode 100644 index 0000000..598c7d6 --- /dev/null +++ b/DimmerBed/README.md @@ -0,0 +1,27 @@ +# Dimmer Switch Ruleset for Color Control + +This ruleset is a configuration that can change +color and temperature for a group of lights. +This may be the case in the bedroom. + +The on and off buttons work as expected. + +Pressing the on button longer toggles color and temperature mode. + +Pressing the brightness buttons change the brightness, +holding the brightness buttons change the color or temperature accordingly. + + +## Devices + +```sh +# IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/DIMMER/xxx/g; s/MEM/xxx/g" +``` + +Install the memory sensor and note its ID before proceding. +Use the `mem.sensor.json` file, replace the `BASENAME`, and POST it to the /api/KEY/sensors URL. + +* `BASENAME` Basename of the ruleset +* `GROUP` ID of the group to handle +* `DIMMER` ID of the dimmer switch +* `MEM` ID of the memory sensor diff --git a/DimmerBed/dn-hold-ct.rule.json b/DimmerBed/dn-hold-ct.rule.json new file mode 100644 index 0000000..18813d1 --- /dev/null +++ b/DimmerBed/dn-hold-ct.rule.json @@ -0,0 +1,29 @@ +{ + "name": "BASENAME.dn-hold-ct", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "gt", + "value": "0" + }, + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "3001" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "transitiontime": 1, + "ct_inc": 24 + } + } + ] +} diff --git a/DimmerBed/dn-hold-hue.rule.json b/DimmerBed/dn-hold-hue.rule.json new file mode 100644 index 0000000..599e531 --- /dev/null +++ b/DimmerBed/dn-hold-hue.rule.json @@ -0,0 +1,29 @@ +{ + "name": "BASENAME.dn-hold-hue", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "lt", + "value": "1" + }, + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "3001" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "transitiontime": 1, + "hue_inc": -10000 + } + } + ] +} diff --git a/DimmerBed/dn-short.rule.json b/DimmerBed/dn-short.rule.json new file mode 100644 index 0000000..b75fd9c --- /dev/null +++ b/DimmerBed/dn-short.rule.json @@ -0,0 +1,24 @@ +{ + "name": "BASENAME.dn-short", + "conditions": [ + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "3002" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "transitiontime": 1, + "bri_inc": -25 + } + } + ] +} diff --git a/DimmerBed/mem.sensor.json b/DimmerBed/mem.sensor.json new file mode 100644 index 0000000..a73e66e --- /dev/null +++ b/DimmerBed/mem.sensor.json @@ -0,0 +1,8 @@ +{ + "name": "BASENAME.mem", + "type": "CLIPGenericStatus", + "modelid": "MEM001", + "manufacturername": "Adrium", + "swversion": "1.0", + "uniqueid": "00:ad:10:f3:2a:9b-03" +} diff --git a/DimmerBed/off-short.rule.json b/DimmerBed/off-short.rule.json new file mode 100644 index 0000000..5cd9e3d --- /dev/null +++ b/DimmerBed/off-short.rule.json @@ -0,0 +1,23 @@ +{ + "name": "BASENAME.off-short", + "conditions": [ + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "4002" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "on": false + } + } + ] +} diff --git a/DimmerBed/on-long-ct.rule.json b/DimmerBed/on-long-ct.rule.json new file mode 100644 index 0000000..e7a0a81 --- /dev/null +++ b/DimmerBed/on-long-ct.rule.json @@ -0,0 +1,37 @@ +{ + "name": "BASENAME.on-long-ct", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "gt", + "value": "0" + }, + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "1003" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "bri": 203, + "hue": 60000, + "sat": 240 + } + }, + { + "address": "/sensors/MEM/state", + "method": "PUT", + "body": { + "status": 0 + } + } + ] +} diff --git a/DimmerBed/on-long-hue.rule.json b/DimmerBed/on-long-hue.rule.json new file mode 100644 index 0000000..23bbf3a --- /dev/null +++ b/DimmerBed/on-long-hue.rule.json @@ -0,0 +1,36 @@ +{ + "name": "BASENAME.on-long-hue", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "lt", + "value": "1" + }, + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "1003" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "bri": 203, + "ct": 357 + } + }, + { + "address": "/sensors/MEM/state", + "method": "PUT", + "body": { + "status": 1 + } + } + ] +} diff --git a/DimmerBed/on-short.rule.json b/DimmerBed/on-short.rule.json new file mode 100644 index 0000000..4b5fb77 --- /dev/null +++ b/DimmerBed/on-short.rule.json @@ -0,0 +1,23 @@ +{ + "name": "BASENAME.on-short", + "conditions": [ + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "1002" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "on": true + } + } + ] +} diff --git a/DimmerBed/up-hold-ct.rule.json b/DimmerBed/up-hold-ct.rule.json new file mode 100644 index 0000000..25f52da --- /dev/null +++ b/DimmerBed/up-hold-ct.rule.json @@ -0,0 +1,29 @@ +{ + "name": "BASENAME.up-hold-ct", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "gt", + "value": "0" + }, + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "2001" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "transitiontime": 1, + "ct_inc": -24 + } + } + ] +} diff --git a/DimmerBed/up-hold-hue.rule.json b/DimmerBed/up-hold-hue.rule.json new file mode 100644 index 0000000..42e0191 --- /dev/null +++ b/DimmerBed/up-hold-hue.rule.json @@ -0,0 +1,29 @@ +{ + "name": "BASENAME.up-hold-hue", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "lt", + "value": "1" + }, + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "2001" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "transitiontime": 1, + "hue_inc": 10000 + } + } + ] +} diff --git a/DimmerBed/up-short.rule.json b/DimmerBed/up-short.rule.json new file mode 100644 index 0000000..cf2908f --- /dev/null +++ b/DimmerBed/up-short.rule.json @@ -0,0 +1,24 @@ +{ + "name": "BASENAME.up-short", + "conditions": [ + { + "address": "/sensors/DIMMER/state/buttonevent", + "operator": "eq", + "value": "2002" + }, + { + "address": "/sensors/DIMMER/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "transitiontime": 1, + "bri_inc": 25 + } + } + ] +} diff --git a/DimmerLiving/README.md b/DimmerLiving/README.md index 8e82173..81e439c 100644 --- a/DimmerLiving/README.md +++ b/DimmerLiving/README.md @@ -1,13 +1,11 @@ # Dimmer Switch Ruleset for Two Light Groups This ruleset assumes two light groups inside the same room. +This may be the case in the living room. The on button first turns on one group and then the other. So does the off button in reverse order. -The lights are only switched on without changing -the previously configured state. - The lights can be reset to a bright but confortable mood for the evening when pressing the on button longer. diff --git a/DimmerLiving/mem.sensor.json b/DimmerLiving/mem.sensor.json index 71f3596..fff90e6 100644 --- a/DimmerLiving/mem.sensor.json +++ b/DimmerLiving/mem.sensor.json @@ -1,8 +1,8 @@ { "name": "BASENAME.mem", "type": "CLIPGenericStatus", - "modelid": "Adrium Memory", + "modelid": "MEM001", "manufacturername": "Adrium", "swversion": "1.0", - "uniqueid": "d0:ac:4e:d3:93:3b:7a:00-01" + "uniqueid": "00:ad:10:f3:2a:9b-01" } diff --git a/DimmerLiving/on-long.rule.json b/DimmerLiving/on-long.rule.json index 302695f..91ffdb0 100644 --- a/DimmerLiving/on-long.rule.json +++ b/DimmerLiving/on-long.rule.json @@ -4,7 +4,7 @@ { "address": "/sensors/DIMMER/state/buttonevent", "operator": "eq", - "value": "1001" + "value": "1003" }, { "address": "/sensors/DIMMER/state/lastupdated", diff --git a/MotionAllOff/README.md b/MotionAllOff/README.md new file mode 100644 index 0000000..d204398 --- /dev/null +++ b/MotionAllOff/README.md @@ -0,0 +1,13 @@ +# Turn Off All Lights + +This ruleset is a simple configuration that turns off all +lights when the motion sensor does not register movement within a 2 hour timeframe. + +## Devices + +```sh +IDS="s/BASENAME/xxx/g; s/MOTION/xxx/g" +``` + +* `BASENAME` Basename of the ruleset +* `MOTION` ID of the motion sensor diff --git a/MotionAllOff/all-off.rule.json b/MotionAllOff/all-off.rule.json new file mode 100644 index 0000000..3650665 --- /dev/null +++ b/MotionAllOff/all-off.rule.json @@ -0,0 +1,24 @@ +{ + "name": "BASENAME.all-off", + "conditions": [ + { + "address": "/sensors/MOTION/state/presence", + "operator": "eq", + "value": "false" + }, + { + "address": "/sensors/MOTION/state/lastupdated", + "operator": "stable", + "value": "PT02:00:00" + } + ], + "actions": [ + { + "address": "/groups/0/action", + "method": "PUT", + "body": { + "on": false + } + } + ] +} diff --git a/MotionIntelligent/README.md b/MotionIntelligent/README.md new file mode 100644 index 0000000..9b39526 --- /dev/null +++ b/MotionIntelligent/README.md @@ -0,0 +1,24 @@ +# Intelligent Motion Sensor Ruleset + +This ruleset is an improved configuration that turns on a +group of lights when the motion sensor registers movement. + +It does not trigger an action, if a light in the group is already switched on. + +In the night, it only turns on the lights dim. +The daylight sensor is checked for sunrise times. + +It does not switch off the lights, if they were not switched on by the sensor. + +## Devices + +```sh +IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/MOTION/xxx/g; s/AMBIENT/xxx/g; s/DAYLIGHT/1/g; s/MEM/xxx/g" +``` + +* `BASENAME` Basename of the ruleset +* `GROUP` ID of the group to handle +* `MOTION` ID of the motion sensor +* `AMBIENT` ID of the ambient light sensor inside the motion sensor +* `DAYLIGHT` ID of the daylight sensor (usually 1) +* `MEM` ID of the memory sensor diff --git a/MotionIntelligent/mem.sensor.json b/MotionIntelligent/mem.sensor.json new file mode 100644 index 0000000..e75e228 --- /dev/null +++ b/MotionIntelligent/mem.sensor.json @@ -0,0 +1,8 @@ +{ + "name": "BASENAME.mem", + "type": "CLIPGenericStatus", + "modelid": "MEM001", + "manufacturername": "Adrium", + "swversion": "1.0", + "uniqueid": "00:ad:10:f3:2a:9b-02" +} diff --git a/MotionIntelligent/off.rule.json b/MotionIntelligent/off.rule.json new file mode 100644 index 0000000..aa1b810 --- /dev/null +++ b/MotionIntelligent/off.rule.json @@ -0,0 +1,36 @@ +{ + "name": "BASENAME.off", + "conditions": [ + { + "address": "/sensors/MEM/state/status", + "operator": "gt", + "value": "0" + }, + { + "address": "/sensors/MOTION/state/presence", + "operator": "eq", + "value": "false" + }, + { + "address": "/sensors/MOTION/state/lastupdated", + "operator": "ddx", + "value": "PT00:02:00" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "on": false + } + }, + { + "address": "/sensors/MEM/state", + "method": "PUT", + "body": { + "status": 0 + } + } + ] +} diff --git a/MotionIntelligent/on-bright.rule.json b/MotionIntelligent/on-bright.rule.json new file mode 100644 index 0000000..03489fb --- /dev/null +++ b/MotionIntelligent/on-bright.rule.json @@ -0,0 +1,52 @@ +{ + "name": "BASENAME.on-bright", + "conditions": [ + { + "address": "/sensors/AMBIENT/state/dark", + "operator": "eq", + "value": "true" + }, + { + "address": "/groups/GROUP/state/any_on", + "operator": "eq", + "value": "false" + }, + { + "address": "/config/localtime", + "operator": "not in", + "value": "T00:00:00/T05:00:00" + }, + { + "address": "/sensors/DAYLIGHT/state/daylight", + "operator": "eq", + "value": "true" + }, + { + "address": "/sensors/MOTION/state/presence", + "operator": "eq", + "value": "true" + }, + { + "address": "/sensors/MOTION/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "on": true, + "bri": 240, + "ct": 357 + } + }, + { + "address": "/sensors/MEM/state", + "method": "PUT", + "body": { + "status": 1 + } + } + ] +} diff --git a/MotionIntelligent/on-dim-morning.rule.json b/MotionIntelligent/on-dim-morning.rule.json new file mode 100644 index 0000000..b0ca2ef --- /dev/null +++ b/MotionIntelligent/on-dim-morning.rule.json @@ -0,0 +1,52 @@ +{ + "name": "BASENAME.on-dim-morning", + "conditions": [ + { + "address": "/sensors/AMBIENT/state/dark", + "operator": "eq", + "value": "true" + }, + { + "address": "/groups/GROUP/state/any_on", + "operator": "eq", + "value": "false" + }, + { + "address": "/config/localtime", + "operator": "not in", + "value": "T00:00:00/T05:00:00" + }, + { + "address": "/sensors/DAYLIGHT/state/daylight", + "operator": "eq", + "value": "false" + }, + { + "address": "/sensors/MOTION/state/presence", + "operator": "eq", + "value": "true" + }, + { + "address": "/sensors/MOTION/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "on": true, + "bri": 13, + "ct": 1000 + } + }, + { + "address": "/sensors/MEM/state", + "method": "PUT", + "body": { + "status": 1 + } + } + ] +} diff --git a/MotionIntelligent/on-dim-night.rule.json b/MotionIntelligent/on-dim-night.rule.json new file mode 100644 index 0000000..ea9d39c --- /dev/null +++ b/MotionIntelligent/on-dim-night.rule.json @@ -0,0 +1,47 @@ +{ + "name": "BASENAME.on-dim-night", + "conditions": [ + { + "address": "/sensors/AMBIENT/state/dark", + "operator": "eq", + "value": "true" + }, + { + "address": "/groups/GROUP/state/any_on", + "operator": "eq", + "value": "false" + }, + { + "address": "/config/localtime", + "operator": "in", + "value": "T00:00:00/T05:00:00" + }, + { + "address": "/sensors/MOTION/state/presence", + "operator": "eq", + "value": "true" + }, + { + "address": "/sensors/MOTION/state/lastupdated", + "operator": "dx" + } + ], + "actions": [ + { + "address": "/groups/GROUP/action", + "method": "PUT", + "body": { + "on": true, + "bri": 13, + "ct": 1000 + } + }, + { + "address": "/sensors/MEM/state", + "method": "PUT", + "body": { + "status": 1 + } + } + ] +} diff --git a/MotionSimple/on-bright.rule.json b/MotionSimple/on-bright.rule.json index b523a19..051684d 100644 --- a/MotionSimple/on-bright.rule.json +++ b/MotionSimple/on-bright.rule.json @@ -32,7 +32,7 @@ "method": "PUT", "body": { "on": true, - "bri": 230 + "bri": 240 } } ] diff --git a/MotionSimple/on-dim.rule.json b/MotionSimple/on-dim.rule.json index cb19ce9..b777cb5 100644 --- a/MotionSimple/on-dim.rule.json +++ b/MotionSimple/on-dim.rule.json @@ -34,12 +34,6 @@ "on": true, "bri": 5 } - }, - { - "address": "/groups/GROUP/action", - "method": "PUT", - "body": { - } } ] } diff --git a/TapSimple/4.rule.json b/TapSimple/4.rule.json index 15d7d89..41eb092 100644 --- a/TapSimple/4.rule.json +++ b/TapSimple/4.rule.json @@ -17,7 +17,7 @@ "method": "PUT", "body": { "on": true, - "bri": 205, + "bri": 203, "ct": 182 } }