-
Notifications
You must be signed in to change notification settings - Fork 0
items
Items are the core matter of yahas. Items hold state that can be updated or read by plugins and bindings. In short, bindings allow items to communicate with the outside world (e.g. MQTT) and plugins allow you to actually do something with them (like a REST API or web interface) At its core, all that yahas itself does is manage items and provide plugins and bindings access to them.
Items are configured in config/items.json
as a JSON array. A short sample is provided in config/items.json.sample
. Each item can have the following properties:
- name
- label
- state
- updated
- prefix
- suffix
- binding
- update_on_send
The only one that is really necessary is the name
field. Each item must have a unique name since items are identified by their name. All other fields will default to empty, except update_on_send
which defaults to false
.
field name | description |
---|---|
name | name used to identify the item |
label | description of the item's state, e.g. "Temperature" |
state | current state |
updated | last time the item was updated |
prefix | prefix to use when state is displayed |
suffix | suffix to use when state is displayed (e.g. "°C") |
binding | binding to use for that item, see bindings |
update_on_send | see below |
This option specifies whether or not to update the internal state of the item when sending data to the binding. This is necessary because some bindings will generate a receive event for every send. For example when an item publishes to a mqtt topic and is also subscribed to said topic, the mqtt binding also receives the update and updates the item’s state that way. Resulting in 2 updates total if update_on_send
is true. Another scenario is using a different MQTT topic to receive the state updates ensuring the item’s state is only updated when the physical device actually confirms the update.
However if the item is only updated through the REST API and has no binding to automatically update the item’s state, the server needs to update the state “manually”. By default update_on_send is false.