blakeblackshear / frigate-hass-addons

Frigate hass.io addons
MIT License
250 stars 133 forks source link

Name of frigate "full access" addon in Home Assistant breaks automated restart of addon #133

Open mesistostefre opened 1 year ago

mesistostefre commented 1 year ago

In Home Assistant the addon will be named something like "ccab4aaf-frigate-fa". Using HA OS 2023.9

Now: if you create an automation (e.g. using the HA UI) that simply wants to restart the addon, it will fail with an error. Same thing if you execute the restart by calling the service to restart the addon. Side note: restarting using the Frigate addon's UI works fine.

The issue is the name of the addon. More specifically the second '-' in "ccab4aaf-frigate-fa". Home Assistant will create a slug that is "ccab4aaffrigate-fa" by replacing the first '-' with a ''. The remaining '-' makes the slug invalid.

I do not know if this something to be resolved in HomeAssistant or in Frigate (full access). I did raise the issue in HA Core as well: [https://github.com/blakeblackshear/frigate-hass-addons/issues/133] Update: The HA Core team declined the issue and advised to get it changed in the Frigate HASS addon.

Simplest workaround seems to be: rename the full access version of the addon to something like "ccab4aaf-frigatefa".

-

I'd appreciate some hint if I can somehow rename the addon in a HA instance directly. I doubt it but wanted to ask ... and am afraid of side effects

NickM-27 commented 1 year ago

This would be a pretty big breaking change, every user's frigate integration would be broken and would need to be removed and resetup.

mesistostefre commented 1 year ago

While true, what's the alternative? If there is any workaround to restart the addon through a service/automation: all good. Like: the button in the addon's UI works fine. So: how does the button do it?

Otherwise this needs a fix sooner or later anyways.

Reinstalling Frigate is not all that complex once you moved your frigate.yaml(s) aside. ;-)

ClassicGOD commented 1 year ago

This would be a pretty big breaking change, every user's frigate integration would be broken and would need to be removed and resetup.

While this is true I would assume that every Frigate user can handle setting up integration again given the fact that Frigate needs some skills to get set up in the first place. Right now the add-on is not compatible with HA 2023.9 and while it works who knows if update or two down the road Supervisor will start to refuse starting the add-on at all or the ingres stops working and in my eyes that would be a bigger issue than having to set up integration again.

NickM-27 commented 1 year ago

The issue with resetting up the integration isn't because some users might have difficulty. It's that all changed entities, all enabled entities that are disabled by default, etc will be reversed and that may break automations if users don't remember all that was done. And regardless that's a bad user experience.

There's also no confirmation that this isn't just a bug or something the supervisor can work around

Frigate can already be restarted using MQTT restart topic and in the next version of the integration there will be a button as well

mesistostefre commented 1 year ago

The issue with resetting up the integration isn't because some users might have difficulty. It's that all changed entities, all enabled entities that are disabled by default, etc will be reversed and that may break automations if users don't remember all that was done. And regardless that's a bad user experience.

If that's really the case, one can imagine a pre/postprocess that adjusts these entities when installing the new addon.

There's also no confirmation that this isn't just a bug or something the supervisor can work around

Well, the HA Core team confirmed that from their point of view this issue is to be fixed by the owner of the addon. Though, my personal opinion is that the HA Supervisor should be able to deal with multiple '-' in an addon's name. But ... who am I to judge ... it's their call.

Frigate can already be restarted using MQTT restart topic and in the next version of the integration there will be a button as well

Brilliant, thanks. Feel bad I did not consider this. ;-) As ClassicGOD mentioned there still remains the risk the addon won't even get started by the Supervisor in some future release.

Another thought: maybe time is up to consolidate "frigate" and "frigate (full access)" to just "frigate", so that this addon features the switch to gain full access... Less effort on your side as well... ;-) Yes, today's full access users will go through the effort you mention above. One time.

ClassicGOD commented 1 year ago

I can easily see the future that new users will not be able to install the add-on at all due to incorrect name. Don't get me wring. HA 2023.9 is the worst HA update in years. Many undocumented braking changes. None of which are fault of this project.

I need the ability to stop and start the add-on when requested due to Frigate tendency to write to share that is not ready. (from what I can tell, during the shutdown Frigate will sometimes write to already unmounted share so my solution is to stop the add-on few minutes before scheduled shutdown)

mesistostefre commented 1 year ago

I can easily see the future that new users will not be able to install the add-on at all due to incorrect name. Don't get me wring. HA 2023.9 is the worst HA update in years. Many undocumented braking changes. None of which are fault of this project.

Not sure if it is the worst ... but I saw your comment on the issue I raised with the core team (should have been with the supervisor team) and I tend to agree with it.

I need the ability to stop and start the add-on when requested due to Frigate tendency to write to share that is not ready. (from what I can tell, during the shutdown Frigate will sometimes write to already unmounted share so my solution is to stop the add-on few minutes before scheduled shutdown)

Indeed ... in addition I restart the addon in order to switch between different camera settings (.yamls) as frigate does not allow to disable ffmpeg streams at runtime.

While this sounds a bit bad, I'd like to bring across that I really like frigate very much. Absolutely stunning, reliable and fast. Thank you!

NickM-27 commented 1 year ago

If that's really the case, one can imagine a pre/postprocess that adjusts these entities when installing the new addon.

This is still misunderstanding the problem. The issue with different addon is that the hostname changes. Currently the frigate integration doesn't support changing the api host so the integration must be deleted and readded. That action causes everything to be reset to default. There's nothing the integration can do to "adjust to that"

The only way it would work is if the frigate integration supported changing the api host in the config panel (which i believe there is an open feature request for)

Well, the HA Core team confirmed that from their point of view this issue is to be fixed by the owner of the addon. Though, my personal opinion is that the HA Supervisor should be able to deal with multiple '-' in an addon's name. But ... who am I to judge ... it's their call.

Link?

ClassicGOD commented 1 year ago

Link?

https://github.com/home-assistant/core/issues/99912

I think it still might be a misunderstanding (by @mib1185 ) of what the issue really is. I tried to comment with clarification on that issue but it is already closed.

mesistostefre commented 1 year ago

I tried to comment with clarification on that issue but it is already closed.

My bad, too quickly accepting the response :-(

ClassicGOD commented 1 year ago

Looks like we have a fix via https://github.com/home-assistant/core/pull/100070 just need to wait for 2023.9.2 to drop :)

ClassicGOD commented 1 year ago

Well HA Core 2023.9.2 dropped few hours ago and it looks like my automatons are working again! 🎉

mesistostefre commented 1 year ago

Indeed! MIne too. I removed the workaround of restarting through MQTT. Which was a bit ugly anyways and the "restart" was rather a "stop" relying on the switch in the addon's UI to "restart once crashed".

Much better now