From 28a2cba70903612bba1051badc428f8906dce41c Mon Sep 17 00:00:00 2001 From: Robert Date: Wed, 19 Jun 2019 08:12:09 +0200 Subject: [PATCH] [Utility Meter] Add template sensors to DSMR example (#9602) * Add template sensors to DSMR example Add a daily and monthly template sensor to DSMR example that sum peak and off peak usage * Try new syntax * Surround jinja in yaml with raw --- source/_components/utility_meter.markdown | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/source/_components/utility_meter.markdown b/source/_components/utility_meter.markdown index a186c0ad8e1..509c03984dc 100644 --- a/source/_components/utility_meter.markdown +++ b/source/_components/utility_meter.markdown @@ -184,3 +184,23 @@ utility_meter: source: sensor.gas_consumption cycle: monthly ``` + +Additionally, you can add template sensors to compute daily and monthly total usage. + +{% raw %} +```yaml +sensor: + - platform: template + sensors: + daily_power: + friendly_name: Daily Power + icon: mdi:counter + unit_of_measurement: kWh + value_template: {{ states('sensor.daily_power_offpeak')|float + states('sensor.daily_power_peak')|float }} + monthly_power: + friendly_name: Monthly Power + icon: mdi:counter + unit_of_measurement: kWh + value_template: {{ states('sensor.monthly_power_offpeak')|float + states('sensor.monthly_power_peak')|float }} +``` +{% endraw %}