Compare commits

...

2 Commits

Author SHA1 Message Date
Adrian c342f4ec46 Update readmes 2019-03-26 10:48:05 +01:00
Adrian f0ad296424 Use real ZigBee addresses for sensors
* EUI-64
* First Endpoint (00 is ZigBee Device Object)
* fc00-ffff Manufacturer specific cluster (0xfc00 is used by the dimmer)
2019-03-26 10:25:48 +01:00
6 changed files with 89 additions and 20 deletions

View File

@ -1,25 +1,28 @@
# Dimmer Switch Ruleset for Color Control
This ruleset is a configuration that can change
color and temperature for a group of lights.
color and brightness 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 cycles temperature, color, and saturisation mode.
Pressing the brightness buttons change the brightness,
holding the brightness buttons change the temperature, color, and saturisation respectively.
Pressing the on button longer (check indicator light)
changes the mode of the brightness buttons:
* Mode 1:
* Short Up/Down: brightness
* Long Up/Down: color temperature
* Mode 2:
* Short Up/Down: saturisation
* Long Up/Down: hue
## Devices
```sh
# IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/DIMMER/xxx/g; s/MEMORY/xxx/g"
```
Install the memory sensor before proceding.
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.
```sh
IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/DIMMER/xxx/g; s/MEMORY/xxx/g"
```
* `BASENAME` Basename of the ruleset
* `GROUP` ID of the group to handle

View File

@ -4,5 +4,5 @@
"modelid": "MEM001",
"manufacturername": "Adrium",
"swversion": "1.0",
"uniqueid": "00:ad:10:f3:2a:9b-03"
"uniqueid": "2b:41:4b:48:75:44:69:XX-01-fd00"
}

View File

@ -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

View File

@ -12,6 +12,8 @@ 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"
```

View File

@ -4,5 +4,5 @@
"modelid": "MEM001",
"manufacturername": "Adrium",
"swversion": "1.0",
"uniqueid": "00:ad:10:f3:2a:9b-02"
"uniqueid": "2b:41:4b:48:75:4d:6f:XX-01-fd00"
}

View File

@ -8,16 +8,80 @@ See the readme inside the folder.
## Installation
The IDs of the components should be replaced first.
Then the JSON files are submitted by POST to the bridge.
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.
This can be done using the following snippet:
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:
```sh
BRIDGE="192.168.0.150"
APIKEY="1234"
IDS="s/BASENAME/xxx/g; s/GROUP/xxx/g; s/MOTION/xxx/g; ..."
PREFIX="http://192.168.0.150/api/1234"
for f in *.rule.json; do cat "$f" | sed "$IDS" | curl "http://$BRIDGE/api/$APIKEY/rules" -H 'Content-Type: application/json' -d @-; done
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"}}]
```
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
```