Entity Controller Mega Thread (Motion Lighting Controller)

Yes it is duration sensor. Ok. I will try that option. Thanks.

Nope. It doesn’t change anything. Entity_controller is blocked while entity_off script is running. That delay is showstopper. Well we tried. :slight_smile:

@danny I’m curious if this could be used in reverse… When a light is turned on manually, turn off after x time of inactivity on a sensor(s). Would be valuable to be able to utilize the night mode, and overrides.

I guess that’s the block mode restriction… gonna test this…

I am new to this awesome component and have a hard time figuring out if the component supports turning on multiple individual lights with different service data simultaneously? or will this require me to create a template?

If possible, kindly provide an example :slight_smile:

Thanks a lot!

@danny I posted a bug/error to Github - but wanted to follow up here for discussion. I’m trying to set a light or group of lights in a way that if turned on automatically will turn off after a set time (using block_timeout) but don’t want to require that the sensor detect motion before the timer starts. I was assuming you could use the light/switch as a sensor for that purpose. Can you confirm that will work as I’m expecting? Or could this be partially to blame for the error I am seeing (https://github.com/danobot/entity-controller/issues/47)?

The sensor must be triggered before the timer starts. That is how its currently implemented.

Thank you for this component.

As stated on wiki, overrides are used to:

You can define entities who block the motion light from turning on if those entities are in any defined on state.

I want to achieve the opposite effect - block the light from turning off when a sensor is at a given state. For example, I have a door sensor in my bathroom and would like not to turn off the light whenever the door is closed. It should override the timer set by the motion sensor which is also present.

Is it possible currently?

You can use custom state strings. Just set the override state string that is “on” by default to “off” and set the one that is “off” by default to “on”.
Read the docs to understand how to do this.

After upgrading to 0.92 get this error

@danny

2019-04-27 14:59:02 ERROR (MainThread) [homeassistant.setup] Error during setup of component entity_controller
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 153, in _async_setup_component
    hass, processed_config)
  File "/config/custom_components/entity_controller/__init__.py", line 110, in async_setup
    myconfig = config[DOMAIN][0]
KeyError: 0

try removing the [0]

My entity_controller are not working anymore, after updating to 4.0.0, for example the code below, when there is motion, at night or evening, the lights stays off.

I checked the new 4.0.0 version maybe I am missing something?

######################################################## 
#     DINING ROOM MOTION THEN LIGHT ON
########################################################
  dining_room_evening: 
    sensors: 
          - binary_sensor.pir_living_two
          - binary_sensor.pir_stairs_up
          - binary_sensor.pir_stairs_down
    entities: 
          - light.chandelier_one
          - light.chandelier_two
          - light.chandelier_three
   # service_data:
   #         brightness: 80
    start_time: sunset 
    end_time: '23:59:59'
    delay: 240
    sensor_type_duration: True
    overrides:
          - input_boolean.motion_dining_evening
          - input_boolean.dining_stop_off
      #    - binary_sensor.auto_lights_override
  dining_room_night: 
    sensors: 
          - binary_sensor.pir_living_two
          - binary_sensor.pir_stairs_up
          - binary_sensor.pir_stairs_down
    entity: light.chandelier_one
    service_data:
            brightness: 80
    start_time: '00:00:01'
    end_time: sunrise
    delay: 65
    sensor_type_duration: True
    overrides:
          - input_boolean.motion_dining_night
      #    - binary_sensor.auto_lights_override
1 Like

I also want to do a similar thing. I have some existing automations that detect motion in a bathroom/powder room, and then turn on the small light in the exhaust fan fixture. This works out really great, especially in the evenings and at night as this lamp isn’t too bright. My automation then turns off the lamp after so many seconds, as long as the “main” lights in the room have not turned on; this is an indication of some “manual override”. So I’d like the state of some other entity to just cause the controller to skip right to idle state when the time expires.

Now, I tried to use the overrides: entities for this purpose, but they only seem to affect turning on the light. It’d be great if they would also inhibit action from being taken when the timer expired.

I tried to understand how this applies:

and did some experiments, but it doesn’t seem to apply to my use-case.

Another similar use-case is in my kitchen, where I have 3 individually switched lighting circuits. When the motion sensor fires, I turn on one of them, and then off after some period of time… but the “turn off” automation is conditioned on none of the other 2 lighting circuits having been manually turned on, and indication of extended occupation of the room, probably sitting at the table eating (and not moving around very much). So an “inhibit expiration action” would also work well here.

I have another use-case, unrelated to these, where I’d want to mix different types of sensors - I have 2 doors with sensors between the inside of the house and an enclosed porch. When the doors are opened, they may stay open. There’s also a motion sensor out there was well that just generated motion events. So I’d be great if the type of motion sensor could be an attribute of the sensor, not the overall controller…

Gee, I sure ask for a lot! I was hoping to use this entity_controller thing to replace a number of ad-hoc automations, using timers…

Just wanted to give some praise for a nice component. It has bugged me with both homeassistant and openhab to not have an easy compact way to add motion triggered lights. It’s always with a bunch of extra timers and separate automations for on/off. Never nice and contained. Love it!

1 Like

I tested this solution with “Customising State Strings”. It allows me to change the state of the entity that overrides so that I can change that off state which actually launches the override, but still whenever I close my bathroom door and the entity controller gets the state “overridden” (which is totally correct) then it turns off my light. I think the main problem is here that the override actions is always to turn off the light. I could set the action of “state_states_on” to off, but then the light won’t turn on at all.

I need functionality to define the action taken by override state on the controlled entity - not to turn it off, but in my case to keep it on.

Unless, I still don’t understand something from the documentation, but I believe I read it carefully.

When the motion sensor activates a light for a specific time, the timer won’t get automatically extended during the motion. Only after the light goes off and a new motion is detected, it will be activated again.
Is there a way to prevent the light from going off but to auto extend it as long as there is motion?

Use duration sensor setting depending on your sensor type

1 Like

Hi @danny

I installes yu app and I am fascinated. But I have a question. Using time constraints is not enough for my needs. Some days it is grey and dark than other days. My light automations are all based on luminance values to avoid consuming too much energy if not needed.

My question hterefore would be. how could I archieve that in your app? Let’s say:

Turn on light the day (start and entime configured) but only if luminance is lower than x? This is for example my stairs which are sometimes well light and sometiimes not… according to the weather and sun conditons around our house.

I use a binary sensor in this case to override the light.
When the luminance is too high the light wouldn’t turn on.

sonne_tagsueber:
  friendly_name: "Sonne tagsĂźber"
  value_template: >-
    {% if states.sensor.helligkeit.state == None or is_state('sensor.helligkeit', 'unknown') %}
      False
    {% else %}
      {{ states.sensor.helligkeit.state | float > 20 }}
    {% endif %}
  bewegung_wohnzimmer:
    friendly_name: "Bewegung Wohnzimmer"
    sensor: binary_sensor.bewegungsmelder_wohnzimmer
    entities:
      - light.couch
    delay: 60
    overrides:
      - binary_sensor.sonne_tagsueber
1 Like

Thanks a lot! I currently use this:

    sensors: 
      - binary_sensor.motion_upstairs
      - binary_sensor.motion_downstairs
    entity: light.spots_stairs                  # required, [entity,entities]
    service_data:
      brightness: 100
    delay: 60
    block_timeout: 160
    start_time: '07:00:00'
    end_time: '21:00:00'
    overrides:
      - binary_sensor.enough_bightness_downstairs

and this binary senso:


  - platform: template
    sensors:
      enough_bightness_stairs:
        friendly_name: "Enough Brightness Stairs"
        value_template: "{{ states('sensor.luminance_downstairs')|float > 50 }}"

  - platform: template
    sensors:
      enough_bightness_downstairs:
        friendly_name: "Enough Brightness Downstairs"
        value_template: "{{ states('sensor.luminance_entrance')|float > 80 }}"
2 Likes

I just adapted your example and will report back if it works well.