rootiest

wattage template

Dec 20th, 2021 (edited)
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. template:
  2. - sensor:
  3. - unique_id: air_purifier_power_watts
  4. name: Air Purifier Power Use
  5. unit_of_measurement: W
  6. icon: mdi:flash
  7. state: >
  8. {% set voltage = states('sensor.air_purifier_voltage')|float %}
  9. {% set current = states('sensor.air_purifier_current')|float %}
  10. {% set wattage = (voltage * current) %}
  11. {{ wattage }}
  12.  
  13. # Alternatively, the entire state template can be condensed down to:
  14. # {{ ((states('sensor.air_purifier_voltage')|float) * (states('sensor.air_purifier_current')|float)) }}
  15. # But I think it looks nicer and more readable this way.
Add Comment
Please, Sign In to add comment