From 85734809a3a94882920efeb554d8386d2c3ce319 Mon Sep 17 00:00:00 2001
From: Erick Hitter <services@ethitter.com>
Date: Tue, 27 Dec 2016 11:22:02 -0800
Subject: [PATCH] Update README for config changes made as part of #2.

Nice that there's a proper example now, too.
---
 README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 49 insertions(+)

diff --git a/README.md b/README.md
index fd267ef..d2ebb36 100644
--- a/README.md
+++ b/README.md
@@ -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.
-- 
GitLab