Image cropped in notifications

Hello,

I send a camera snapshot when my doorbell (unifi doorbell g4) rings to my mobile android phone. Problem is the image shown in the notification is cropped. I read this is an issue about image ratio not being 2:1. Seem like I could make it work with the camera proxy component but I was not able to make it work right.

try Home Assistant Companion Apps: New and Upcoming Features - #48 by joax01

Yeah this is one of the posts I already seen. Unfortunately, it doesn’t resolve my issue.

Sorry to bump but I still have this issue :frowning:

how did the above post not solve your issue? did you play with the settings of the width?

I added this to my home-assistant.yml:

camera:
  - platform: proxy
    entity_id: camera.sonnette_high
    name: sonnette_high_android_notification
    max_image_width: 192
    image_quality: 50

Then in my node-red automation I have this:

{
    "title": "Sonnette",
    "message": "{{ payload }} détecté",
    "data": {
        "channel": "Sonnette",
        "notification_icon": "mdi:doorbell-video",
        "image": "/api/camera_proxy/camera.sonnette_high_android_notification",
        "actions": [
            {
                "action": "URI",
                "title": "Voir caméra",
                "uri": "entityId:camera.sonnette_high"
            }
        ]
    }
}

Image is still cropped on my Android phone :

(gray rectangle added to mask others notifications)

Try different max_image_width options, if you look at the post you referred to you’ll see that user did some math for their own camera resolutions to get the ratio to match their expectation. The user did this in a few posts above, you’ll want to follow the conversation. You need to provide a value that will result in a 2:1 ratio for your camera. I would also test teh camera snapshot feature to see if the ratio is different then too.

I don’t really understand how he found his 192 pixels value. He talks about resolutions of 640x480 and 1024x768. Both are 4:3 ratio. My camera also have a 4:3 ratio with a 1600x1200 resolution.

I tried this:

camera:
  - platform: proxy
    entity_id: camera.sonnette_high
    name: sonnette_high_android_notification
    mode: crop
    max_image_height: 800
    max_image_width: 1600
    image_top: 200

This give me an image of 1600x800, 2:1 ratio, but image still cropped in phone notification :(. Don’t know what I do wrong…

EDIT: interesting, if I remove the actions buttons, the image almost show in full with the configuration I just pasted. Seem like the total height a notification can take, including buttons is limited.

Can confirm, I’m trying it now but once I include actions I’m missing the top and bottom, and therefore sometimes cutting off whatever triggered motion. Looking for a fix ATM.