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: Check override entities when entity controller starts #285

Open
ndbroadbent opened this issue Sep 19, 2022 · 4 comments
Open

Comments

@ndbroadbent
Copy link
Contributor

I saw your comment about the current behavior: #231 (comment)

But I would like to request a change to this behavior. If I am working on my entity controller config at night time, then I have to be very careful about restarting Home Assistant, because the controllers will no longer be overridden. So motion sensors will cause our bedroom lights to turn on, which is not good if my wife is sleeping. I think it would be reasonable to start the entity controllers in an overridden state if an override sensor is on when it starts.

I've noticed a similar edge case when an entity controller goes from overidden => idle, but a motion sensor was already on. In that case I think it would be nice to transition from overridden => active timer and turn on the light.

@danobot
Copy link
Owner

danobot commented Sep 20, 2022

If someone is going to implement this, I'd be happy to review and merge those changes.

@ndbroadbent
Copy link
Contributor Author

Thanks @danobot! I am still very interested in this since it's still causing problems when I restart Home Assistant.

Home Assistant restarts will always cause inconsistent behaviour because HA itself is reinitialising.

Yes, the entity states getting initialized are also causing entity controllers to get triggered.

I fixed this for some of my other automations by adding initial_state: 'off', and creating another automation that waits for 45 seconds after home assistant starts before enabling those automations.

Would it be possible to set a similar delay before creating the entity controllers? Maybe could add a configuration option for "ignore state changes for x seconds after starting"

@ndbroadbent
Copy link
Contributor Author

ndbroadbent commented Nov 23, 2022

@danobot I finally came up with a solution, and this seems to be working very well for me: #292

Now I can safely restart Home Assistant, and entity controller will ignore all the state change events while everything is initializing. The only problem is that I needed to hard-code a startup delay in a constant. Is there any way we can configure some global settings for all entity controller instances?

@danobot
Copy link
Owner

danobot commented Nov 29, 2022

I'm pretty sure there is a function Home Assistant calls on the entity after it is registered . You can run your code within that function. It's better than relying on a fixed timer.

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

2 participants