Skip to content

Commit 57b3733

Browse files
committed
documentation
1 parent e4657f7 commit 57b3733

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

config/README.md

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ Each `rule` object may contain following nodes:
2020
- `valueMapsToMqtt` - mapping rules, when it's necessary to convert a value received from `devices/action` before publish to MQTT
2121

2222
#### rule.alexa
23-
This node may contain following nodes:
24-
- `alisa.instance` - is an Alisa controller instance under `state` node.
25-
- `alisa.subvalue` - when reporting state to Alisa, the `state` should be a complex node, rather than a simple value. It defines a subnode name under `state` for providing state. For example for `devices.capabilities.color_setting` with `color_model`=`hsv`, the expected report value must be like that:
23+
This node may contain following subnodes:
24+
- `alisa.instance` - is an `instance` under `state` node in communication with Alisa.
25+
- `alisa.subvalue` - when reporting state to Alisa, the `value` should be a complex node, rather than a simple value. It defines a subnode name under `state.value` for providing state. For example for `devices.capabilities.color_setting` with `color_model`=`hsv`, the expected report value must be like that:
2626

2727
```json
2828
...
@@ -74,7 +74,7 @@ to achieve that, it's necessary to define 3 rules, one per subvalue:
7474
```
7575

7676
#### rule.mqtt
77-
This node may contain following nodes:
77+
This node may contain following subnodes:
7878
- `mqtt.state` - topic name with values received from Home Automation System. Used as a value-source for `devices/query` responses.
7979
- `mqtt.commands` - topic name for commands to be sent to Home Automation System. Used as target-topic for `devices/action` commands received from Alexa.
8080

@@ -192,6 +192,13 @@ in this case, one can use <code>h</code>, <code>s</code>, and <code>v</code> as
192192

193193
When rule contains multiple mappings, they are attempted to be applied in order from first to last. If some mapping can't be applied (for example `value` mapping doesn't match `from` field), then this mapping is skipped, and verified next one. Iteration stopped after first successful conversion.
194194

195+
Though most of mapping types (except `linearRange`) are having output definitions as strings, when sent to Alisa as a query-response, they get casted to appropriate type automatically. For example:
196+
- `{ "type": "static", "value": "abc" }`, produces string: `{ "state": { "value": "abc" } }`
197+
- `{ "type": "static", "value": "1" }`, produces integer: `{ "state": { "value": 1 } }`
198+
- `{ "type": "static", "value": "1.0" }`, produces float: `{ "state": { "value": 1.0 } }`
199+
- `{ "type": "static", "value": "true" }`, produces boolean: `{ "state": { "value": true } }`
200+
- `{ "type": "static", "value": "{\"h\":255,\"s\":50,\"v\":100}" }`, produces json: `{ "state": { "value": { "h": 255, "s": 50, "v": 100 } } }`
201+
195202
# Troubleshooting
196203
Potential misconfigurations may cause either stop of the whole application, or some devices or rules may be ignored.
197204

0 commit comments

Comments
 (0)