[Custom component] Bird Buddy smart bird feeder

@madcoder thank you for the integration :heart:

Just one question. Do you know what does this new Frequency entity represent?

image

No, and I don’t see it surfaced in the app either. I assumed that it has something to do with a planned feature to control the frequency of postcards, making it more or less sensitive. Until we see it in the apps, we won’t know for sure. It is a feeder setting (not a user setting), but that’s all I know.

When I do find out, I’ll update the sensor name to be more informative.

Edit: I did look into the app resources, and I see a couple strings that mention “frequency”, but nothing that sheds any light on what it actually does. I see things like “Feeder frequency changed to high”, “Long battery life, low frequency”, and “Low battery life, high frequency”. So I think this implies it has something to do with adjusting the sensitivity or threshold for the camera to start taking postcards (where high uses more battery, and low conserves battery).

1 Like

@rak and @Snille
After some testing with the new “Recent Visitor” sensor, this can be done without having to manually download the postcard picture anymore, by using the Generic Camera integration. You just need to enable (can remain hidden if you want) the Recent Visitor entity, by going to the Device Info screen. It is disabled by default.

Link to add Generic Camera:

For “Still Image URL”, use a template to select entity_picture from the Recent Visitor entity (replace the entity name to match yours):

{{ state_attr('sensor.your_bird_buddy_recent_visitor', 'entity_picture') }}

Submit this, and then it will display a preview image (depending on if the sensor has been populated already) – If the Recent Visitor entity has a picture currently, this will show the full size image. Check the box and click Submit.
The option does not appear in the initial “Add” screen, but after the camera is added successfully, you can go back into the “Configure” screen and check the box for Limit refetch to url change. That checkbox will prevent it from reloading the same image URL - instead, when a new bird comes, the sensor’s entity_picture will change and that will trigger the Generic Camera’s image to update, which will cause it to fetch the new image.

Note that unfortunately it builds the entity_id from the image URL at the time your add the integration, so that will make the entity id really complicated (i.e., camera.media_app_api_graphql_app_api_prod_aws_mybirdbuddy_com). You can rename the entity and entity_id after it’s created, if that bothers you (or you can configure it in configuration.yaml, but you will get a warning in this case, because they want to convert everything to the config_flow UI).

Once the camera is created and working, you can use the picture-entity card to display the image with the bird name under it, by specifying the new camera entity in the card:

type: picture-entity
# entity will show the "recent visitor" state, which will be the species name of the bird
entity: sensor.elm_bird_buddy_recent_visitor
# only makes sense with state=true, because it shows that^ bird species name
show_state: true
# name is up to you - by default if this is true, it will show "<Feeder Name> Recent Visitor" on the bottom/left of the image.
# if false, it will just center the bird species at the bottom.
show_name: false
# the new generic camera entity:
camera_image: camera.media_app_api_graphql_app_api_prod_aws_mybirdbuddy_com

Excuse the blurry picture, but it will look something like this (this is with show_name=true):

I started trying to make my own camera entity that “wraps” the generic camera, and that more or less works - but it feels clunky still. Maybe in a future version.

And I’ve recently fixed an issue where the entity_picture URL might expire, which will just show a black/broken image. After the next update, those URLs will automatically refresh when it expires.

4 Likes

I got this working, thanks!

1 Like

@Snille thanks again for the translations. I’ve added a PR for that here: Add Swedish translations [thanks @Snille] by jhansche · Pull Request #24 · jhansche/ha-birdbuddy · GitHub.

But unfortunately I don’t know how to allow you to test that easily without jumping through hoops :roll_eyes: In ESPHome there’s an easy way to do this, but in HACS even with the “show beta versions” option enabled, I only see the last 5 tagged releases, and the “main” branch, but no easy way to test a feature branch before it merges.

The only way I can think to test it now would be to manually copy that json file into your config dir: /config/custom_components/birdbuddy/translations/sv.json and restart HA. This is the first translation added, and there doesn’t seem to be a lot of dev tools for supporting it.

I can also just merge it and check it out in the next release :man_shrugging:

Merge away! :slight_smile: I’ll test and report back if something looks strange. :slight_smile:

Just noticed that my fix for renewing an expired entity_picture URL is not working quite right - basically it does remove an expired URL, but does not refresh the URL as expected. It would renew when reloading the integration or restarting HA; and when it will query the attribute it will basically clear it if it’s expired (so you’ll never access the attribute and receive an expired URL - it’ll either be working or empty).
However, with the Generic Camera mentioned above, the camera entity will retain the image bytes of the last seen URL - so even if it does expire, the image will be retained in this case. I think that’s a useful compromise for now, until I work out a long term solution.

I noticed this today but wasn’t sure if it was because I marked the squirrel as a mystery guest🤣 i was gonna wait for another visitor before I reported it for sure.

I gotta tell ya, every time I see a bird face on my dashboard, I just smile. I’ll likely start sending these to all the echo shows and refrigerator. I’m really pleased with this integration; it helps me maximize my personal benefit of the bird buddies.

2 Likes

I totally agree on the “smile-part”, I’m working from home a lot and every time I walk by my MagicMirror (build album here) I see a new “guest”. It’s just great! Thank you @madcoder for making this integration!

Here is the last visitor for today:

2 Likes

That’s so cool! I’m glad it’s getting some good use :smiley: Y’all are getting way more birds than I am :laughing: Last visitor I had was over a week ago.


There is one other thing I want to test, if anyone is willing to help. I’d like to see what happens when there are 2 feeders on one account. I designed it in a way that it should work for that, but I haven’t been able to test it myself. I do have a 2nd feeder, but that one is destined to be a gift, so I haven’t set it up.

If anyone already has 2 feeders on one account, what has your experience been? Any weirdness or anything unexpected?

If not, if someone is willing to help me test that, and doesn’t mind PMing me an invitation code to use temporarily, that would be very helpful. From the Bird Buddy app (on the owner account), go to the settings cog, then click on the feeder name, and under “Manage Members”, click “Add new Member”, copy the invitation code, and PM it to me. When I “redeem” that, it will go back to you to confirm, and then once confirmed, it will become a 2nd feeder on my account. Once I’ve tested the functionality I will remove myself. Also note that this does not affect your postcards or collections in any way (because both of those are associated only with the logged in account, not with the Feeder itself).


Finally, just FYI - there was a 1.1.1 firmware update made available on my Feeder this afternoon, and I’m seeing that the Update entity appeared correctly in HA and showed the correct firmware update as available, however clicking the “Install” button does not work. I’m opening a ticket for that here: Update entity cannot install the firmware update · Issue #28 · jhansche/ha-birdbuddy · GitHub. Just wanted to let everyone know that if you get an error on the next firmware update, that’s why. I will resolve that for the next release. You can either wait for the next release to see it perform the update via HA, or perform the update directly from the BB app.

I have a second BB but it won’t connect to wifi. I’ve been in touch with their engineers every day for a week. They said today that they think they found the problem but it would be a few days before they knew for sure.

I got the new firmware update as well. I received the failed service call for it but I ultimately did my firmware update from BB.

I thought part of my problem was BB didn’t like being on the same network as another BB but I tested against this and got the same results.

So I have another BB that I’m eager to get online but it might be a few days before I find out if this can be fixed with buttons or a new device.

I believe the Update issue was addressed, but my update was already “started” while it was sleeping, so I didn’t get to see the Update entity in action (i.e., with the progress bar and everything). Because it doesn’t seem to wake up the Feeder while it’s in deep sleep mode, I added a check to refuse to start the update if it’s sleeping. This should make it less likely to get into that state where it’s not performing the update, but you can’t request the update because of error 26 (already started). It did finish the update when I brought it inside and put it on the charger, which seems to wake it up. I also noticed that after a firmware update, the Update entity shows the correct firmware version, but the Device Info page does not - so I made a change to update that as well.

Thanks to @Snille for obliging me on my request for guest feeder access. That surfaced a whole bunch of issues related to:

  • Accepting an invitation code that is pending owner confirmation - a lot of entities were showing unavailable in this state. This was fixed by marking those as disabled by default, until the owner confirms the invitation.
  • The Recent Visitor entity wasn’t properly differentiating feeders (so my last visitor showed as the last visitor on his feeder). This was fixed. This was only an issue for the initial visitor lookup via collections (due in large part to the issues described below with the Media Browser, where there’s no easy way to filter by feeder) – A new postcard arriving does get filtered to the appropriate Feeder automatically, because the postcard/sighting data contains the feeder id already.
  • Not sure if this is just a new api behavior, since my Feeder hasn’t got any new visitors in almost 2 weeks, but I saw that his Feeder was providing a different format for the “sighting report tokens”, which are now signed as a JWT token. So I added support for decoding the signed token. This is used when collecting a postcard with an automation using strategy:best_guess, which is when Bird Buddy says it can’t decide what bird it was, but it has a list of best-guess suggestions, each with a confidence level. I use those confidence scores to pick the highest confidence and choose that species. I also added a fallback to picking the top suggestion if the token cannot be decoded.
  • The Media Browser also does not filter species by the Feeder you selected. This one is tricky, and I could see multiple ways to solve it. Right now it doesn’t seem easy to filter media collections to a single feeder, since when you collect a postcard, those media are tied to your login account, not to the feeder. There is an attribution (by feeder name only) association with the CollectionMedia, but not with individual MediaImage/MediaVideo items. I believe this means if you had 2 feeders and both feeders receive separate visits from the same species, I don’t think the app can differentiate which feeder it came from - even though when you click the :information_source: icon in the app it does show the Feeder name. I believe that attribute is not image-specific. It’s hard to say because we don’t have any overlapping species currently.
    One idea to address this could be to remove the Feeder selection from the Media Browser (so it would be just Bird Buddyyour@accountFolders for each speciesImages of that species). That more accurately reflects how the Bird Buddy app shows media collections, and removes the confusion of potentially mixing up images across separate Feeders. Also the majority of people will have just one Feeder anyway, so this extra level of navigation is really just noise – likewise for the account folder, for that matter, since most people will only have one account configured.
    This issue has not been addressed yet.

These changes were released in v0.0.10, which is currently pre-release (so will only appear if you have the “Show Beta versions” option enabled in HACS).

1 Like

Look!

Update works great but my personal feeder is super busy. I miss half the cool faces on my dashboard because they’re hitting the feeder so fast.

Trying to think about easy ways to solve this:
A picture carousel would be nice but I’m not aware of such a module for use with HA. You see these on websites, there will be one main picture and a couple others that you can scroll through. I’m certainly not asking you to build anything like this.

I think we can adapt radial menus to do this where the last picture is the big one in the center and then if you press it, some others can pop out. Say the last 5-10 visits. But in order to do that, we’d need someway for it to be able to track which pics were the last 5-10.

Do you have any suggestions for solving this problem whether through your app or some other adjoining functionality in HA?

I just want to display a few more than only the last visitor because they happen so frequently😀

Love it. I like the idea of rotating throught say pictures of last N hours … or last N pictures.

1 Like

You and @Snille have very active feeders :joy: it’s been over 2 weeks since my last visitor. I’m a little jealous haha. But what you describe is a good problem to have I guess.

If you were using the automation to download the latest postcard instead of the new entity, you could also have that automation move the current file to “previous_1”, and move “previous_1” to “previous_2”, and so on. Then a set of cards in Lovelace to show the “recent” card, alongside “previous_1”, _2, etc. That’s the brute force (aka hack) way.

Longer term, we could use local media aliases, to keep the N most recent images with a predictable media URI. But I wasn’t able to get the picture entity cards to show local media URLs (not sure if I missed it somehow?)… but that would probably be the cleanest way. Still up to you to find the Lovelace card that would be able to show those the way you want.

Ok, now an idea is starting to percolate

If I were to always have the last 10 pics saved, not only can I use them for this purpose (seeing the last few on my dashboard), but I can use the list of 10 to randomize the pic selection and send it to the echo shows and samsung refrigerator (I have scripts set up that auto change the background pictures randomly).

This is my starting point and I need to store 10 pics before I can do anything.

Let me play with the radial menu approach. I don’t have any that use pictures (but I know its possible) and I want to see how it lays out (hopefully not tiny pics).

I would definitely need help with a way for it to auto-rename the pics so the 11th one gets purged and then the displayed picture is always in reverse chron. What you said sounds good, I just don’t know how to execute that on my own.

I’ll report back on the radial menu

EDITRadial menu will not work for this. You can enlarge icons but not pics:
2023-01-21 15_39_01-Greenshot

2023-01-21 15_39_43-Greenshot

repo: GitHub - iantrich/radial-menu: ⭕ Radial Menu Element

Had much less at the beginning. Added this. You have a 3D printer?
Bird Buddy Fence by TheIrishWolf - Thingiverse

1 Like

mad-tv
I have a printer!

Thanks for this component! I have my buddy for a week now and was hoping this existed, and look! It exists AND is very active, thank you! :slight_smile:

@madcoder one question, when do the sensor become available? I added my account to HA and this is what I see:

Only the update and Battery sensors are present

Nevermind… I had to enable them of course