From e9c958002768ee72e6a0c191c767e9a80a2f62ed Mon Sep 17 00:00:00 2001 From: Przemek Grondek Date: Tue, 24 Aug 2021 02:24:16 +0200 Subject: [PATCH] Add printer energy measurement --- configuration/configuration.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/configuration/configuration.yaml b/configuration/configuration.yaml index 68da00f..f93c75d 100644 --- a/configuration/configuration.yaml +++ b/configuration/configuration.yaml @@ -570,6 +570,19 @@ template: {% endif%} attributes: last_reset: '1970-01-01T00:00:00+00:00' + - name: "Printer kWh" + unit_of_measurement: "kWh" + state_class: measurement + device_class: energy + state: > + {% set power = states('sensor.printer_energy') | float %} + {% if (power > 0) %} + {{ power }} + {% else %} + {{ states('sensor.printer_kWh') }} + {% endif%} + attributes: + last_reset: '1970-01-01T00:00:00+00:00' - name: "washing_machine_kWh" unit_of_measurement: "kWh" state_class: measurement