From 9cd4a5b4df28eeac412bbfd66eb979e3c97d95f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Lov=C3=A9n?= Date: Mon, 29 Oct 2018 13:27:36 +0100 Subject: [PATCH] Remove some redundant information (#7221) * Remove some redundant information * Use sensor.date in example instead, more even behavior --- source/_components/sensor.template.markdown | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/source/_components/sensor.template.markdown b/source/_components/sensor.template.markdown index 551b3d3b369..06c69ba5925 100644 --- a/source/_components/sensor.template.markdown +++ b/source/_components/sensor.template.markdown @@ -292,7 +292,7 @@ sensor: ### {% linkable_title Working with dates %} -The `template` sensors are not limited to use attributes from other entities but can also work with [Home Assistant's template extensions](/docs/configuration/templating/#home-assistant-template-extensions). This template contains no entities that will trigger an update, so either we need to use `homeassistant.update_entity` or add an `entity_id:` line for an entity that will force an update - here we're using `sun.sun`. +The `template` sensors are not limited to use attributes from other entities but can also work with [Home Assistant's template extensions](/docs/configuration/templating/#home-assistant-template-extensions). This template contains no entities that will trigger an update, so either we need to use `homeassistant.update_entity` or add an `entity_id:` line for an entity that will force an update - here we're using `sensor.date`. {% raw %} ```yaml @@ -301,28 +301,13 @@ sensor: sensors: nonsmoker: value_template: '{{ (( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(2) }}' - entity_id: sun.sun + entity_id: sensor.date friendly_name: 'Not smoking' unit_of_measurement: "Days" ``` {% endraw %} -### {% linkable_title Template tracking %} - -This example shows how to add `entity_id` to a template to allow tracking of updates. Fixing an error caused in (81.0) - -{% raw %} -```yaml -sensor: -- platform: template - sensors: - nonsmoker: - entity_id: now.strptime - value_template: '{{ (( as_timestamp(now()) - as_timestamp(strptime("06.07.2018", "%d.%m.%Y")) ) / 86400 ) | round(2) }}' - friendly_name: 'Not smoking' - unit_of_measurement: "Days" -``` -{% endraw %} +Useful entities to choose might be `sensor.date` which update once per day, or `sensor.time` which updates once per minute. Note: If a template uses more than one sensor they can be listed