Entity Controller Mega Thread (Motion Lighting Controller)

Fantastic. Thank you Danny. I’ve been using it for almost a year now but still found the video is useful.

1 Like

Just setting up this component and wondering if we could use entities in place of the delay?

eg:

entity_controller:
  kitchen_light_ec: 
    sensor: binary_sensor.kitchen_multi_sensor_sensor 
    entity: light.kitchen_light_level
    delay: input_number.kitchen_light_auto_off_time

That would allow the timer to be adjustable via the GUI.

EDIT: I am noticing some false triggers with this component. I carefully watched the entity controller data in the states dev tool to find a trigger event (while the timer was active, in countdown to switch a light off) and the controller updated with a new trigger event. Checking the sensor which supposedly triggered the entity controller, I confirmed that no such event existed in the history for that sensor. This appears to explain why often my light which this controller is controlling often does not switch off at all. Definitely seems to be a bug. I’ll post on github when I get a chance.

In the below images, the time at which the last trigger occured was only a couple of minutes ago yet the second image shows that sensor hasn’t changed state for 10 minutes.
image

image

@danny first of all your component is great. Thanks for that. I have a question … when I set start and end time the component switched to constrained when end time is arrived. When my light or lights are turned on before this happens the lights didn’t turned off via state changed to constrained. I thing the lights should be turned off by the component via such state change. And a second question did you plan to add light level condition to your component? I mean that the motion trigger triggerted in condition of defined light level. And my last question, is the same as @sparkydave ask. Is it possibly to set properties like ‘delay’ via entity?

Hi @markus78,
version 6 introduced transition behaviors that will help with your question (I had exactly the same problem).
Note that this is still experimental and will change in a future version.

It’s not possible to use entities in delays right now. I have looked at implementing this a few weeks ago but its not trivial and I have too many other commitments at the moment.

Hi all,
I really need some help on issue #126 to get template support into the component. Once that boilerplate is done for the relatively simple feature in #126 it can be reused for 150. Its a highly requested feature. Any devs out there willing to contribute?

Hi

I do not know if it is an error or something I am doing wrong.

This is one of my typical configurations:

motion_kitchen_light:     # serves as a name
    sensor: binary_sensor.motion_kitchen_motion  # required, [sensors]
    entity: light.kitchen_isle                # required, [entity,entities]
    delay: 1800
    service_data:
      brightness: 50
    overrides:
      - input_boolean.cancel_motion_automations

I set up the overrides “input_boolean.cancel_motion_automations” to be linked to my “house mode”, during the day is ON and cancel all motion automation, and during the night is OFF.

The problem is the transitions from one day to night mode.

Imagine I am in the kitchen with my dimmer to 100% reading, when the house change to night mode, the “overrides” turn off and if somebody moves in the kitchen the light dims to 50%, but the light was already on. It looks like the “(3) Do not interfere with manually controlled entities (tricky and not so obvious)”, is not working ok during the transition.

I am doing something wrong? or this is the behavior expected?

Maybe when the overrides go ON, the system needs to check the status of the light and if its ON, ignore the motion until the light is manually turned OFF

Thank you!

Great component, this component is already helping me cut out heaps of boilerplate automatons, great work, thanks!

Could do with a hand with this use case:

  1. motion sensor turn on light
  2. bluetooth presence tracking via room-assistant used to prevent light turning off.
  3. We don’t use bluetooth presence tracking to turn the light on, as it’s not 100% reliable and has some false positives.

Any and all suggestion welcome.

Please check if there is an existing issue for this on Github

Whatever you are using for presence detection must be reliable. I would consider improving your presence detection or looking for alternatives before integrating it into EC. The component can only trust the entity states…even if its unreliable.

What is the correct configuration in order to turn an active entity off when a controller gets overridden?

I have the following configuration and when the state is “active_timer” and an override entity becomes true it goes directly to “overridden” which leaves the light on until I turn it off manually.

  bewegung_wohnzimmer:
    friendly_name: "Bewegung Wohnzimmer"
    sensor: binary_sensor.bewegungsmelder_wohnzimmer
    entities:
      - light.couch
    delay: 60
    overrides:
      - binary_sensor.sonne_tagsueber
      - switch.computer   

Came here to say you’re awesome. Thank you for this component :slight_smile:

1 Like

When I manually turn on the light, the human movement sensing automation fails, how should be configured?

- alias: If there is riluo
  initial_state: true
  trigger:
    platform: state
    entity_id: binary_sensor.0x00158d00028850f7_contact
    from: 'off'
    to: 'on'
  condition:
    condition: state
    entity_id: sun.sun
    state: 'below_horizon'
  action:
    - service: switch.turn_on
      entity_id: switch.relay1_d
    - delay:
        seconds: 2
    - service: light.turn_on
      entity_id: light.fantem_oomi_unknown_type_0003_id_006f_level_3
    - delay:
        seconds: 60
    - service: switch.turn_off
      entity_id: switch.relay1_d
    - service: light.turn_off
      entity_id: light.fantem_oomi_unknown_type_0003_id_006f_level_3

I have this same issue.

If you want the light turned off when entering the “overriden” state try using on_enter_overidden: "off". See https://github.com/danobot/entity-controller#customising-state-strings " Transition Behaviours (beta)" section about 15 PgDn’s or 55-60% into the documentation.

1 Like

Thank you very much. That was the part I was looking for.

You need to pay attention to the correct spelling. The config is called ‘on_enter_overidden’ with 1 “R” in overridden.

Sorry about that… Doesn’t help that the transition state is misspelled! I did not copy & paste but viewed and then typed and the correct spelling of the word is overridden, which it is everywhere except the transition states on_enter_overidden and on_exit_overidden. I’ve submitted a bug report to have the correct spelling for the transitions states added.

Interesting. Have you tried using start_time: sunset and end_time: sunrise rather than the house mode override to see if entity_controller.motion_kitchen_light enters overridden state when sunset activates and it transitions from constrained mode and the light is already on at 100%?

You might also try when turning off the input_boolean.cancel_motion_automations to also check if the light in question is on then set the state of the entity_controller.motion_kitchen_light entity to overridden or blocked. This might potentially create a new issue where EC does not change to idle when the light is then manually switched off…

I think I might have the answer as I have been playing with my fireplace_motion_control. This issue is the transition from ‘overridden’ to ‘idle’ due to the override entity turning off while the control entity is on and the sensor entity is off…in your case input_boolean.cancel_motion_automations and in my case my living room light (my pole lamp is an override). I changed the code in homeassistant/custom_components/entity_controller/__init__.py on line 242 from dest="idle", to dest="blocked", and now my fireplace light stays on if I turned it on while overridden by pole lamp on and then turned pole lamp off. Previously it would turn off when I turned the pole lamp off.

Hey, have you tried on_enter_overidden: "off"??
I am looking inside the code and overridden appears to be spelled correctly.
All I see is def on_enter_overridden(self): and CONF_ON_ENTER_OVERRIDDEN which would make just the documentation incorrect…

In the const.py is the following:

CONF_ON_ENTER_OVERRIDDEN = 'on_enter_overidden'
CONF_ON_EXIT_OVERRIDDEN = 'on_exit_overidden'