From 502a5567a6b1e36ba27854056ba60fae856a43da Mon Sep 17 00:00:00 2001 From: Daniel Perna Date: Fri, 3 Feb 2017 17:58:05 +0100 Subject: [PATCH] Updated variable usage --- source/_components/homematic.markdown | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/source/_components/homematic.markdown b/source/_components/homematic.markdown index c38aed75424..feb48621efa 100644 --- a/source/_components/homematic.markdown +++ b/source/_components/homematic.markdown @@ -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 ```