Shelly DW 2 with Tado thermostats

My setup:
Tado thermostats
Shelly Door/Window sensors

I want to “replace” the tado window open behavior with real window sensors.
From some forum posts, I learned that I can “store” the current tado state with a scene on window open, and reload the scene on window close.

My problem is, that the scene only stores the current temperature, not the hvac state. As I mostly use the tado smart schedule, but sometimes overrule the schedule with manual temperatures, I’d like to return to the exact state the thermostat was in.

Example:
Room climate is set to 22° and hvac mode “auto”
Window is opened and closed again
Automation set the correct temperature (22°) but the hvac_mode is “heat” (not “auto”).

Setting the climate hvac mode to “auto” on window close, is also not usable because if I manually set a temperature before opening the window, it should revert to this temperature and not to the smart schedule.

Is there a way to do what I want to do, or do I have to live with not being on smart schedule anymore or always being on smart schedule, regardless of state before opening the window.

Thanks in advance
Roman

Found the / a solution for my problem. Probably nothing new or exiting for the pros in here, but maybe another newbie like me finds my solution helpful :slight_smile:

Instead of making a snapshot of the climate entity, I add the state of the climate entity to the scene, like this:

  - service: scene.create
    data:
      scene_id: hvac_sz_before
      entities:
        climate.schlafzimmer:
          state: '{{ states("climate.schlafzimmer") }}'

To mitigate the problems that my previous setup had

  1. saving the state every time a window was opened in a room with more then one window
  2. reapplying the save state when a window was closed

I created a counter with that acted like a binary switch

windows_open_sz:
  name: "Offene Fenster im Schlafzimmer"
  initial: 0
  step: 1
  minimum: 0
  maximum: 1
  icon: mdi:window-closed

and added the condition that the window opened automation only fires when the counter is 0

condition:
  - condition: numeric_state
    entity_id: counter.windows_open_sz
    below: '1'

and added the action to increment the counter when the automation fires

  - service: counter.increment
    target:
      entity_id: counter.windows_open_sz

in the closing automation I already had the condition that all window sensors in the room need to report as closed, so there I just had to add the action to decrement the counter again

  - service: counter.decrement
    target:
      entity_id: counter.windows_open_sz

For those interested I include the links to the whole automation yaml of the “Window Opened” and “Window Closed” automations.

If a more experienced user (or anyone at all) has improvements on the code (I am unsure if the counter is the right thing to do, probably a binary sensor would be better but I did not find the code to set and unset it) please feel free to comment :slight_smile:

Window Opened Automation
Window Closed Automation