Go to file
Adrian 836b3ff8b2 Rework LampShade moods and add thumbnails 2019-03-27 15:05:29 +01:00
DimmerBed Update readmes 2019-03-26 11:01:29 +01:00
DimmerLiving Update readmes 2019-03-26 11:01:29 +01:00
LampShade Rework LampShade moods and add thumbnails 2019-03-27 15:05:29 +01:00
MotionAllOff MotionAllOff: Fix operator bug 2018-04-28 00:33:24 +02:00
MotionIntelligent MotionIntelligent: Brighter during night 2019-03-26 11:04:16 +01:00
TapSimple Add descriptions 2018-04-17 11:31:30 +02:00
README.md Move LampShade moods 2019-03-27 14:11:25 +01:00

README.md

Philips Hue Rules

Each folder contains a set of rules that can be used with Philips Hue.

This is for geeks! 😉

Also see LampShade moods.

Usage

See the readmes inside the ruleset folders.

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, the parameters should be replaced as described below.

Some rulesets also require memory sensors. The BASENAME and XX parameters should be different for every instance of the ruleset.

Example

The following snippets demonstrate the installation of the DimmerBed ruleset for two different rooms.

First, install the memory sensors and note the returned IDs:

PREFIX="http://192.168.0.150/api/1234"

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:

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

This example requires jq for fully automated installation.

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