danobot / entity-controller

Home Assistant Entity and lighting controller for managing devices with timers, scripts, and sun-based time restrictions.
https://danobot.github.io/ec-docs/
GNU General Public License v3.0
289 stars 41 forks source link

Feature Request: Support a new "active_forced" state for a provided list of entities (opposite of "overrides") #286

Open ndbroadbent opened 1 year ago

ndbroadbent commented 1 year ago

Description

Hello, sorry for all the feature requests lately! I wanted to post this idea to get some feedback.

I would like to add support for an active_forced, and a new forced_sensors list. Or maybe a way for each entry in the sensors list to be an object with it's own options.

I think this is not quite the same as active_stay_on, because I want entity-controller to turn off the entity and regain control after all forced: sensors are off. This is sort of the opposite of overrides. Instead of disabling the entity controller, I have some sensors where I want them to force the entity to stay on until the sensor (or input boolean) is off. I typically need this for hygrostats and thermostats that are controlling temperature, humidity, or air quality.

Original Configuration

Here is the current configuration for one of my bathroom fans. This was really tricky to set up - I want the fan to turn on immediately via motion or door sensor whenever someone uses the bathroom. I also want to leave the fan running if there is high humidity (e.g. after a shower.) I want to turn the fan off if our balcony door is left open for 10 minutes since we will be getting lots of fresh air, so there's need to waste electricity running the fan. Finally, I want to disable the motion sensors at night so that our cats don't trigger the motion sensors and wake us up with the fan.

  entity_controller:
    ensuite_bathroom_fan:
      friendly_name: Ensuite Bathroom Fan Controller
      entity: fan.ensuite_bathroom_fan
      sensor_resets_timer: True
      delay: 2700 # 45 min
      disable_block: True
      sensors:
        - fan.ensuite_bathroom_fan
        - input_boolean.door_changed_ensuite_bathroom_door_sensor_contact
        - binary_sensor.ensuite_bathroom_motion_sensor_occupancy
        - input_boolean.keep_all_fans_on
      overrides:
        - input_boolean.disable_all_motion_sensor_controllers
        - input_boolean.disable_2nd_floor_motion_sensor_controllers
        - input_boolean.disable_non_pet_friendly_motion_sensor_controllers
        - input_boolean.night_mode
        - input_boolean.bedroom_balcony_door_left_open
        - binary_sensor.ensuite_bathroom_hygrostat
        - input_boolean.keep_all_fans_on

    ensuite_bathroom_fan_hygrostat:
      friendly_name: Ensuite Bathroom Fan Hygrostat Controller
      entity: fan.ensuite_bathroom_fan
      sensor_type: duration
      delay: 600 # 10 min
      disable_block: True
      sensors:
        - input_boolean.door_changed_ensuite_bathroom_door_sensor_contact
        - binary_sensor.ensuite_bathroom_motion_sensor_occupancy
        - binary_sensor.ensuite_bathroom_hygrostat
        - input_boolean.keep_all_fans_on
      overrides:
        - binary_sensor.inverted_binary_sensor_ensuite_bathroom_hygrostat
      behaviours:
        on_exit_overridden: "on"

I also needed to set up a little flow in Node-RED to fill in some gaps: turn off the fan when certain overrides are activated, and turn on the fan for other overrides (input_boolean.keep_all_fans_on and binary_sensor.ensuite_bathroom_hygrostat).

Screen Shot 2022-09-24 at 1 02 16 AM

I wasn't able to use on_enter_overridden: "..." because I needed "on" for some cases, and "off" for others.

Proposed Configuration

  entity_controller:
    ensuite_bathroom_fan:
      friendly_name: Ensuite Bathroom Fan Controller
      entity: fan.ensuite_bathroom_fan
      sensor_resets_timer: True
      delay: 2700 # 45 min
      disable_block: True
      sensors:
        - fan.ensuite_bathroom_fan
        - input_boolean.door_changed_ensuite_bathroom_door_sensor_contact
        - binary_sensor.ensuite_bathroom_motion_sensor_occupancy
      forced_sensors:
        - binary_sensor.ensuite_bathroom_hygrostat      
        - input_boolean.keep_all_fans_on
      overrides:
        - input_boolean.disable_all_motion_sensor_controllers
        - input_boolean.disable_2nd_floor_motion_sensor_controllers
        - input_boolean.disable_non_pet_friendly_motion_sensor_controllers
        - input_boolean.night_mode
        - input_boolean.bedroom_balcony_door_left_open
      behaviours:
        on_enter_overridden: "off"

I'm not sure about the naming, but I something like this would be very useful. I might try to experiment with this idea in my fork.

phenates commented 1 year ago

Hello everyone, Thanks danobot for this great integration, is really usefull. i'm also interested by this feature. Force the entity-controller to stay active until a third sensor/entity is on and return into the "delay mode" when the third sensor pass to off. Thanks