Window open sensor for generic thermostat

Hey there,

I am using the generic_thermostat integration to handle my thermostats.
I currently working on extending the source code to get an optional window sensor to be handled by the integration itself.

So what I am thinking about is

  • have an optional window_entity_id to be configured
  • optional window_open_duration (default would be “instant”)
  • optional window_open_temperature (default might be min_temp? not sure 'bout this)

There are some things I am actually struggling with.

  • do not handle window stuff when HVAC is turned off (that seems to be easy as I can just handle HVAC_MODE_OFF for it)
  • when window is opened, I want to wait until the window_open_duration exceeds but
    I dont get how min_cycle_duration works as there is no such “timer” stuff.
  • when window is closed, I want to restore previous temperature setting. But what would be the best way to persist previous temperature setting?
  • when HA is rebooted while window handling is active, how could I restore entity states after restart so I can handle window close afterwards?
  • window_open_temperature - do we even need it or should I just turn off the thermostat? when switching off thermostat at all, how could I make a difference between HVAC_MODE_OFF because its summer vs. HVAC_MODE_OFF because I’ve switched it off due to window detection?

I’d like to get some feedback here so I can move on with my python coding :smiley:

Thanks in advance!

Massive feedback in the forums. :pensive:

1 Like

I feel you. I’ve had similar overwhelming responses… lol
Hope you’ve been able to figure this out.

Probably because this is best done via an automation.