H
HASS.Agent•11mo ago
foxed

Adding image from Nest Doorbell to Notification

Hey folks, Thanks for running this Discord, help for dummies like me is always appreciated! I've got HASS Agent all setup, and I'm able to send notifications when my doorbell goes to my Windows desktop. All that works beautifully. I like the fancy option of adding an image and I've been trying to get it working without muck luck and I'm wondering if someone can point me in the right direction. The following is what I've got in the action thus far:
alias: DoorbellNotify
description: ""
trigger:
- platform: device
device_id: 89b25da6b5<redacted>35a4cff4
domain: nest
type: doorbell_chime
condition: []
action:
- service: notify.goliath
data:
message: Someones at the door!
title: Ding Dong
data:
image: /api/camera_proxy/camera.front_door
duration: 30
mode: single
alias: DoorbellNotify
description: ""
trigger:
- platform: device
device_id: 89b25da6b5<redacted>35a4cff4
domain: nest
type: doorbell_chime
condition: []
action:
- service: notify.goliath
data:
message: Someones at the door!
title: Ding Dong
data:
image: /api/camera_proxy/camera.front_door
duration: 30
mode: single
Hope someone can offer some advice 🙂
35 Replies
HASS.Agent Helper
HASS.Agent Helper•11mo ago
Help us Help Others!
To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution
From An unknown user
HASS.Agent Helper
HASS.Agent Helper•11mo ago
Help us Help You!
Please don't delete messages or posts because it makes it impossible to understand what happened. If you don't want your messages to be seen then don't post here.
HASS.Agent Helper
HASS.Agent Helper•11mo ago
@DrR0x
DrR0x
DrR0x•11mo ago
First of all, is the camera proxy properly setup as per the ha docs?
foxed
foxedOP•11mo ago
I'll double check. Thank you. Will come back shortly.
DrR0x
DrR0x•11mo ago
All good it's a common mistake and issue with the old docs 😂 will be adding better wording and guides to the new one once I get around to the notification setup.
foxed
foxedOP•11mo ago
😂 yeah ... I missed that. So ... this is now in my configuration.yaml honestly wasn't sure if it was supposed to be the long form entity id or the friendly name so I figured it made sense to add both:
# Camera Proxy Setup
camera:
- platform: proxy
entity_id: camera.89b25da6b553825ad352b4fe35a4cff4
max_stream_width: 360
max_image_width: 720

camera:
- platform: proxy
entity_id: camera.front_door
max_stream_width: 360
max_image_width: 720
# Camera Proxy Setup
camera:
- platform: proxy
entity_id: camera.89b25da6b553825ad352b4fe35a4cff4
max_stream_width: 360
max_image_width: 720

camera:
- platform: proxy
entity_id: camera.front_door
max_stream_width: 360
max_image_width: 720
foxed
foxedOP•11mo ago
No description
foxed
foxedOP•11mo ago
Appear to be ok there but using any of those four options still isn't popping an image into the notification.
SebiLetPlay
SebiLetPlay•11mo ago
Hey there, just throwing in this as an alternative to the camera proxy:
alias: "[SENSOR] (Eingang) Klingel"
description: ""
trigger:
- platform: device
device_id: d9eb10d825a17353d9fc7bc2db6241d1
domain: nest
type: doorbell_chime
condition: []
action:
- service: notify.pc
data:
title: Es hat geklingelt
message: Jemand ist an der Haustüre
data:
image: >-
/api/nest/event_media/{{
trigger.event.data.device_id }}/{{
trigger.event.data.nest_event_id }}/thumbnail

mode: single
alias: "[SENSOR] (Eingang) Klingel"
description: ""
trigger:
- platform: device
device_id: d9eb10d825a17353d9fc7bc2db6241d1
domain: nest
type: doorbell_chime
condition: []
action:
- service: notify.pc
data:
title: Es hat geklingelt
message: Jemand ist an der Haustüre
data:
image: >-
/api/nest/event_media/{{
trigger.event.data.device_id }}/{{
trigger.event.data.nest_event_id }}/thumbnail

mode: single
This uses the gif generated by the Google Nest Integration
foxed
foxedOP•11mo ago
Interesting! Is that >- supposed to be there? Next to image:
SebiLetPlay
SebiLetPlay•11mo ago
That just enables me to do line-breaks in the script :D
foxed
foxedOP•11mo ago
Ahh! Cool! Well ... sadly still not working ... I'll come back to look at it tomorrow, for now my head hurts 😂
DrR0x
DrR0x•11mo ago
So the proxy is only the entity id which is not the friendly name. But also not the backend uuid type thing ha uses. So whatever you normally use for entity id. If in doubt you can select it from the left panel in the file editor, it should autofill it.
foxed
foxedOP•11mo ago
Thanks. I'm working on the assumption that the Camera Proxy is setup correctly as I can see it in my dashboard and it's an image rather than a live stream. The fact that both the /api/nest/event_media/ option and the /api/camera_proxy/camera.front_door aren't working makes me think there's something else amiss somewhere.
DrR0x
DrR0x•11mo ago
So if you could enable extended logs and check the log file after a restart and a test notification it should show exactly what url is not found
foxed
foxedOP•11mo ago
Stop reading my mind damnit ... I was just readin on how to do that 😂
DrR0x
DrR0x•11mo ago
😂, you need help or have you got it?
foxed
foxedOP•11mo ago
I always need help but I've got meds for that! Added to configuration.yaml and rebooted HA:
logger:
default: warning
logs:
custom_components.hass_agent: debug
logger:
default: warning
logs:
custom_components.hass_agent: debug
Test notification(s) sent, received on desktop with no image - logs:
2024-01-19 11:52:47.944 DEBUG (MainThread) [custom_components.hass_agent] loading media_player for device: GOLIATH
2024-01-19 11:52:47.951 DEBUG (MainThread) [custom_components.hass_agent.config_flow] found device. Name: GOLIATH, Serial Number: defbd9b8-be69-419c-83a2-95089936fe2b
2024-01-19 11:52:48.458 DEBUG (MainThread) [custom_components.hass_agent] loading notify for device: GOLIATH
2024-01-19 11:55:29.169 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2024-01-19 11:55:29.171 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2024-01-19 11:56:19.751 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2024-01-19 11:56:19.752 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2024-01-19 11:58:22.217 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2024-01-19 11:58:22.218 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2024-01-19 11:58:27.903 ERROR (Recorder) [homeassistant] Error doing job: Unclosed client session
2024-01-19 11:52:47.944 DEBUG (MainThread) [custom_components.hass_agent] loading media_player for device: GOLIATH
2024-01-19 11:52:47.951 DEBUG (MainThread) [custom_components.hass_agent.config_flow] found device. Name: GOLIATH, Serial Number: defbd9b8-be69-419c-83a2-95089936fe2b
2024-01-19 11:52:48.458 DEBUG (MainThread) [custom_components.hass_agent] loading notify for device: GOLIATH
2024-01-19 11:55:29.169 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2024-01-19 11:55:29.171 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2024-01-19 11:56:19.751 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2024-01-19 11:56:19.752 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2024-01-19 11:58:22.217 DEBUG (MainThread) [custom_components.hass_agent.notify] Preparing notification
2024-01-19 11:58:22.218 DEBUG (MainThread) [custom_components.hass_agent.notify] Sending notification
2024-01-19 11:58:27.903 ERROR (Recorder) [homeassistant] Error doing job: Unclosed client session
Automation config:
alias: DoorBell
description: ""
trigger:
- platform: device
device_id: 89b25da6b553825ad352b4fe35a4cff4
domain: nest
type: doorbell_chime
condition: []
action:
- service: notify.goliath
data:
message: Someone is at the door
title: Ding Dong
data:
image: /api/camera_proxy/camera.camera_proxy_camera_front_door
mode: single
alias: DoorBell
description: ""
trigger:
- platform: device
device_id: 89b25da6b553825ad352b4fe35a4cff4
domain: nest
type: doorbell_chime
condition: []
action:
- service: notify.goliath
data:
message: Someone is at the door
title: Ding Dong
data:
image: /api/camera_proxy/camera.camera_proxy_camera_front_door
mode: single
DrR0x
DrR0x•11mo ago
Does the notification send? Just without an image right?
foxed
foxedOP•11mo ago
Correct
DrR0x
DrR0x•11mo ago
So by extended logs I ment in hass.agent the app not home assistant 😂
foxed
foxedOP•11mo ago
Ohhh
DrR0x
DrR0x•11mo ago
But, nice job on the ha logs, I wouldn't even be able to tell you how to do that without some googling. In your logs on your computer it will most likely have a status code somewhere because the image will be in reachable. Just need to workout what the status code is and what url hass.agent is receivinf
foxed
foxedOP•11mo ago
Entity: automation.flash_lights
Error message: Response status code does not indicate success: 404 (Not Found).
2024-01-19 12:14:03.447 +00:00 [ERR] [STORAGE] Unable to download image: only HTTP uri's are allowed, got: /api/camera_proxy/camera.camera_proxy_camera_front_door
2024-01-19 12:14:03.447 +00:00 [ERR] [NOTIFIER] Image download failed, dropping: /api/camera_proxy/camera.camera_proxy_camera_front_door
Entity: automation.flash_lights
Error message: Response status code does not indicate success: 404 (Not Found).
2024-01-19 12:14:03.447 +00:00 [ERR] [STORAGE] Unable to download image: only HTTP uri's are allowed, got: /api/camera_proxy/camera.camera_proxy_camera_front_door
2024-01-19 12:14:03.447 +00:00 [ERR] [NOTIFIER] Image download failed, dropping: /api/camera_proxy/camera.camera_proxy_camera_front_door
Progress ..
DrR0x
DrR0x•11mo ago
Well this is a problem The image should be: /api/camera_proxy/entity id of camera And you should be able to go to hassurl:port/api/camera_proxy/entity id of camera It should return a bad request or not allowed or something along 5he lines of you do not have access. Not a 404 not found. That means it's setup wrong.
foxed
foxedOP•11mo ago
Yeah I get 403 Forbidden when going to http://homeassistant.local:8123/api/camera_proxy/camera.camera_proxy_camera_front_door Although, if I open the image from the dashboard - it has a token on the request url: http://homeassistant.local:8123/api/camera_proxy/camera.camera_proxy_camera_front_door?token=24416<redacted> And that opens fine.
foxed
foxedOP•11mo ago
No description
foxed
foxedOP•11mo ago
Ok got it working .... The 404 makes some sense since my machine receiving notifications doesn't know what the path /api/camera_proxy/blah means ... so I changed image: to point to the full URL + the token ... and I get images on notifications. Only question I have I guess is, how long lived is that token .. if at all .. Answer: not very 😄 that token seems to be a temporary one so not a long term fix. Hmm. Back to the drawing board.
Amadeo
Amadeo•11mo ago
hm the fork should use the token you configure during initial setup for resources within the same domain as "the HA" but I'll double check that yeah, it does
DrR0x
DrR0x•11mo ago
The full url should also automatically he added right?
Amadeo
Amadeo•11mo ago
eli5?
DrR0x
DrR0x•11mo ago
If you type in /api doesnt it automatically append the hass url? so like if hass.agent receives /api/camera_proxy/entity.id it would grab image from yourconfiguredhaurlandport/api/camera_proxy/entity.id cause that's whats in the old docs 🤣 https://hassagent.readthedocs.io/en/latest/notifications/notification-usage-and-examples/#camera-proxy
data:
image: /api/camera_proxy/camera.doorbell
duration: 3
data:
image: /api/camera_proxy/camera.doorbell
duration: 3
Amadeo
Amadeo•11mo ago
Oh, no, it has a check to only include the bearer token if the "uri" starts with the "domain" not to leak the token to unknown sites Yeah, there was even an issue on old repo for this not working although I couldn't find a way/code in the oroginal that would allow it
DrR0x
DrR0x•11mo ago
ahh okay all good, just need to make a note for the new docs
Want results from more Discord servers?
Add your server