Hello,
My heating device is electrical heater inside 800L water tank and my electrical subscription is dual rate.
I would like to heat water when temperature is below 58 degree up to 62 degree but only when this happened:
weekend → anytime
weekday →
month (1,2,3,10,11,12) → time 0AM - 6AM, 1PM - 3PM, 10PM - 0AM
month (4,5,6,7,8,9) → time 0AM - 6AM, 3PM - 5PM, 10PM - 0AM
I did several automations but the problem is it only switches on heater when temperature falls below 58 degree during on phase - when it is lower then 58 degree when “heating time” starts it is not switching on heater.
Will be greatfull for any help
Kind Regards
Maciek
You also need a trigger at the start of the on phase, and a condition that it’s cold.
However, the easiest way would be to set up a Generic Thermostat to manage the heater, and two schedules for summer and winter cheap rate electricity.
The schedules will turn on
when you’re in a cheap period, and off
when not.
Then, with assumptions on their names, and YAML syntax requiring 2024.10 or later:
triggers:
- trigger: state
entity_id:
- schedule.summer_cheap_rate # or whatever you've called it
- schedule.winter_cheap_rate # or whatever you've called it
to:
- 'on'
- 'off'
conditions:
- or:
- "{{ 'summer' in trigger.entity_id and now().month in (4,5,6,7,8,9) }}"
- "{{ 'winter' in trigger.entity_id and now().month in (1,2,3,10,11,12) }}"
actions:
- action: climate.set_hvac_mode
target:
entity_id: climate.water_heater # or whatever you've called it
data:
hvac_mode: "{{ 'heat' if trigger.to_state.state == 'on' else 'off' }}"
Thank you.
I made thermostat and two schedules.
But where (which file) put yaml code?
Create a new blank automation in the UI. Switch to YAML mode and paste in the appropriate bits of code instead of the placeholders.
Does the thermostat work if you turn it on manually?
If your schedule entity turned on, there should be an automation trace that will show you what happened. Should look something like this:
If it’s not clear to you from that what happened, click the three dots top-right, select Download Trace, and paste it here formatted as code.
First - thank you for your help.
Yes - thermostat works when I turn it manualy
(from off to heating stage)
here’s my trace
{
"trace": {
"last_step": "condition/0/conditions/1",
"run_id": "47bdd8818101eacb7fbe0b4004e815d2",
"state": "stopped",
"script_execution": "failed_conditions",
"timestamp": {
"start": "2024-10-11T15:00:00.001143+00:00",
"finish": "2024-10-11T15:00:00.001581+00:00"
},
"domain": "automation",
"item_id": "1728583471333",
"trigger": "state of schedule.grzanie_lato",
"trace": {
"trigger/0": [
{
"path": "trigger/0",
"timestamp": "2024-10-11T15:00:00.001232+00:00",
"changed_variables": {
"this": {
"entity_id": "automation.termostat_grzalka_zasobnik",
"state": "on",
"attributes": {
"id": "1728583471333",
"last_triggered": "2024-10-11T13:00:00.002271+00:00",
"mode": "single",
"current": 0,
"friendly_name": "termostat_grzalka_zasobnik"
},
"last_changed": "2024-10-10T20:25:56.722353+00:00",
"last_reported": "2024-10-11T13:00:00.003141+00:00",
"last_updated": "2024-10-11T13:00:00.003141+00:00",
"context": {
"id": "01J9XTM8414S6QTQW8S4TY2A2Z",
"parent_id": "01J9XTM84132HWCPA47MX3DYNK",
"user_id": null
}
},
"trigger": {
"id": "0",
"idx": "0",
"alias": null,
"platform": "state",
"entity_id": "schedule.grzanie_lato",
"from_state": {
"entity_id": "schedule.grzanie_lato",
"state": "on",
"attributes": {
"editable": true,
"next_event": "2024-10-11T17:00:00+02:00",
"icon": "mdi:white-balance-sunny",
"friendly_name": "summer_cheap_rate"
},
"last_changed": "2024-10-11T13:00:00.001469+00:00",
"last_reported": "2024-10-11T13:00:00.001469+00:00",
"last_updated": "2024-10-11T13:00:00.001469+00:00",
"context": {
"id": "01J9XTM841BXHGYFC0A57SGC1Y",
"parent_id": null,
"user_id": null
}
},
"to_state": {
"entity_id": "schedule.grzanie_lato",
"state": "off",
"attributes": {
"editable": true,
"next_event": "2024-10-11T22:00:00+02:00",
"icon": "mdi:white-balance-sunny",
"friendly_name": "summer_cheap_rate"
},
"last_changed": "2024-10-11T15:00:00.000808+00:00",
"last_reported": "2024-10-11T15:00:00.000808+00:00",
"last_updated": "2024-10-11T15:00:00.000808+00:00",
"context": {
"id": "01J9Y1FZC0J0TWDTPPK8801D64",
"parent_id": null,
"user_id": null
}
},
"for": null,
"attribute": null,
"description": "state of schedule.grzanie_lato"
}
}
}
],
"condition/0": [
{
"path": "condition/0",
"timestamp": "2024-10-11T15:00:00.001268+00:00",
"result": {
"result": false
}
}
],
"condition/0/conditions/0": [
{
"path": "condition/0/conditions/0",
"timestamp": "2024-10-11T15:00:00.001287+00:00",
"result": {
"result": false,
"entities": []
}
}
],
"condition/0/conditions/1": [
{
"path": "condition/0/conditions/1",
"timestamp": "2024-10-11T15:00:00.001512+00:00",
"result": {
"result": false,
"entities": []
}
}
]
},
"config": {
"id": "1728583471333",
"alias": "termostat_grzalka_zasobnik",
"description": "termostat_grzalka_zasobnik",
"triggers": [
{
"trigger": "state",
"entity_id": [
"schedule.grzanie_lato",
"schedule.grzanie_zima"
],
"to": [
"on",
"off"
]
}
],
"conditions": [
{
"condition": "or",
"conditions": [
{
"condition": "template",
"value_template": "{{ 'lato' in trigger.entity_id and now().month in (4,5,6,7,8,9) }}"
},
{
"condition": "template",
"value_template": "{{ 'zima' in trigger.entity_id and now().month in (1,2,3,10,11,12) }}"
}
]
}
],
"actions": [
{
"action": "climate.set_hvac_mode",
"target": {
"entity_id": "climate.thermostat_grzalka_zasobnik"
},
"data": {
"hvac_mode": "{{ 'heat' if trigger.to_state.state == 'on' else 'off' }}"
}
}
],
"mode": "single"
},
"blueprint_inputs": null,
"context": {
"id": "01J9Y1FZC1DQP5ZA728TJHMTD8",
"parent_id": "01J9Y1FZC0J0TWDTPPK8801D64",
"user_id": null
}
},
"logbookEntries": []
}
seems there’s something wrong with the names? (I changed them to corresponding)
In summer / winter schedule I have:
name: summer/winter_cheap_rate
entity identyfier: grzanie lato/zima (means summer/winter)
maybe I should change this:
- condition: template
value_template: "{{ 'lato' in trigger.entity_id and now().month in (4,5,6,7,8,9) }}"
- condition: template
value_template: "{{ 'zima' in trigger.entity_id and now().month in (1,2,3,10,11,12) }}"```
to this:
- condition: template
value_template: "{{ 'summer' in trigger.entity_id and now().month in (4,5,6,7,8,9) }}"
- condition: template
value_template: "{{ 'winter' in trigger.entity_id and now().month in (1,2,3,10,11,12) }}"
No, the original was fine. Can you try changing mode: single
to mode: queued
? Both schedules are turning on at 22:00, and the summer one (which doesn’t pass the conditions) might be blocking the winter one.
The trace you pasted was for the summer schedule triggering. If that change didn’t fix it, please post a winter trace.
Sorry for late answer - it works when I change single to queued.
But I have another question: when we have national holidays
(like 25,26 of December for instance)
mu cheap rate is whole day - what to change to consider that?