node-red-contrib-huemagic
Version:
Philips Hue node to control bridges, lights, groups, scenes, rules, taps, switches, buttons, motion sensors, temperature sensors and Lux sensors using Node-RED.
69 lines (41 loc) • 3.7 kB
HTML
<script type="text/markdown" data-help-name="hue-rules">
The "Hue Rule" node can activate or deactivate rules saved in the bridge and call up their settings.
### Setup
Select the pre-configured Hue Bridge and hit the search button to find all the available rules. If you already know the ID of the rule, you can also enter it here manually. Alternatively, you can also assign a new name or choose the predefined name of the rule.
If you do not select a rule and use the node configuration in this way, the node works in the so-called "universal mode". In this mode, the node receives and outputs all status messages of the same type. You can also apply settings in universal mode to a specific rule by transferring the corresponding rule ID as a string in `msg.topic` together with your settings.
### Get properties / settings
Outputs the current properties of the rule as soon as a `msg.payload` object with the following content has been passed to the node. Alternatively, you can also press the button in the Node-RED interface without having to pass a message to the node beforehand.
: status (boolean): Returns the current status of the rule
### Activate / deactivate rule
The rule can be activated and deactivated if necessary. If the rule has been deactivated, it will no longer run in the bridge until you reactivate it. To do this, pass an object with the following content:
: payload (boolean): `true` activates the rule, `false` deactivates it
### Status messages from the node
As soon as the status (activated / deactivated) of a rule changes, the following status message is returned by the node:
#### Status object under `msg.payload`
: enabled (boolean): Indicates whether the rule is activated or deactivated
: triggered (string): Time of the last execution (ISO 8601)
#### Information about the rule under `msg.info`
: id (string): The unique ID of the rule
: created (string): Date of creation of the rule (ISO 8601)
: name (string): Name of the rule on the bridge
: timesTriggered (int): Number of times the rule was executed on the bridge
: owner (string): ID of the owner of this rule
: status (string): Status of the rule in the form of a string
#### Rule conditions under `msg.conditions` (array)
: address (string): Path to an attribute of a sensor
: operator (string): operator
: value (string): The value to be checked
#### Rule actions under `msg.actions` (array)
: address (string): The destination address of the resource
: method (string): The query method
: body (object): The action to be taken
#### Status changes under `msg.updated`
Lists individual parameters in the form of an object that have changed compared to the last state of the rule. If no changes have been registered, this object is empty.
#### Last status of the rule under `msg.lastState`
Contains the complete object (see output values above) of the last status before the last registered change of the rule. If the last state of HueMagic has not yet been registered, it will output `false`.
#### Last command under `msg.command` (optional)
If the status of the node has changed via a certain command, the entire command that was executed is also output. Otherwise this object will not be output by the node.
### Examples from HueMagic
HueMagic provides some sample configurations for this node. To import a full featured example into your Node-RED interface, click on the Node-RED menu icon, then select "Import" and navigate to "Examples" in the sidebar of the popup. Then select the HueMagic folder and your desired node to import a sample flow.

</script>