In my setup I have multiple climate controllers with an entity ID like this climate.[location]climate. Besides that the rooms have window sensors with an entity ID like this binary_sensor.[location]window[counter].
What I am looking for is a automation in either node-red or the normal automations. Once a window opens for more than 15 minutes the thermostat mode should be set to 'off' and, preferrably, the current state should be saved. Once all the windows are closed, the old state should be restored. (Although I am not sure if I want a delay here as well). Manual changes to the thermostat (if one of the windows is open) should be blocked.
My current idea (in node-red):
Flow 1: An (repeating) inject node set at every minute that kicks for the main delay portion. This feeds into a get entities node that retrieves the current state of the windows. Next is a script node that checks if a window is opened for more than 15 minutes. If so, the current status is stored and the thermostat is turned off. The script also has the option to check if all the windows are closed and (after the 15 minutes have expired) restore the last state.
Flow 2: An event node for the thermostats to allow for the blocking of the thermostats in case the window is opened.
Currently I am struggling to successfully retrieve the windows with the get entities node. I am trying to do this with a JSONata expression. But since I can't see the input of the get entities node debugging this is difficult.
As an alternative I am thinking of just handling this with subflows with 2 variables. The first would be a list of the windows and the second would be the climate entity to monitor. It's at least easier to build that way.
Do you have any suggestions of how I can best accomplish this?