Hi,
I have a power metering Zigbee plug attached to my washing machine. I use that to send a notification when the program is finished. (I use the Appliance has finished blueprint for that.) When the program starts, I set a date/time helper to {{ now() }}
. This way I can display in the notification how long the machine ran. This works great. Now, I’d like to add in the notification the amount of energy used for the program. Is there a way to sum the used energy of the plug between two timestamps?
Here’s the template that I use for the message now:
data:
data:
url: /lovelace/was
group: notification_group_droger
title: De droger is klaar!
message: >
{%- set time = (as_timestamp(now()) - as_timestamp(states('input_datetime.droger_start'))) | int %}
{%- set minutes = ((time % 3600) // 60) %}
{%- set minutes = '{} minuten'.format(minutes) if minutes > 0 else '' %}
{%- set hours = ((time % 86400) // 3600) %}
{%- set hours = '{} uur '.format(hours) if hours > 0 else '' %}
{{ 'Het programma duurde ' + hours + minutes + '.' }}
action: notify.was