Fix update on cert_expiry startup#27137
Conversation
|
I'm guessing the receiving server didn't like to accept multiple connections from the same source in quick succession, rejecting the new connections and causing the entity to fall into a bad state. It sounds like they updated fine at the next 12 hour update. |
|
Yeah I think we shouldn't update twice close like we do now. But which update should we remove? |
|
The self-connecting scenario is one I hadn't considered. Probably should swap back to updating when HA is fully started. I'll do that shortly. |
|
Yeah. Let's create the entity as available and remove the update during entity addition. Keep the update on home assistant start. The entity will then be created with unknown state. When the first update happens, either on home assistant start or 12 hours after creating the entity, the entity will get correct state. I guess we could add some more complex logic in |
|
To solve the problem with importing the config yaml, we could schedule the import on home assistant start event. |
|
Do you want to change config yaml import scheduling in a separate PR? |
|
I removed that since it didn't seem necessary anymore with the conditional updates when the entities are added. Do you think something is still needed there? |
|
You're right, I forgot the import would attempt to validate the configuration. If it was checking itself this would cause the import to fail. Updated the import step to delay until HA is fully started. |
Description:
Cert Expiry sensors are now updated when the entities are created if home assistant is running or at home assistant start if home assistant is not running yet.
Import of config yaml is delayed and done at home assistant start, to avoid issues with checking certificate served by home assistant.
Related issue (if applicable): may fix #26740
Checklist:
tox. Your PR cannot be merged unless tests pass