Compare commits
No commits in common. "c342f4ec46d5f76d1ca8d68c90335e476e51c0b5" and "8e62602edcf6e72e53d271fcab46893160e6b92f" have entirely different histories.
c342f4ec46
...
8e62602edc
|
@ -1,29 +1,26 @@
|
|||
# Dimmer Switch Ruleset for Color Control
|
||||
|
||||
This ruleset is a configuration that can change
|
||||
color and brightness for a group of lights.
|
||||
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 (check indicator light)
|
||||
changes the mode of the brightness buttons:
|
||||
Pressing the on button longer cycles temperature, color, and saturisation mode.
|
||||
|
||||
Pressing the brightness buttons change the brightness,
|
||||
holding the brightness buttons change the temperature, color, and saturisation respectively.
|
||||
|
||||
* Mode 1:
|
||||
* Short Up/Down: brightness
|
||||
* Long Up/Down: color temperature
|
||||
* Mode 2:
|
||||
* Short Up/Down: saturisation
|
||||
* Long Up/Down: hue
|
||||
|
||||
## Devices
|
||||
|
||||
Install the memory sensor before proceding.
|
||||
|
||||
```sh
|
||||
IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/DIMMER/xxx/g; s/MEMORY/xxx/g"
|
||||
# IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/DIMMER/xxx/g; s/MEMORY/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
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
"modelid": "MEM001",
|
||||
"manufacturername": "Adrium",
|
||||
"swversion": "1.0",
|
||||
"uniqueid": "2b:41:4b:48:75:44:69:XX-01-fd00"
|
||||
"uniqueid": "00:ad:10:f3:2a:9b-03"
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ holding the brightness buttons change the color temperature.
|
|||
## Devices
|
||||
|
||||
```sh
|
||||
IDS="s/BASENAME/xxx/g; s/GROUP1/xxx/g; s/GROUP2/xxx/g; s/DIMMER/xxx/g"
|
||||
# IDS="s/BASENAME/xxx/g; s/GROUP1/xxx/g; s/GROUP2/xxx/g; s/DIMMER/xxx/g"
|
||||
```
|
||||
|
||||
* `BASENAME` Basename of the ruleset
|
||||
|
|
|
@ -12,8 +12,6 @@ It does not switch off the lights, if they were not switched on by the sensor.
|
|||
|
||||
## Devices
|
||||
|
||||
Install the memory sensor before proceding.
|
||||
|
||||
```sh
|
||||
IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/MOTION/xxx/g; s/AMBIENT/xxx/g; s/MEMORY/xxx/g"
|
||||
```
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
"modelid": "MEM001",
|
||||
"manufacturername": "Adrium",
|
||||
"swversion": "1.0",
|
||||
"uniqueid": "2b:41:4b:48:75:4d:6f:XX-01-fd00"
|
||||
"uniqueid": "00:ad:10:f3:2a:9b-02"
|
||||
}
|
||||
|
|
78
README.md
78
README.md
|
@ -8,80 +8,16 @@ See the readme inside the folder.
|
|||
|
||||
## Installation
|
||||
|
||||
The JSON files are raw Hue API requests for maximum flexibility and portability.
|
||||
Identifiers for lights and sensors are parameterized using uppercase letters.
|
||||
Hence, before submitting the configuration files to the bridge,
|
||||
they should be replaced as described below.
|
||||
The IDs of the components should be replaced first.
|
||||
Then the JSON files are submitted by POST to the bridge.
|
||||
|
||||
Some rulesets also require memory sensors.
|
||||
The `BASENAME` and `MAC` parameters should be different for
|
||||
every configuration.
|
||||
|
||||
### Example
|
||||
|
||||
The following snippets demonstrate the installation of the
|
||||
[DimmerBed](DimmerBed) ruleset for two different rooms.
|
||||
|
||||
First, install the memory sensors and note the returned IDs:
|
||||
This can be done using the following snippet:
|
||||
|
||||
```sh
|
||||
PREFIX="http://192.168.0.150/api/1234"
|
||||
BRIDGE="192.168.0.150"
|
||||
APIKEY="1234"
|
||||
IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/MOTION/xxx/g; ..."
|
||||
|
||||
IDS="s/BASENAME/BedroomAlice/g; s/XX/00/g"
|
||||
|
||||
cat DimmerBed/mem.sensor.json | sed "$IDS" | curl "$PREFIX/sensors" -H 'Content-Type: application/json' -d @-
|
||||
|
||||
# Returns: [{"success":{"id":"30"}}]
|
||||
|
||||
IDS="s/BASENAME/BedroomBob/g; s/XX/01/g"
|
||||
|
||||
cat DimmerBed/mem.sensor.json | sed "$IDS" | curl "$PREFIX/sensors" -H 'Content-Type: application/json' -d @-
|
||||
|
||||
# Returns: [{"success":{"id":"31"}}]
|
||||
for f in *.rule.json; do cat "$f" | sed "$IDS" | curl "http://$BRIDGE/api/$APIKEY/rules" -H 'Content-Type: application/json' -d @-; done
|
||||
```
|
||||
|
||||
Then, the ruleset can be installed:
|
||||
|
||||
```sh
|
||||
PREFIX="http://192.168.0.150/api/1234"
|
||||
|
||||
IDS="s/BASENAME/BedroomAlice/g; s/GROUP/1/g; s/DIMMER/10/g; s/MEMORY/30/g"
|
||||
|
||||
for f in DimmerBed/*.rule.json; do cat "$f" | sed "$IDS" | curl "$PREFIX/rules" -H 'Content-Type: application/json' -d @-; done
|
||||
|
||||
IDS="s/BASENAME/BedroomBob/g; s/GROUP/2/g; s/DIMMER/11/g; s/MEMORY/31/g"
|
||||
|
||||
for f in DimmerBed/*.rule.json; do cat "$f" | sed "$IDS" | curl "$PREFIX/rules" -H 'Content-Type: application/json' -d @-; done
|
||||
```
|
||||
|
||||
### Advanced Example
|
||||
|
||||
Note that the installation always is the same command.
|
||||
This example requires `jq` for fully automated installation.
|
||||
|
||||
|
||||
```sh
|
||||
install_sensor() {
|
||||
cat $1.sensor.json | sed "$IDS" | \
|
||||
curl "$PREFIX/sensors" -H 'Content-Type: application/json' -d @- | \
|
||||
jq -r .[0].success.id
|
||||
}
|
||||
|
||||
install_ruleset() {
|
||||
for f in $1/*.rule.json; do cat "$f" | sed "$IDS" | curl "$PREFIX/rules" -H 'Content-Type: application/json' -d @-; done
|
||||
}
|
||||
|
||||
PREFIX="http://192.168.0.150/api/1234"
|
||||
|
||||
IDS="s/BASENAME/BedroomAlice/g; s/XX/00/g"
|
||||
mem=$(install_sensor DimmerBed/mem)
|
||||
|
||||
IDS="s/BASENAME/BedroomAlice/g; s/GROUP/1/g; s/DIMMER/10/g; s/MEMORY/$mem/g"
|
||||
install_ruleset DimmerBed
|
||||
|
||||
IDS="s/BASENAME/BedroomBob/g; s/XX/01/g"
|
||||
mem=$(install_sensor DimmerBed/mem)
|
||||
|
||||
IDS="s/BASENAME/BedroomBob/g; s/GROUP/2/g; s/DIMMER/11/g; s/MEMORY/$mem/g"
|
||||
install_ruleset DimmerBed
|
||||
```
|
||||
|
|
Loading…
Reference in New Issue