Skip to content
Snippets Groups Projects
Verified Commit 85734809 authored by Erick Hitter's avatar Erick Hitter
Browse files

Update README for config changes made as part of #2.

Nice that there's a proper example now, too.
parent 3b580423
No related branches found
No related tags found
No related merge requests found
......@@ -29,3 +29,52 @@ If `flicd` and this script are not run from the same device, ensure that `flicd`
**Can I run `flicd` as a daemon/at startup?**
Yes. See https://ethtiter.com/ for a `systemd` service file.
**How is the `buttons` property of `config.json` structured?**
Each object within the `buttons` property is structured according to how the button should respond to the entity's current state. For example, if the light is off, what should a button press do.
"mac": {
"mac": "mac",
"label": "Lamp",
"status": {
"entity_id": "switch.lamp"
},
"off": {
"entity": "switch",
"entity_id": "switch.lamp",
"entity_action": "turn_on"
},
"on": {
"entity": "switch",
"entity_id": "switch.lamp",
"entity_action": "turn_off"
}
}
The above example simply switches a light on and off, depending on its current state. There can be any number of state entries in an individual button's object, however. A button could be configured only to respond to the "on" state by omitting the "off" entry, or if the entity returns other states, those could also be handled. An example of this comes when interacting with Smart Home Assistant, which has three states:
"mac": {
"mac": "mac",
"label": "Smart Home Monitor",
"status": {
"entity_id": "alarm_control_panel.shm"
},
"disarmed": {
"entity": "alarm_control_panel",
"entity_id": "alarm_control_panel.shm",
"entity_action": "alarm_arm_home"
},
"armed_home": {
"entity": "alarm_control_panel",
"entity_id": "alarm_control_panel.shm",
"entity_action": "alarm_disarm"
},
"armed_away": {
"entity": "switch",
"entity_id": "switch.lamp",
"entity_action": "turn_on"
}
}
In this example, if the alarm isn't active, or is set to the "armed home" state, its Flic button will toggle between those states. If, however, one tried to use the button to disable the alarm when no one is home (motion sensors are active, among other changes), the button will simply turn on a light; it won't disarm the alarm, as that's something I only allow for those who have access to Home Assistant or SmartThings directly.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment