Generic thermostat scheduling

Hello, I’m using Home Assistant Core 2025.2.4, installed on Mini ITX with Sonoff ZBDongleGateway to handle Zigbee network.
Now I have added a generic thermostat using Sonoff SNZB-02D and Shelly 2 way switch (to control two zone valve)
It works fine, but the change from Confort, Eco or Night settings is only manual
There are some way to make a daytime control to handle “timed” change of the generic termostat settings?
Thanks for help!!
Abele

Create an automation that triggers on time.
And action is something like:

action: climate.set_hvac_mode
metadata: {}
data:
  hvac_mode: Confort
target:
  entity_id: climate.sonoff

Thanks for reply, but I’m new to HA and I have few experience on programming.
Could you give me more details how to create automation that trigger on time?
The target should be the “Generic Thermostat” I have on my helpers list?

You need to open automations first. You can’t create an automation from devices.

Paste this yaml in your automation and it should give you a base.
Open the automation in yaml mode paste it then you can switch back to GUI mode.

description: ""
mode: single
triggers:
  - trigger: time
    at: "08:00:00"
    id: Comfort
  - trigger: time
    at: "12:00:00"
    id: Eco
  - trigger: time
    at: "20:00:00"
    id: Night
conditions: []
actions:
  - action: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: "{{ trigger.id }}"
    target:
      entity_id: climate.termostato_spora

I used the id as the name of the hvac_mode so that you can make one automation for all times of the day.

Many thanks Hellis81!
This seems clear for me, now I try to integrate on my HAs.
The code has to be copied in what yaml file?
Only further thing … the “trigger.id” directive needs to be updated with some name in my HAs configuration or is a generic metadata for all applcations?
Thanks a lot!

No. The entity_id obviously must match your thermostat, which it probably does but is impossible to say for sure (as the end of it is truncated in your screenshot).

The {{ trigger.id }} template does not need to be modified. What it does is simply pull whatever was entered as the id of the triggers above, so as the automation runs will automatically render to Comfort, Eco, Night, etc.

What I am not sure about however (I don’t have any climate entities) is whether the hvac_mode property is case sensitive. Possibly they all need to be entered as lowercase (or lowercased by a template filter).

No you can paste it in the GUI.

Press the edit in yaml and you should see a text editor.
When its pasted, press the same button again (visual editor) and you are back in the normal editor.

It gets the mode from the trigger.

  - trigger: time
    at: "08:00:00"
    id: Comfort

This says id is comfort.

The same id is then used in the action

  - action: climate.set_hvac_mode
    metadata: {}
    data:
      hvac_mode: "{{ trigger.id }}"
    target:
      entity_id: climate.termostato_spora

So at 8:00 the "{{ trigger.id}}" becomes comfort

Hello Hellis81,
Sorry for the delay … I was busy for work
this is my GUI interface … your source code needs to be pasted here?

No.
Setting → automations
But you can use automations.yaml.
But I don’t advice you use it.

Thanks Hellis81!
Here below screen of my automation rule and yaml file
A last request: this automation works only at fixed time, but if for some reason the system starts i.e. at 9:00 am the confort mode scheduled at 8:00 am went not activated .
There is a way to update termo settings even if time is between two trigger points?
Many thanks for support
Abele

I believe your time on HA is incorrect then

Create a climate card on the dashboard and change it there.
Or in developer tools states.

this my HA time

such as this?

Yes that works

I’m sorry Hellis … but unfortunately the timed automation seems non working
At 12:00 the climate Termostato Sopra in not switched to Eco
Here below what I see on automation tab and climate settings
Where I wrong?

As I said. Is the time correct?
There are some posts how to check this, so search for it.
Has the automation ever triggered?
What does the trace say?

Time & Date I see

The automation rule trace

Oh sorry.
It was the wrong action.

You probably need

climate.set_preset_mode