I have water boiler (actually I have 3 heaters) , referred here also as “lvv” (short for it’s Finnish word “lämminvesivaraaja”) and I want to see indication that has it been on TODAY, or not.
Can not install temperature sensors to show if it is hot or not. Much easier to do it like this.
I am using Spot price electricity that has no fixed price, and boiler heats up in 3 of the cheapest hours at night (timeslot AM 0:00-10:00)
So in the morning I want to see if automation has worked and it has consumed energy. Two boilers have no temperature meters, one has analogue one.
.
Tried to get this done with couple AI:s, but not much help (Open AI and Bard)
I have like 1% Coding skills, bear that in mind when answering.
.
Entity → “sensor.zb_poro_lvv_summation_delivered” is cumulative, and will show every bit of energy my water boiler (lvv) used ever in it’s lifetime, and can not be reset, I think, so it grows every day. There is no daily consumption sensor.
How do I fix this so that it will indicate “Yes” if energy has been used TODAY?
This is what AI made up, and it created “lvv_poro_usedornot”-entity, but that seems to always show “no”:
sensor:
- platform: template
sensors:
lvv_poro_usedornot:
value_template: |
{% set now = now() %}
{% set start_of_day = now.replace(hour=0, minute=0, second=0) %}
{% set usage = states('sensor.zb_poro_lvv_summation_delivered', now) | float %}
{% set usage_start_of_day = states('sensor.zb_poro_lvv_summation_delivered', start_of_day) | float %}
{% set usage = usage - usage_start_of_day %}
{% if usage > 0 %}
{{ "Yes", " ({{ usage }} kWh)" }}
{% else %}
{{ "No" }}
{% endif %}
(This all is ofcourse written to configuration.yaml)
Or does the code work, and I just need to wait for it to register when this consumption is happening?
.
Here is the output atm, and it is ~1 hour until next day starts, so I am going to sleep and check here in the morning if you wonderful people have an answer to me!