From c919bfc277ad10e05045868b95577e9fbac16b58 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Sun, 17 Jul 2016 15:10:55 +0200 Subject: [PATCH] Add example with the sun --- source/_components/sensor.template.markdown | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/source/_components/sensor.template.markdown b/source/_components/sensor.template.markdown index d5de67dace4..1f563c8d077 100644 --- a/source/_components/sensor.template.markdown +++ b/source/_components/sensor.template.markdown @@ -58,7 +58,18 @@ sensor: ### {% linkable_title Renaming sensor output %} -If you don't like the wording of a sensor output then the template sensor can help too. Processes monitored by the [System Monitor sensor](/components/sensor.systemmonitor/) show `on` or `off` if they are running or not. This example shows how the output of a monitored `glances` process can be renamed. +If you don't like the wording of a sensor output then the template sensor can help too. Let's rename the output of the [Sun component](/components/sun/) as a simple example: + +```yaml +sensor: + platform: template + sensors: + sun_state: + value_template: "{% if is_state('sun.sun', 'above_horizon') %}up{% else %}down{% endif %}" + friendly_name: 'Sun state' +``` + +Processes monitored by the [System Monitor sensor](/components/sensor.systemmonitor/) show `on` or `off` if they are running or not. This example shows how the output of a monitored `glances` process can be renamed. ```yaml sensor: