mirror of
https://github.com/home-assistant/home-assistant.io.git
synced 2025-07-18 23:06:58 +00:00
Add template example
This commit is contained in:
parent
5043fec54a
commit
7b921826b5
@ -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 %}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user