From 117966df4ce2b95217a49bd01c319139a53d35db Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Thu, 14 Jul 2016 09:58:13 +0200 Subject: [PATCH] Add link to binary version --- source/_components/sensor.template.markdown | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/_components/sensor.template.markdown b/source/_components/sensor.template.markdown index 25d1f0baef5..d5de67dace4 100644 --- a/source/_components/sensor.template.markdown +++ b/source/_components/sensor.template.markdown @@ -69,6 +69,14 @@ sensor: friendly_name: 'Glances' ``` +By comparing the details published on the [template](/topics/templating/) page the same can be archived with a different approach: + +```yaml +value_template: {% raw %}"{%if states.sensor.ENTITY_ID.state == 'on' %}running{%elif states.switch.ENTITY_ID.state == 'off' %}not running{% endif %}"{% endraw %} +``` + +The [Binary template sensor](/components/binary_sensor.template/) is the one in similar cases if you prefer to see an icon instead of text. + ### {% linkable_title Multiline example with an if test (and warnings disabled) %} This example shows a multiple line template with and if test. It looks at a sensing switch and shows on/off in the frontend. It disables warnings to avoid log messages where the switch it depends on isn't loaded yet.