Entity Controller Mega Thread (Motion Lighting Controller)

I got a, hopefully, simple question about entity controller. Is there any way of updating the active_timer when motion is detected? So, say,

  • You have motion whilst in idle state and an active_timer is started, that expires after say 5 minutes
  • During this 5 minutes interval, you sit still, so the motion sensor thinks there is no occupancy, and say, on the 4th minute of the active_timer, you move again.
  • the active_timer is now updated to the expiry time is 5 minutes from the last movement

Iā€™m pretty sure it does that already, if you have your sensor type configured correctly. You might look at sensor_resets_timer also.

Hi there.

I had lots of weird behaviour with EC, until, after an HASS update everything exploded and suddonly nothing worked (there is an open ticket at the EC GitHub, but it seems unmaintained at this stage).

TL;DR EC seems dead in the water, I used node-red and a statemachine node as a basis of rolling my own solution.

Yeah Iā€™m getting some weirdness too. Not ready to switch to node red but maybe have toā€¦or fork and fix.

Some sleuthingā€¦I turned on debugging and it appears that EntityController isnā€™t correctly noticing states of the override elements - which I use to stop certain actions when it is light outsideā€¦in my case I see no logging of changes for the state of the override binary_sensor. I wonder if that matches the symptoms others are seeing?

I donā€™t see why the override elements are different than the sensor or control elements, but my hypothesis is that something changed in how to detect state, maybe the state strings can be overridden to fix?

HA. Found it!

You could say operator error, but the real change that affected me and EC was the parsing of config files has changes somewhere along the way.

I had this for the override:
overrides: binary_sensor.light_enough

which did not parse correctly (it made an array of each character)

This fixed it:

overrides:
- binary_sensor.light_enough

So somewhere along the line the config file reading bit got updated/changed/something and it broke my config. Maybe @justdanyul check for that on any of the sensor/control/override arrays?

And of course major thanks to danobot (Daniel Mason) Ā· GitHub for clear code and EXCELLENT debug logging.

Edit: just saw you found a fix for your problem. Iā€™m curious, are you on the latest version of home assistant? It looks to me, in the debug logs, like all the yaml parsing have gone a bit la-la since 2023.12. It seems like quite a few people are facing similar issue

When I realised it seems to be abandoned, I asked my self if i wanted to maintain it, and came to the conclusion I didnā€™t. So I thought, NodeRED might represent an easy way forward haha.

I was plesently suprised by NODE red here. It took me about an hour (as a total node-red n00b) to get something fairly solid in place. It updates the timer, does exponential backoff, leaves the light alone if i manually turn it on or dim it etc. (manually meaning from any source besides the custom binary sensor that tiggers based on motion and light levels)

the statemachine looks like this

Donā€™t get me wrong, and doesnā€™t do a fraction of what EC does. But, it was very little effort and it does exactly what i need it to do.

Edit: just saw you posted a fix. Iā€™m curious, are you on the latest version of home assistant?

Pretty cool. I do wish that a FSM platform was part of home assistant!

I agree. that would be super cool :smiley:

Iā€™m still pretty new to HASS / NodeRED and home automation as a whole, so im still learning here (I only had an house for 5 months). Iā€™m super impressed with the quality of these platforms and the tools available to us here.

Inspired by your tenacity, I tried turning on debugging as well haha. And you are right. It seems like i have exactly the same problem (all my configs are coming through as arrays of individual characters).

So whats the current state?

Iā€™m assuming all the changes are related to the orjson migration in 2023.12 ā€¦ Anybody got it working ?

(Iā€™m stuck on 2023.11 until I can migrate or get it fixed)

Well using a config like this seems to make things work once again ā€¦ so Iā€™ll call it a win :slight_smile:

Hi. I have a problem and cannot get my head around it. Iā€™m unsure if itā€™s even possible with Entity Controller.

Letā€™s say I have during the evening night a light that is on but on a low dim level, e.g., at 10%. Now, when motion gets detected, it should dim up to 50% and after the timeout go back to 10%. So essentially what I would like to do to define a on state/dim level for the night, and EC should only dim up to that level if the current dim level is lower, like 0%-50%. If the dim level is already higher then the desired one (50%), EC should do nothing.

Is it possible to build something like this with EC?