diff --git a/source/_components/media_player.webostv.markdown b/source/_components/media_player.webostv.markdown index b045ccc518a5..a4afa661dadb 100644 --- a/source/_components/media_player.webostv.markdown +++ b/source/_components/media_player.webostv.markdown @@ -76,8 +76,8 @@ Avoid using `[ ]` in the `name:` of your device. Home Assistant is able to turn on a LG webOS Smart TV if you specify an action, like HDMI-CEC or WakeOnLan. -Common for webOS 3.0 and higher would be to use WakeOnLan feature. -To use this feature your TV should be connected to your network via Ethernet rather than Wireless and you should enable *LG Connect Apps* feature in *Network* settings of the TV [instructions](http://www.lg.com/uk/support/product-help/CT00008334-1437131798537-others) (or *Mobile App* in *General* settings for older models). +Common for webOS 3.0 and higher would be to use WakeOnLan feature. +To use this feature your TV should be connected to your network via Ethernet rather than Wireless and you should enable *LG Connect Apps* feature in *Network* settings of the TV [instructions](http://www.lg.com/uk/support/product-help/CT00008334-1437131798537-others) (or *Mobile App* in *General* settings for older models) (*may vary by version). On newer models (2017+), WakeOnLan may need to be enabled in the TV settings by going to Settings > General > Mobile TV On > Turn On Via WiFi [instructions](https://support.quanticapps.com/hc/en-us/articles/115005985729-How-to-turn-on-my-LG-Smart-TV-using-the-App-WebOS-). ```yaml # Example configuration.yaml entry diff --git a/source/_components/sensor.trafikverket_weatherstation.markdown b/source/_components/sensor.trafikverket_weatherstation.markdown index 272c4e09941b..5ef302c60c79 100644 --- a/source/_components/sensor.trafikverket_weatherstation.markdown +++ b/source/_components/sensor.trafikverket_weatherstation.markdown @@ -12,11 +12,12 @@ ha_category: Sensor ha_release: 0.66.0 --- -Showing weather information for air and road temperature provided by [Trafikverket](https://www.trafikverket.se/) in Sweden. +Showing weather information for air and road temperature as well as precipitation provided by [Trafikverket](https://www.trafikverket.se/) in Sweden. +Precipitation is returned as a string of text in Swedish. Potential use cases: - Get weather data in general -- You live near a weather station and want to know the current temperature at home +- You live near a weather station and want to know the current temperature or precipitation at home - Setup automations for your car heating system. If the road is frozen along the way to work, you might want the car heating system to start earlier. ##### {% linkable_title Configuration %} @@ -46,7 +47,7 @@ station: required: true type: string type: - description: Defines which temperature you want (`air` or `road`). + description: Defines which data you want (`air`, `road` or `precipitation`). required: true type: string scan_interval: @@ -83,4 +84,10 @@ sensor: station: Lanna type: air scan_interval: 600 + - platform: trafikverket_weatherstation + name: Trafikverket Precipitation WeatherStation Nöbbele + api_key: eXXcbXXXacXXXXc39XX3aXXX4aXX46XX + station: Nöbbele + type: precipitation + scan_interval: 600 ``` diff --git a/source/_docs/automation/trigger.markdown b/source/_docs/automation/trigger.markdown index edccbd457b88..e682a20c3890 100644 --- a/source/_docs/automation/trigger.markdown +++ b/source/_docs/automation/trigger.markdown @@ -159,6 +159,10 @@ automation: ``` {% endraw %} +

+Rendering templates with time (`now()`) is dangerous as trigger templates only update based on entity state changes. +

+ ### {% linkable_title Time trigger %} Time can be triggered in many ways. The most common is to specify `at` and trigger at a specific point in time each day. Alternatively, you can also match if the hour, minute or second of the current time has a specific value. You can prefix the value with a `/` to match whenever the value is divisible by that number. You cannot use `at` together with hour, minute or second. diff --git a/source/_docs/configuration/entity-registry.markdown b/source/_docs/configuration/entity-registry.markdown index b6183f7b76b9..b699bb979eb4 100644 --- a/source/_docs/configuration/entity-registry.markdown +++ b/source/_docs/configuration/entity-registry.markdown @@ -9,27 +9,18 @@ sharing: true footer: true --- -

-This is a new and experimental feature of Home Assistant. -

+Starting with version 0.63, Home Assistant keeps a registry of known entities. The entity registry makes sure that entities get unique identifiers and allow customizing the identifiers and names of these entities. -Starting with version 0.63, Home Assistant keeps a registry of known entities. -The entity registry makes sure that entities get unique identifiers and allow -customizing the identifiers and names of these entities. - -As this is still a very new part of Home Assistant, changes will require a -restart of Home Assistant to take effect. A config user interface will be added -in a future version. +Changes require that Home Assistant is shut down when you edit the file, otherwise Home Assistant may over-write your changes, and a restart of Home Assistant is required for your changes to take effect. Version 0.75 introduced a configuration user interface.

An entity needs to have a unique ID to be registered in the entity registry. Not all integrations currently provide a unique id for their entities.

-The entity registry is stored in `/entity_registry.yaml`. As a user, -you are unable to add entries, only update them. Here is an example file: +The entity registry is stored in `/entity_registry.yaml`. As a user, you are unable to add entries, only update them. Here is an example file: -``` +```yaml climate.downstairs_virtual: platform: nest unique_id: EPoMyWkpNyoYu3pGlmGxabcdefghijkl @@ -40,20 +31,18 @@ light.study_ceiling: disabled_by: user ``` -As a user, you can change the `entity_id` and add the `name` and `disabled_by` -value to each entry. - - Changing the _first line_ of each entry will change the `entity_id` of the entity throughout Home Assistant. +As a user, you can change the `entity_id` and add the `name` and `disabled_by`value to each entry. + - Changing the _first line_ of each entry will change the `entity_id` of the entity throughout Home Assistant. - The value of `name` will override the _friendly name_ of the entity as given by the integration. _Added in Home Assistant 0.64._ - - The key `disabled_by` can either be `hass` or `user`. This functionality - is even more experimental than the whole entity registry itself and might - cause integrations to fail and might be removed in the future. + - The key `disabled_by` can either be `hass` or `user`. This functionality is even more experimental than the whole entity registry itself and might cause integrations to fail and might be removed in the future. _Added in Home Assistant 0.64._ {% linkable_title Supported Components %} -At the moment, only the following components are supported: Z-Wave, Hue, Nest, LIFX, Sonos, Apple TV, Weather Underground +Only components that provide a unique ID for entities will are supported. + Note that for Weather Underground, second and subsequent Personal Weather Station ID (pws_id) will have their monitored conditions suffixed with an index number. diff --git a/source/_docs/configuration/templating.markdown b/source/_docs/configuration/templating.markdown index eea6b7c46df7..69ad76211bf2 100644 --- a/source/_docs/configuration/templating.markdown +++ b/source/_docs/configuration/templating.markdown @@ -17,16 +17,9 @@ This is an advanced feature of Home Assistant. You'll need a basic understanding Templating is a powerful feature in Home Assistant that allows the user control over information that is going into and out of the system. It is used for: -- Formatting outgoing messages in, for example, the [notify] and [alexa] components. -- Process incoming data from sources that provide raw data, like [MQTT], [REST sensor], or the [command line sensor]. -- [Automation Templating]. - -[notify]: /components/notify/ -[alexa]: /components/alexa/ -[MQTT]: /components/mqtt/ -[REST sensor]: /components/sensor.rest/ -[command line sensor]: /components/sensor.command_line/ -[Automation Templating]: /docs/automation/templating/ +- Formatting outgoing messages in, for example, the [notify](/components/notify/) platforms and [alexa](/components/alexa/) component. +- Process incoming data from sources that provide raw data, like [MQTT](/components/mqtt/), [`rest` sensor](/components/sensor.rest/) or the [`command_line` sensor](/components/sensor.command_line/). +- [Automation Templating](/docs/automation/templating/). ## {% linkable_title Building templates %} @@ -38,6 +31,7 @@ The frontend has a template editor developer tool to help develop and debug temp Templates can get big pretty fast. To keep a clear overview, consider using YAML multiline strings to define your templates: +{% raw %} ```yaml script: msg_who_is_home: @@ -45,12 +39,13 @@ script: - service: notify.notify data_template: message: > - {% raw %}{% if is_state('device_tracker.paulus', 'home') %} + {% if is_state('device_tracker.paulus', 'home') %} Ha, Paulus is home! {% else %} Paulus is at {{ states('device_tracker.paulus') }}. - {% endif %}{% endraw %} + {% endif %} ``` +{% endraw %} [Jinja2](http://jinja.pocoo.org/) supports a wide variety of operations: @@ -104,8 +99,10 @@ Home Assistant adds extensions to allow templates to access all of the current s If your template uses an `entity_id` that begins with a number (example: `states.device_tracker.2008_gmc`) you must use a bracket syntax to avoid errors caused by rendering the `entity_id` improperly. In the example given, the correct syntax for the device tracker would be: `states.device_tracker['2008_gmc']`

+## {% linkable_title Templates using `now()` %} +

-Rendering templates with time is dangerous as updates only trigger templates in sensors based on entity state changes. +Rendering templates with time (`now()`) is dangerous as updates only trigger templates in sensors based on entity state changes.

## {% linkable_title Home Assistant template extensions %} @@ -117,43 +114,51 @@ In templates, besides the normal [state object methods and properties](/topics/s ## {% linkable_title Examples %} ### {% linkable_title States %} + The next two statements result in same value if state exists. The second one will result in an error if state does not exist. +{% raw %} ```text -{% raw %}{{ states('device_tracker.paulus') }} -{{ states.device_tracker.paulus.state }}{% endraw %} +{{ states('device_tracker.paulus') }} +{{ states.device_tracker.paulus.state }} ``` +{% endraw %} ### {% linkable_title Attributes %} Print an attribute if state is defined. Both will return the same thing but the last one you can specify entity_id from a variable. +{% raw %} ```text -{% raw %}{% if states.device_tracker.paulus %} +{% if states.device_tracker.paulus %} {{ states.device_tracker.paulus.attributes.battery }} {% else %} ?? -{% endif %}{% endraw %} +{% endif %} ``` +{% endraw %} With strings +{% raw %} ```text -{% raw %}{% set tracker_name = "paulus"%} +{% set tracker_name = "paulus"%} {% if states("device_tracker." + tracker_name) != "unknown" %} {{ state_attr("device_tracker." + tracker_name, "battery")}} {% else %} ?? -{% endif %}{% endraw %} +{% endif %} ``` +{% endraw %} ### {% linkable_title Sensor states %} Print out a list of all the sensor states. +{% raw %} ```text -{% raw %}{% for state in states.sensor %} +{% for state in states.sensor %} {{ state.entity_id }}={{ state.state }}, {% endfor %} @@ -173,48 +178,58 @@ Print out a list of all the sensor states. {{ as_timestamp(states.binary_sensor.garage_door.last_changed) }} -{{ as_timestamp(now()) - as_timestamp(states.binary_sensor.garage_door.last_changed) }}{% endraw %} +{{ as_timestamp(now()) - as_timestamp(states.binary_sensor.garage_door.last_changed) }} ``` +{% endraw %} ### {% linkable_title Distance examples %} If only 1 location is passed in, Home Assistant will measure the distance from home. +{% raw %} ```text -{% raw %}Using Lat Lng coordinates: {{ distance(123.45, 123.45) }} +Using Lat Lng coordinates: {{ distance(123.45, 123.45) }} Using State: {{ distance(states.device_tracker.paulus) }} These can also be combined in any combination: {{ distance(123.45, 123.45, 'device_tracker.paulus') }} -{{ distance('device_tracker.anne_therese', 'device_tracker.paulus') }}{% endraw %} +{{ distance('device_tracker.anne_therese', 'device_tracker.paulus') }} ``` +{% endraw %} ### {% linkable_title Closest examples %} Find entities closest to the Home Assistant location: +{% raw %} ```text -{% raw %}Query all entities: {{ closest(states) }} +Query all entities: {{ closest(states) }} Query all entities of a specific domain: {{ closest('states.device_tracker') }} Query all entities in group.children: {{ closest('group.children') }} -Query all entities in group.children: {{ closest(states.group.children) }}{% endraw %} +Query all entities in group.children: {{ closest(states.group.children) }} ``` +{% endraw %} Find entities closest to a coordinate or another entity. All previous arguments still apply for 2nd argument. +{% raw %} ```text -{% raw %}Closest to a coordinate: {{ closest(23.456, 23.456, 'group.children') }} +Closest to a coordinate: {{ closest(23.456, 23.456, 'group.children') }} Closest to an entity: {{ closest('zone.school', 'group.children') }} -Closest to an entity: {{ closest(states.zone.school, 'group.children') }}{% endraw %} +Closest to an entity: {{ closest(states.zone.school, 'group.children') }} ``` +{% endraw %} ### {% linkable_title Combined %} + Since closest returns a state, we can combine it with distance too. +{% raw %} ```text -{% raw %}{{ closest(states).name }} is {{ distance(closest(states)) }} kilometers away.{% endraw %} +{{ closest(states).name }} is {{ distance(closest(states)) }} kilometers away. ``` +{% endraw %} ## {% linkable_title Processing incoming data %} @@ -238,11 +253,13 @@ This means that if the incoming values looks like the sample below: The template for `on` would be: +{% raw %} ```yaml -'{% raw %}{{value_json.on}}{% endraw %}' +'{{value_json.on}}' ``` +{% endraw %} -Nested JSON in a response is supported as well +Nested JSON in a response is supported as well: ```json { @@ -259,10 +276,11 @@ Nested JSON in a response is supported as well Just use the "Square bracket notation" to get the value. +{% raw %} ```yaml -'{% raw %}{{ value_json["values"]["temp"] }}{% endraw %}' +'{{ value_json["values"]["temp"] }}' ``` - +{% endraw %} The following overview contains a couple of options to get the needed values: @@ -294,8 +312,8 @@ The following overview contains a couple of options to get the needed values: To evaluate a response, go to the template developer tool icon template developer tools, create your output into "Template", and check the result. -```yaml {% raw %} +```yaml {% set value_json= {"name":"Outside", "device":"weather-ha", @@ -304,5 +322,6 @@ To evaluate a response, go to the