Skip to content

Commit 7b92182

Browse files
committed
Add template example
1 parent 5043fec commit 7b92182

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

source/_components/switch.mystrom.markdown

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,3 +53,20 @@ or change its state:
5353
$ curl -G -X GET http://IP_ADDRESS/relay -d 'state=1'
5454
```
5555

56+
### {% linkable_title Get the current power consumption %}
57+
58+
The switch is measuring the current power consumption. To expose this as a sensor use a [`template` sensor](/components/sensor.template/).
59+
60+
{% raw %}
61+
```yaml
62+
# Example configuration.yaml entry
63+
sensor:
64+
- platform: template
65+
sensors:
66+
power:
67+
friendly_name: "Current Power"
68+
unit_of_measurement: "W"
69+
value_template: "{{ states.switch.office.attributes.current_power_w }}"
70+
```
71+
{% endraw %}
72+

0 commit comments

Comments
 (0)