Here is the code and you will have to edit it to suit your message. You will need to enable a power tracking option. If your not sending a message to a device then you can just use âEnable - Update of Start & End Helpers Onlyâ for your custom end action.
If so could you please provide us your YAML of the automation? This YAML code are the settings you have selected in the automation so I can help. To do this go into your automation, top right 3 dots, Edit in YAML, copy all the code, come back to the forum and in your reply at the top tool bar click on â</>â and paste code in there.
First we need to select â+ Add Actionâ in the custom actions. You can use start or end but the end will be the only one that you can also include your power tracking options.
You will then see your title and your message. If you donât want any power tracking options then just enter in your title and message. If you would like power tracking options then go to step 4.
Enter in the code that best suites your needs by copying and pasting it in replacing the code in the text area.
You will see in the code
Enter in your title here
Enter in your end message here
Consumption
Approx Cost $
Edit the wording to your liking. Select and copy 1 of the 3 code examples provide below.
Code for consumption in kWh only below.
service: notify.persistent_notification
data:
title: Enter in your title here
message: >
Enter in your end message here
{% set kwh = states(end_power_consumption) | float - states(start_power_consumption) | float %}
{{'\n'}}Consumption {{kwh | round(2) }} kWh
Code for cost only below.
service: notify.persistent_notification
data:
title: Enter in your title here
message: >
Enter in your end message here
{% set cost = (states(end_power_consumption) | float - states(start_power_consumption) | float) * (states(cost_per_kwh) | float) %}
{{'\n'}}Approx Cost ${{cost | round(2) }}
Code for consumption in kWh and cost below.
service: notify.persistent_notification
data:
title: Enter in your title here
message: >
Enter in your end message here
{% set kwh = states(end_power_consumption) | float - states(start_power_consumption) | float %}
{{'\n'}}Consumption {{kwh | round(2) }} kWh
{% set cost = (states(end_power_consumption) | float - states(start_power_consumption) | float) * (states(cost_per_kwh) | float) %}
{{'\n'}}Approx Cost ${{cost | round(2) }}
The code will look like this the first time you paste it in. If you go back into it, HA will condense it and that is okay.
The washing machine has already run twice today and it hasnât worked. I donât think it will work the third time. But Iâll see and come back here.
Thanks a lot! Will try this when back home.
Could you pls. put the âduration trackingâ on the backlog?
Btw. when is the start Power Helper filled? right after the value goes over the threshold or only if over threshold and start delay?
Is this just to know how long a washing machine runs for or is it for a more critical device that changes all the time and is critical to know this?
You can also create two date and or time helpers, one for the start and one for the end. Then you would use the start and end actions to get the duration. If you are unsure how to do this just let us know.