custom-components / pyscript

Pyscript adds rich Python scripting to HASS
Apache License 2.0
892 stars 47 forks source link

Repairs showing in homeassistant for each pyscript service #635

Open mark007 opened 1 month ago

mark007 commented 1 month ago

I declare many pyscript scripts as services, and they all work great, however each time HA boots it reports them as an issue that has to be repaired. When mentioning this in the HA discord, the suggestion was to raise a ticket here to see if it can be resolved. See a screenshot of what I see each time my HA boots.

https://ibb.co/kGbGvYP

craigbarratt commented 1 month ago

This looks like a startup race condition where the automation is checked for errors before pyscript has started. pyscript doesn't run the user's scripts until HASS issues the EVENT_HOMEASSISTANT_STARTED event. We'd have to figure out how to have the startup checking happen after pyscript is initialized. I didn't want to start pyscript earlier than EVENT_HOMEASSISTANT_STARTED since the user's scripts might need other components loaded, and that's not guaranteed until that event occurs.