[Custom component] Bird Buddy smart bird feeder

Bird Buddy is a smart bird feeder that can take pictures of birds that visit the feeder, and uses AI processing to identify the bird.

This is the first iteration of a custom component to integrate with the feeder (and it’s also my first Home Assistant integration). The repository, which can be added directly via HACS, is: GitHub - jhansche/ha-birdbuddy

As of now, the only entity exposed by the component is the battery level.

And one other thing to note: it supports email+password login, so it cannot authenticate to an account that was registered using SSO (Google, Facebook, etc). There is a (mildly annoying) workaround though: you have to register a new account using email+password, and then invite that new account to your feeder from the main owner account.

7 Likes

As of v0.0.4 (prerelease, so requires adding to HACS with the beta option enabled), we now have:

  • Battery percentage sensor
  • Charging binary sensor
  • Feeder state sensor
  • Wifi RSSI sensor
  • Media browser of collected bird species

There’s still no automation of opening postcards, so the media browser will only show birds you’ve already collected in the BB app. That is planned in the future, but it’s kind of a pain to do, due to the way the postcards have to be converted, and bird species selected, then finalized. There’s also no realtime notification of new incoming postcards, so all we can do is identify new postcards in the feed on the 10-min polling interval.

1 Like

Hello, I came here to party. I just got two bird buddies. I’m going to give this an immediate go. Willing and able tester for any beta code. I’ll report back when I have it running.

I got this working and it works great. Thanks!

1 Like

Awesome, thanks for reporting back!

I may ask you to do some testing of some of the owner functions, since my owner account was created using Google SSO and I haven’t got a good way to do that yet. If you used a password for your owner account, can you confirm that the Device Info screen shows the firmware version?

I might just delete my account and start over with a password… Sucks that I’ll lose my collections, but also sucks that I don’t have access to the owner functions.

Confirmed it matches whats in my bird buddy app

The only trouble I had was it wasn’t clear that there were two fields asking me for email and password but I think it was a result of my HA theme.

I have another bird buddy but I’m currently working with support because its not connecting to wifi

1 Like

Hi!
Just received ours and the HA Integration works fine. We had a dedicated account for BirdBiddy so we don’t use SSO.
HA states match with the BB App, it is working perfectly.
Just a quick question: what are the different possible states?
Great job! Happy to help and run some tests.

Possible feeder states can be found here:

  • READY_TO_STREAM
  • TAKING_POSTCARDS
  • OFF_GRID (owner-only)
  • OFFLINE
  • DEEP_SLEEP
  • FIRMWARE_UPDATE (owner-only)
  • ONLINE
  • OUT_OF_FEEDER (owner-only)
  • STREAMING

The owner-only states are only available to the original Bird Buddy owner account (the one that paired the Feeder), not visible to secondary invited accounts. In that case, the OUT_OF_FEEDER and “OFF_GRID” states for example will appear simply as “OFFLINE”.

The (English) strings of those states and other labels were recently fixed, and will be available in the next version.

These options have been updated, and the feeder state sensor has been updated to list available options (which are made listed in the entity attribute “Options” automatically):

DEEP_SLEEP, 
FACTORY_RESET, 
FIRMWARE_UPDATE, 
OFFLINE, 
OFF_GRID, 
ONLINE, 
OUT_OF_FEEDER, 
PENDING_FACTORY_RESET, 
PENDING_REMOVAL, 
READY_TO_STREAM, 
STREAMING, 
TAKING_POSTCARDS, 
UNKNOWN,
3 Likes

I am failing prio entering the credentials. I added the repo to HACS. Restartet HA. INstalled the integration in settings. and got this error. Any hints what I am missing?

Fehler
Der Konfigurationsfluss konnte nicht geladen werden: {"message":"Invalid handler specified"}

I’ve responded to your Github issue - let’s continue there.

I think that issue is resolved - I think the problem is that I had marked all current tagged versions as “pre-release”, which makes HACS unsure which version to install. Pre-release versions can be used in HACS, if you select the “Beta” toggle in the “Redownload” dialog. But it seems if there are only pre-release versions, then it seems to default to installing the main branch. Code gets committed to the main branch before it is ready to be used publicly, as it may depend on new code added in the pybirdbuddy library, which may not have been published to PyPI yet. So if it got installed from the main branch, there is a good chance that it would not work correctly (sometimes it might, such as right now since I’ve just released v0.0.5, so the main branch is up to date).

The simple fix is to go to the “Redownload” dialog and select a specific version. As of now, the latest non-beta version is v0.0.4. The latest beta version is v0.0.5.

I’ve since promoted the v0.0.4 version to full release, on the assumption that HACS gets confused if there are only pre-release tags available. So with v0.0.4 marked as released, it should in theory default to that version for new installs now.

1 Like

Just as a summary. Integration works now as expected. Big thank you to the maintainer/creator. The level of support in this OpenSource community is outstanding. Thank you!

1 Like

Bird buddy is now live. First visitors recorded. Is there a chance to consume the postcards in HA and show it in a dashboard?

Looks like this would be the right card … but it requires a dedicated sensor from bird buddy to get working.

custom-cards/upcoming-media-card: :tv: A card to display upcoming episodes and movies from services like: Plex, Kodi, Radarr, Sonarr, and Trakt. (github.com)

1 Like

As of v0.0.5, there are now events and device triggers you can use in an automation when a new postcard is detected, as well as a service that attempts to auto-collect the postcards:

And there is an open feature request to expose the last seen image like you’re proposing, as well as an idea that allows using the downloader service to automate downloading the latest postcard media yourself: Surface last-seen media · Issue #4 · jhansche/ha-birdbuddy · GitHub

Unfortunately most of these features I haven’t been able to test very thoroughly, because we haven’t had a visitor in over 2 weeks 🫣

The event will trigger on any existing unopened postcards on startup, and then any newly incoming postcards thereafter.

1 Like

Love it. My attempt would be to look into the radarr plugin or the others which can be used with the upcomming Media card. Perhaps we can use the same prinicples for the bird buddy postcards.

I probably wouldn’t go in the direction of “upcoming media” - it doesn’t really seem to apply here, and reusing it would likely be a misuse of the card’s intention.

I think a more appropriate solution would make the “latest postcard cover media” available directly from the Media browser, or by setting the URL to an entity’s entity_picture attribute, which you could then use as the media source for a Picture Entity card, or a Picture card. This would be a lot more portable.

Using the downloader service example linked above, I believe you could already do this using a Picture card. Unfortunately you can’t get around downloading the image, because the URLs provided by Bird Buddy have an expiration attached to them, so once the link expires the URL won’t be valid anymore. If you download the image however, then the downloaded media can continue to be used after expiration.

OK. I gave it a try. This is what you need it your config:

the download integration

downloader:
  download_dir: www

create a subfolder in /config/www/ named birdbuddy

# mkdir /config/www/birdbuddy

an automation which downloads the file:

automation:
- alias: Collect Bird Buddy Sightings
  id: "cdefec00-9506-4711-ae8f-c9451f87b18e"
  trigger:
    - platform: event
      event_type: birdbuddy_new_postcard_sighting
  action:
    - service: birdbuddy.collect_postcard
      data_template:
        strategy: best_guess
        postcard: "{{ trigger.event.data.postcard }}"
        sighting: "{{ trigger.event.data.sighting }}"
    - service: downloader.download_file
      data:
        url: "{{ trigger.event.data.sighting.medias[0].contentUrl }}"
        subdir: birdbuddy
        filename: last_postcard.jpg
        overwrite: true
  mode: single

a picture card in your dashboard:

type: grid
columns: 2
title: Bird Buddy
square: false
cards:
  - type: picture
    image: http://Your_HA_IP:8123/local/birdbuddy/last_postcard.jpg
    tap_action:
      action: none
    hold_action:
      action: none
  - type: entities
    entities:
      - entity: sensor.annikas_bird_buddy_battery
        name: Batterie
      - entity: binary_sensor.annikas_bird_buddy_charging
        name: Ladestatus
      - entity: sensor.annikas_bird_buddy_signal
        name: Signal
      - entity: sensor.annikas_bird_buddy_state
        name: ' '
        icon: mdi:bird

I manually copied the file from the first postcard to the birdbuddy folder. This is how it looks:
image

This is UNTESTED, as I have not received a 2nd postcard yet. Will keep you posted.

1 Like

That is awesome! Thank you for sharing your config!
Feel free to add that info to Surface last-seen media · Issue #4 · jhansche/ha-birdbuddy · GitHub above - or I can add it if you don’t want to.

This is a great workaround. In the future I’d like to make it much easier :slight_smile:

Nice! I’ve been at this as well. :slight_smile: Created a similar config… However, the picture does not get updated for me (or rather the picture in the picture card does not, the actual picture file does). Does your picture change if the “last_postcard.jpg” is replaced?

  - type: custom:mushroom-title-card
    title: ''
    subtitle: Snilles Bird Buddy
  - type: grid
    columns: 2
    square: false
    cards:
      - type: picture
        image: >-
          http://your.ha.url/local/birdbuddy/last_postcard.jpg
        tap_action:
          action: none
        hold_action:
          action: none
        alt_text: Fågelbild här...
      - type: vertical-stack
        cards:
          - type: custom:mushroom-entity-card
            entity: sensor.snilles_bird_buddy_state
            name: Status
            icon: mdi:information
          - type: custom:mushroom-entity-card
            entity: sensor.snilles_bird_buddy_battery
            name: Batteri
          - type: custom:mushroom-entity-card
            entity: binary_sensor.snilles_bird_buddy_charging
            name: Laddar
          - type: custom:mushroom-entity-card
            entity: sensor.snilles_bird_buddy_signal
            name: Wifi-styrka

image

2 Likes

I have not yet have a 2nd visit to the bird buddy. Cant tell. If its not working for you … it will not work for me as well. Will need to look into this. It could be that the trigger is not the right one. I can only look into this next week again. AFK now. Sorry.