From a86926a98a64e6b5f73f2b4045acb96d4fd95898 Mon Sep 17 00:00:00 2001 From: Fabian Affolter Date: Fri, 1 Dec 2017 09:10:56 +0100 Subject: [PATCH] Add template example --- source/_components/switch.mystrom.markdown | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/source/_components/switch.mystrom.markdown b/source/_components/switch.mystrom.markdown index 7c81252bfc9..6fafcbbb783 100644 --- a/source/_components/switch.mystrom.markdown +++ b/source/_components/switch.mystrom.markdown @@ -53,3 +53,20 @@ or change its state: $ curl -G -X GET http://IP_ADDRESS/relay -d 'state=1' ``` +### {% linkable_title Get the current power consumption %} + +The switch is measuring the current power consumption. To expose this as a sensor use a [`template` sensor](/components/sensor.template/). + +{% raw %} +```yaml +# Example configuration.yaml entry +sensor: + - platform: template + sensors: + power: + friendly_name: "Current Power" + unit_of_measurement: "W" + value_template: "{{ states.switch.office.attributes.current_power_w }}" +``` +{% endraw %} +