mmcc-xx / WhosAtMyFeeder

316 stars 15 forks source link

[Feature Request] Within Home Assistant, enable ability to set up alerts for certain species #45

Open rw377 opened 4 months ago

rw377 commented 4 months ago

In the logs of the HA addon, it shows species identification such as Category(index=68, score=0.8046875, display_name='Cardinalis cardinalis', category_name='/m/01tgcy'). It would be great if we could have this translated to Home Assistant in some way so that we can set up alerts to be identified if the bird of X species. I'm not sure if this falls under this addon specifically or would be under Frigate. Is this possible to do?

alfista2600 commented 4 months ago

just found this project... even just posting the json of species identification back to a MQTT topic would be huge. I'm going to see if I can make that happen myself if I can find some time.

alfista2600 commented 4 months ago

As a quick, ungraceful hack I followed these steps to get it to publish the common name to a MQTT topic. 1 - log in to docker shell 2 - run 'apt install nano' unless you want to fight with vi 3 - insert this as line 149: client.publish( 'whosatmyfeeder/detections', get_common _name(display_name), qos=0, retain=False) 4 - save and restart the container 5 - create a generic MQTT device using the topic you specified above (whosatmyfeeder/detections in my example, I use openHAB which would be a Thing and a linked Item, unsure about HA) 6 - write rules that trigger when item is updated

rw377 commented 4 months ago

As a quick, ungraceful hack I followed these steps to get it to publish the common name to a MQTT topic. 1 - log in to docker shell 2 - run 'apt install nano' unless you want to fight with vi 3 - insert this as line 149: client.publish( 'whosatmyfeeder/detections', get_common _name(display_name), qos=0, retain=False) 4 - save and restart the container 5 - create a generic MQTT device using the topic you specified above (whosatmyfeeder/detections in my example, I use openHAB which would be a Thing and a linked Item, unsure about HA) 6 - write rules that trigger when item is updated

Thank you for this. I'm running into issues getting apt to work inside the HA container so can't get nano or other text editors currently, I will have to mess around with it. This seems like an easy addition to the addon though hopefully we can get this added at some point!

alfista2600 commented 4 months ago

Sorry - I forgot HA does things a little different. Don't really use but have tinkered. If you have the terminal add-on installed, and can find the speciesid.py file (which I notice now I didn't specify above) you should be able to add the code. Fight with vi if you can't install nano (or it is not already installed).

rw377 commented 4 months ago

Sorry - I forgot HA does things a little different. Don't really use but have tinkered. If you have the terminal add-on installed, and can find the speciesid.py file (which I notice now I didn't specify above) you should be able to add the code. Fight with vi if you can't install nano (or it is not already installed).

Thanks for specifying the file. I don't mind using vi if I have to (though would prefer nano) but it seems like the container within HA doesn't have permissions to download anything even though I'm root. I'm not great with docker so maybe I am missing something but seems like this is the case here and don't think I can change it since I don't have access to the Docker make file. I'm thinking I would have to install the container on a standalone server and edit it there (unless this change got pushed into the actual addon).

image

EDIT: Yeah after hosting the docker container on my own server I can install nano and edit the file no problem. Also, I believe what you wrote has a space that shouldn't be there: get_common _name(display_name) should be get_common_name(display_name)