Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Add support for "on change" sensors, where off => on and on => off both activate the entity controller #283

Open
ndbroadbent opened this issue Sep 14, 2022 · 0 comments

Comments

@ndbroadbent
Copy link
Contributor

ndbroadbent commented Sep 14, 2022

Description

I would like to activate my entity controllers with either a "door close" or a "door open" event. I also want them to go to the active_timer state whenever a light turns on (either manually or by an automation, etc.)

However, I also want all my controllers to use sensor: "duration". I don't want lights to turn off if a motion sensor has been detecting motion the whole time.

As a workaround, I've created some "changed" input booleans that turn on for 1 second whenever a door opens or closes, or when a light turns on. But I would really like to avoid creating these custom "changed" sensors.

Configuration

Here is one example. I use a similar pattern for most of my other lights:

entity_controller:
    entrance_stairway_lights:
      entity: light.entrance_lights_l1
      sensor_type: duration
      sensor_resets_timer: True
      delay: 600 # 10 min
      disable_block: True
      sensors:
        - input_boolean.light_turned_on_entrance_lights_l1
        - input_boolean.door_changed_front_door_sensor_contact
        - input_boolean.door_changed_garage_entrance_sensor_contact
        - binary_sensor.lower_stairway_motion_sensor_occupancy
        - binary_sensor.hallway_entrance_motion_sensor_occupancy
        - binary_sensor.alarm_system_motion_sensor_2_occupancy
      overrides:
        - input_boolean.disable_motion_sensor_controllers
        - input_boolean.disable_1st_floor_motion_sensor_controllers
        - input_boolean.disable_non_pet_friendly_motion_sensor_controllers
        - input_boolean.night_mode
      behaviours:
        on_enter_overridden: "off"
      service_data:
        brightness_pct: 100

The first 3 sensors turn on for 1 second when the light turns on, or when a door opens or closes. This means that I can use sensor_type: duration, which avoids the edge case where a motion sensor stays on continuously for 10 minutes. I use some battery-powered Zigbee motion sensors that stay on for 3-5 minutes before motion is no longer detected, so it's very easy to trigger them a few times in 10 minutes and get them to stay on the whole time.

Suggestion

I would like to suggest supporting a list of objects for sensors, where a sensor_type option can be provided for each sensor and override the default value. I would also like to see a few more sensor types:

  • duration
  • event
  • event_off - triggers when state changes to "off"
  • event_all - triggers on any state change ("on" or "off")

(Not sure about the naming.)

Something like this:

entity_controller:
    entrance_stairway_lights:
      entity: light.entrance_lights_l1
      sensor_resets_timer: True
      sensor_type: duration
      delay: 600 # 10 min
      disable_block: True
      sensors:
        - entity_id: input_boolean.light_turned_on_entrance_lights_l1
          sensor_type: event
          sensor_resets_timer: False
        - entity_id: binary_sensor.front_door_sensor_contact
          sensor_type: event_all
        - entity_id: binary_sensor.garage_entrance_sensor_contact
          sensor_type: event_all
        - binary_sensor.lower_stairway_motion_sensor_occupancy
        - binary_sensor.hallway_entrance_motion_sensor_occupancy
        - binary_sensor.alarm_system_motion_sensor_2_occupancy

Basically I would like to have a bit more flexibility over sensor events, and configure different sensor_resets_timer and sensor_type values for each sensor.

Another thing that would be really helpful is an inverted override, because I've found it quite annoying to create a lot of inverted binary_sensors. (I often use these to toggle between two different entity controllers.) Maybe by supporting a dict with an invert option like this:

overrides:
  - entity_id: input_boolean.enable_motion_sensor_controllers
    invert: true

Please let me know what you think!

Version

9.5.2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant