mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 23:06:58 +00:00
Updated variable usage
This commit is contained in:
parent
0d3616737b
commit
502a5567a6
@ -47,7 +47,7 @@ Configuration variables (host):
|
||||
- **username** (*Optional*): When fetching names via JSON-RPC, you need to specify a user with guest-access to the CCU.
|
||||
- **password** (*Optional*): When fetching names via JSON-RPC, you need to specify the password of the user you have configured above.
|
||||
- **primary** (*Optional*): Set to `true` when using multiple hosts and this host should provide the services and variables.
|
||||
- **variables** (*Optional*): Set to `true` if you want to use CCU2/Homegear variables. Should only be enabled for the primary host.
|
||||
- **variables** (*Optional*): Set to `true` if you want to use CCU2/Homegear variables. Should only be enabled for the primary host. When using a CCU credentials are required.
|
||||
|
||||
#### Example configuration with multiple protocols and some other options set:
|
||||
|
||||
@ -89,10 +89,24 @@ In order to allow communication with multiple hosts or different protocols in pa
|
||||
Using multiple hosts has the drawback, that the services (explained below) may not work as expected. Only one connection can be used for services, which limits the devices/variables a service can use to the scope/protocol of the host.
|
||||
This does *not* affect the entites in Home Assistant. They all use their own connection and work as expected.
|
||||
|
||||
### Reading attributes of entities
|
||||
|
||||
Most devices have, besides their state, additional attributes like their battery state or valve position. These can be accessed using templates in automations, or even as their own entities using the [template sensor](https://home-assistant.io/components/sensor.template/) component. Here's an example of a template sensor that exposes the valve state of a thermostat.
|
||||
|
||||
```yaml
|
||||
sensor:
|
||||
- platform: template
|
||||
sensors:
|
||||
bedroom_valve:
|
||||
value_template: '{{ states.climate.leq123456.attributes.Valve }}'
|
||||
entity_id: climate.leq123456
|
||||
friendly_name: 'Bedroom valve'
|
||||
```
|
||||
|
||||
### Variables
|
||||
|
||||
It is possible to read and set values of system variables you have setup on the CCU/Homegear. An example of how that is done can be found below. The supported types for setting values are float- and bool-variables.
|
||||
Each variable will be available as it's own entity in the form of `homematic.name`. The predefined `homematic.homematic` variable has the number of service messages as it's value. You can use these variable-entities like any other entity in Home Assistant to trigger automations.
|
||||
It is possible to read and set values of system variables you have setup on the CCU/Homegear. The supported types for setting values are float- and bool-variables.
|
||||
The states of the variables are available through the attributes of your hub entity (e.g. `homematic.rf`). Use templates (as mentioned above) to make your variables available to automations or as entities.
|
||||
The values of variables are polled from the CCU/Homegear in an interval of 30 seconds. Setting the value of a variable happens instantly and is directly pushed.
|
||||
|
||||
### Events
|
||||
@ -157,13 +171,14 @@ action:
|
||||
param: OPEN
|
||||
```
|
||||
|
||||
Set variable
|
||||
Set boolean variable to true
|
||||
```yaml
|
||||
...
|
||||
action:
|
||||
service: homematic.set_var_value
|
||||
data:
|
||||
entity_id: homematic.varname_bool
|
||||
entity_id: homematic.rf
|
||||
name: Variablename
|
||||
value: true
|
||||
```
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user