Entity Controller Mega Thread (Motion Lighting Controller)

Hello, i am having some problems using this integration. I installed it using Hacs, but it is not working.
I feel like I am missing something in configuration.yaml, but the github doesnt mention you need to add anything to make it work.
Is there a step after adding the files to custom_components?

Thanks

You need to configure it in your configuration.yaml file as described in the documentation on GitHub.

Currently it does not support custom service data for different type of control entities. The same service data is sent to all entities.

Hi Danny,

I’ve noticed something lately, could have been always present but sunrise/sunset changed enough to notice it.

If you are in constrained mode and the motion sensor is tripped and a duration type, and on when constrained mode exits, you get into a weird state with lights off, sensor on, and entity-controller in idle.

I would assume on constraint exit (and override exit too) that if the trigger sensor is “on” it should immediately go active?

Has it always been like this or perhaps something changed recently?

nothing changed recently other than potentially peoples configurations. Probably it has always been like this, i just dont have time to fix these really specific bugs that are hard to reproduce (because they are timebound and only occur under very specific conditions).

Hi Danny,

I am trying to use this package for a test, I must say that it is very useful.

The code I’m using is as follows:

input_boolean:
  block:
    name: block
    initial: off
    icon: mdi:home-assistant

entity_controller:
  movim_light:
    sensor: 
      - binary_sensor.p0
      - binary_sensor.p1
    entity: switch.p0_light           
    overrides: input_boolean.block
    delay: 8 

I therefore have two motion sensors that control a light.

Everything works, including the fact that if I use a button to turn on the light before the movement, the movement does not turn off the light at the end of the timeout - a function that in the documentation on GitHub you indicate as (3.1).

But there is one thing I can’t do, and that’s what you indicate as (3.2) (I copy&paste from GitHub):

(3.2) A light that is switched on the time-out period should have timed out, and therefore stay on.

I would need this but I could not implement it.

If the sensor turns on the light and then I press the button to “fix” the light on, it actually turns off (I use a Shelly1 and the button is linked to its input).

I don’t understand how should I do.

Do you have suggestions?

Thanks in advance

P.S. excuse the banality, I’m starting now with HA


I am trying to get this working but I cannot get the light to ever turn on. Once the motion event triggers the entity_controller stays active forever.
Any ideas would be great!
Here is my config.

motion_wled_light:
  sensor: binary_sensor.hai_motion_kitchen   # required, [sensors]
  # sensor_type: duration
  entities: 
    #- light.7665076568c63ae4aa5c # Walkway
    # - light.wled_2            # Office WLED required, [entity,entities]
    - light.316993    #Kitchen Table Insteon
  service_data:
    brightness_pct: 99  
  #delay: 20                 

Hi Danny!

First thanks for the component!

Then a question regarding one of my instances. I have a motion sensor that turns on two lamps, but one of them (“citrusbelysning”) is also controlled by a timer (to be on during daylight). I have also constrained the sensor to sunset/sunrise (so the sensor should work when it is dark), but in my case the sensor is always constrained.

The time windows overlap (sun sets before the timer goes off), but I thought this should work.
If I change the constrain times so the time windows doesn’t overlap, it works as expected.

Any ideas why the sensor is constrained after sunset when the timer is off?
I understand that the sensor is constrained when the sensor is activated (sunset-30min), but shouldn’t the sensor go back to idle when the lamp is turned off (at 18:00)?

Best regards,
Thomas

  motion_light_annexet:
    friendly_name: "Rörelse i Annexet"
    sensor:
      - binary_sensor.aeotec_zw100_multisensor_6_sensor_2
    entity:
      - light.fibaro_system_fgd212_dimmer_2_level
      - light.citrusbelysning
    sensor_type: duration
    delay: 300
    service_data:
      transition: 10
      brightness_pct: 100
    start_time: sunset - 00:30:00                # required
    end_time: sunrise + 00:30:00                 # required
    night_mode:
      delay: 60
      service_data:
        transition: 5
        brightness_pct: 30
      start_time: '01:00:00'                  # required
      end_time: '04:00:00'                    # required

If one of the controlled entities is on manually or from another automation you should see it in blocked state. That is not what you are seeing here.

But I would suggest you duplicate that entity controller, one for each light, so that the one not on the other daylight timer doesn’t block the one that isn’t.

Also be aware the sunset and sunrise times do not update from when HA was started and the entity controller component was loaded. This could lead to being constrained when you think it should not be if you have not accounted for this.

Just started using this and it’s really simplified a lot of things.
I have one light automation for the bathroom, that the delay changes depends on the state of the door:

  • 5 minutes delay (to turn off the light) when the door = close
  • 1 minute delay when the door = open

could this be handled by entity-controller?

thank you.

Please update to 4.1.1 available on HACS. It resolves an issue with EC getting stuck in constrained state.

Thanks for your contribution, John. Thinking the same here. Sometimes creating multiple EC instances resolves problems like this. Even with multiple EC’s the solution is sitll way neater than any alternative.

Try using a normal light first as a santity check (wihtout any brightness percentage). Once that is proven to work in your HASS instnace, move on to more complex stuff like passing service parameters. Use the devleoper tools to manually call the turn_on service on that entity with the supplied service parameters. That is all EC does in the background.

yes you cna achieve this using 2 EC with overrides.
EC1 is active when door = close,
EC2 is active when door = open

That way you can configure each EC instance any way you like :slight_smile:

Got it. thank you!

I can not get my light to stay on while there is motion. What am I doing wrong?

entity_controller:

  kitchen_motion_light:

    sensor:

      - binary_sensor.kitchen_motion_sensor

      - binary_sensor.kitchen_motion_sensor_2

    entity:  light.kitchen_main_lights

    delay: 300

    start_time: sunset - 00:30:00

    end_time: '00:30:00'

    sensor_resets_timer: True

is it possible to turn on and off lights based on the lux?

You could create a template-sensor in which you state the maximum/minimum lux.

@danny not sure how i missed this before, but it’s great. Thank you for producing it.
Small question, I presume any changes to the configuration require HA restart?
or is there some reload option?
Thank you

Hi everyone, I created a video to help explain all the features.

4 Likes