mmcc-xx / WhosAtMyFeeder

328 stars 17 forks source link

Wrap this as a home assistant addon? #5

Open bertybuttface opened 1 year ago

bertybuttface commented 1 year ago

Hello,

Great work on the project. It feels like this might see more widespread use and be easier to install for beginners if we wrapped it as a Home Assistant Addon.

You can see some examples at my (or many others) Home Assistant Addons repository: https://github.com/bertybuttface/addons

I'm happy to assist with this.

Cheers

mmcc-xx commented 1 year ago

Awesome - thanks. I'll take a look and try to understand what is involved. I think I'd like to combine the other app I'm working on, which detects birds by sound, into one bird detection system and make an overall addon.

mmcc-xx commented 1 year ago

Actually maybe it would make sense to add-on ify this before trying something grander. What do you think it would look like? Would do you think it would expose to the HA environment?

bertybuttface commented 1 year ago

So the Home Assistant Addon would just run this web app as normal. The interface would be the same as it is right now but it would appear as a tab in Home Assistant using ingress. The goal would be to simplify installation and usage.

The next thing we could do is consider a Home Assistant Integration which would actually pull the data from this app into Home Assistant to use in a useful way. It may be however that this is not useful so we don't build the integration at all.

I'm not sure exactly how it works but I think with Frigate you can extend detections with extra data. That might be nice if it is not done already.

mmcc-xx commented 1 year ago

So if it is installed as an addon, can it still run in a container or does the code need to be executed in the OS directly?

I'm not sure exactly how it works but I think with Frigate you can extend detections with extra data. That might be nice if it is not done already.

I didn't know that was possible. I'll look into this. If you have link handy for someplace this is discussed that would be helpful.

Right now, I'm just monitoring the "snapshots" MQTT publications but I was thinking of switching to monitoring events instead so the detections could be associated with a specific event, and probably just store photo with the best score for a given event.

bertybuttface commented 1 year ago

Still runs in a container, I'll have a go at knocking up an example.

bertybuttface commented 1 year ago

https://github.com/bertybuttface/addons/tree/main/whosatmyfeeder

Not tested yet but that is the general gist of it.

mmcc-xx commented 1 year ago

So part of the reason I'm pretty ignorant of HA addons is that I run HA via Docker and as such don't have the full addon UI available. When I've installed addons it is via copying a directory into my HA custom components directory, like this one for the Frigate add on: https://github.com/blakeblackshear/frigate-hass-integration/tree/master/custom_components

Do you know how I'd go about installing the add on you made?

bertybuttface commented 1 year ago

Ah yeah I think you are conflating two concepts:

Integrations (which are either in built components or custom components)

and

Addons (which are separate Docker containers that don't even need to directly interact with Home Assistant)

The link above (build is broken, I'll take a look later) probably isn't that useful to you if you already run under Docker.

I'll take a look at getting these bird species detections into Frigate using Sub Detections but that is probably best handled under a separate issue.

We can also take a look at a Home Assistant integration (and a lovelace card to display the data) but I'm not fully sure how that would look right now.

mmcc-xx commented 1 year ago

Ah yeah I think you are conflating two concepts:

Ohhhh...... I thought they were the same thing :)

If you want to build the addon, I'm happy to pull it in (or reference your repo if you'd prefer). But since I'm not really set up to test it or document it, I'll have to ask you to do so.

bertybuttface commented 1 year ago

Absolutely no problem, happy to maintain the HA Add on, I'll put in a pull request with a link once it's working, cheers.

hermy65 commented 1 year ago

@bertybuttface is the hass addon functional? I added your repo and installed it but it crashes on startup without a config.

bertybuttface commented 1 year ago

Not yet I'll push what I have so far.

bertybuttface commented 1 year ago

@hermy65 happy to report this now works (or at least it gets as far as displaying the web UI, I've not seen any detections yet)

rw377 commented 1 year ago

happy to report this now works (or at least it gets as far as displaying the web UI, I've not seen any detections yet)

Probably a dumb question, but what is the proper repo URL to add the HASS addon? I'm getting errors in Home Assistant when trying to add it from your addon list using https://github.com/bertybuttface/addons/tree/main/whosatmyfeeder (or https://github.com/mmcc-xx/WhosAtMyFeeder/)

bertybuttface commented 1 year ago

That's the correct link. What processor architecture are you using? (e.g. i386, arm64 etc)

What is the error message you are getting?

bertybuttface commented 1 year ago

Oh sorry you need to add the whole Addon Repo if that's what you mean:

https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fbertybuttface%2Faddons

rw377 commented 1 year ago

Oh sorry you need to add the whole Addon Repo if that's what you mean:

https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fbertybuttface%2Faddons

Ahh duh okay, that worked, thank you!

bertybuttface commented 1 year ago

Great! Let me know if you get any trouble with it. I can see roughly 30 to 50 people are using the package but I've not had any bug reports. I suspect there are at least some rough edges so I'd very much appreciate hearing about any you run into so they can be fixed.

rw377 commented 1 year ago

Great! Let me know if you get any trouble with it.

Since you mention it, I did notice something today. I can add this as a separate issue on your repo if you want rather than continue this thread. But the TL;DR is that if I click in to a bird in 'Detection Summary', I get a list of birds but the thumbnail is broken and if I click the broken thumbnail, the video doesn't work. The thumbnails and videos work fine on the main page under "Recent Detections" though. I did try an incognito browser to ensure it wasn't a cache thing too.

Main page / recent detections working: image

Clicking into detection, the thumbnails/videos are broken: image

I really appreciate you making the HASS addon! And of course I really appreciate mmcc-xx's work on the addon as a whole too, it's all such a cool project.

Edit: Side question - would it ever be possible to have HASS know the species found from Who'sAtMyFeeder or would that require a separate HASS integration?

bertybuttface commented 1 year ago

Will take a look at that this week, thanks for the bug report. That is related to the relative / absolute URL issue, at the moment my temporary fix is a massive hack, will put something better in place.

It is indeed a very cool project, I hope the home assistant addon makes it easier to install for more people.

tamueller commented 7 months ago

@bertybuttface thank you for developing this addon, would have loved to use it to get an easy access to WhosatMyFeeder.. Too bad it's deprecated. Would you be willing to explain roughly what would be necessary to fix the addon integration, so maybe I (or someone else) can take over?

bertybuttface commented 7 months ago

Please see my response here:

https://github.com/mmcc-xx/WhosAtMyFeeder/issues/42

bertybuttface commented 7 months ago

I pushed version 1.1.0 give it a go and see if it solves your problems.

@rw377 @tamueller

rw377 commented 7 months ago

I pushed version 1.1.0 give it a go and see if it solves your problems.

@rw377 @tamueller

Thanks for the update. I am getting an error when trying to update via the addon. Is there a different way this should be done? image

bertybuttface commented 7 months ago

Apologies the build system hadn't been updated in a while so it couldn't build 1.0.0

I have pushed out 1.1.1 which has built correctly and has some extra fixes.

Should all be working now. Might need to refresh (top right corner)

rw377 commented 7 months ago

Apologies the build system hadn't been updated in a while so it couldn't build 1.0.0

I have pushed out 1.1.1 which has built correctly and has some extra fixes.

Should all be working now. Might need to refresh (top right corner)

The update works and the broken thumbnail issue is now fixed also. Thanks for adding this!

bertybuttface commented 7 months ago

No worries sorry it took me so long to get round to it. Thanks for your time helping get this fixed.

tamueller commented 7 months ago

@bertybuttface awesome, thank you for updating this - I just installed it and worked out of the box.

rw377 commented 6 months ago

@bertybuttface What are your thoughts on adding this feature listed in https://github.com/mmcc-xx/WhosAtMyFeeder/issues/45 into the HA addon? It is one line of code that sends an MQQT topic for the species being identified. Is this something you could do or would this have to be pulled into this repo?

bertybuttface commented 6 months ago

@rw377 Sure, I maintain a fork of this project here: https://github.com/bertybuttface/WhosAtMyFeeder

That is what the Home Assistant Addon pulls in. If you make a pull request there with the changes you want (please make sure they are tested, I do not have time to do any testing right now) and I'll take a look.

pack2010 commented 2 months ago

So thankful that this addon exists for those of us who are overwhelmed by starting this whole journey. Unfortunately while I was able to get the addon into my HA, it won't connect to Frigate. My log looks like this

Calling Main Time: 2024-08-21 18:00:17.529 Python version 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] Version info. sys.version_info(major=3, minor=9, micro=2, releaselevel='final', serial=0) INFO: Created TensorFlow Lite XNNPACK delegate for CPU. Starting MQTT (flask disabled, use gunicorn) Starting MQTT client. Connecting to: 192.168.7.126 MQTT Connected

So it connects to MQTT I think but then just stops there. I've been looking but I'm at a loss of what to do now. Would be grateful for any help anyone can provide on this!

bertybuttface commented 2 months ago

So thankful that this addon exists for those of us who are overwhelmed by starting this whole journey. Unfortunately while I was able to get the addon into my HA, it won't connect to Frigate. My log looks like this

Calling Main Time: 2024-08-21 18:00:17.529 Python version 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] Version info. sys.version_info(major=3, minor=9, micro=2, releaselevel='final', serial=0) INFO: Created TensorFlow Lite XNNPACK delegate for CPU. Starting MQTT (flask disabled, use gunicorn) Starting MQTT client. Connecting to: 192.168.7.126 MQTT Connected

So it connects to MQTT I think but then just stops there. I've been looking but I'm at a loss of what to do now. Would be grateful for any help anyone can provide on this!

Until you get a bird in the garden it shouldn't do anything else so this may be correct.

To be honest though this is all now fairly well unmaintained, both the original package and my wrapper.

Frigate have been doing a lot of work lately to change how plugins work (via ZeroMQ now so much more performant), also AI models have improved in the multiple years since this was published.

Once the dust settles at Frigate I will rewrite this and try to get some community involvement for longevity.

Good luck and thanks for your kind message, look forward to hearing more from you.

pack2010 commented 2 months ago

So thankful that this addon exists for those of us who are overwhelmed by starting this whole journey. Unfortunately while I was able to get the addon into my HA, it won't connect to Frigate. My log looks like this Calling Main Time: 2024-08-21 18:00:17.529 Python version 3.9.2 (default, Feb 28 2021, 17:03:44) [GCC 10.2.1 20210110] Version info. sys.version_info(major=3, minor=9, micro=2, releaselevel='final', serial=0) INFO: Created TensorFlow Lite XNNPACK delegate for CPU. Starting MQTT (flask disabled, use gunicorn) Starting MQTT client. Connecting to: 192.168.7.126 MQTT Connected So it connects to MQTT I think but then just stops there. I've been looking but I'm at a loss of what to do now. Would be grateful for any help anyone can provide on this!

Until you get a bird in the garden it shouldn't do anything else so this may be correct.

To be honest though this is all now fairly well unmaintained, both the original package and my wrapper.

Frigate have been doing a lot of work lately to change how plugins work (via ZeroMQ now so much more performant), also AI models have improved in the multiple years since this was published.

Once the dust settles at Frigate I will rewrite this and try to get some community involvement for longevity.

Good luck and thanks for your kind message, look forward to hearing more from you.

Really appreciate the work you've done but understand if it's too much to maintain. There's been quite a few birds that have come that have been detected by frigate but weren't picked up by the add on so I think there's some type of disconnect....oh well. I'll keep a lookout if you work on this more, really love the concept!