Bug: notification image and uri
Describe the bug Hi. I came across two issues with notifications. Not sure if they are bugs or new feature requests. Thanks for your time on this.
1- I tried to add a notification image from my nest doorbell, following the directions here: https://www.home-assistant.io/integrations/nest/#media-source. The image works as expected in the android app, but not with hass.agent. It looks like api authentication isn't working when trying to display "/api/nest/event_media/DEVICE_ID/EVENT_ID/thumbnail". Relevant logs are pasted below.
2 - I tried to create a notification button to open a website. I see the button click event when listening for hass_agent_notifications in home assistant. However the webpage isn't opening in my Windows browser. I have a browser set in hass.agent config, and it launches normally when clicking the test button. No hass.agent logs are generated for this event.
action:
- service: notify.hassagent_desktop
data:
title: test
data:
actions:
- action: URI
title: Web
uri: https://google.com
Misc info (please complete the following information):
- Windows build (ideally screenshot/info of
winver.exeoutput): Version 21H2 (OS Build 19044.2846) - HASS.Agent version: 2022.14.0
Please check what's applicable (multiple answers possible):
- [x] Installed via installer
- [x] Problem occurs in HASS.Agent
Logs
logs from inital test:
[ERR] [STORAGE] Unable to download image: only HTTP uri's are allowed, got: /api/nest/event_media/mynestid1234/abcd1234/thumbnail
[ERR] [NOTIFIER] Image download failed, dropping: /api/nest/event_media/mynestid1234/abcd1234/thumbnail
logs from second test, with full uri:
[ERR] [STORAGE] Error while downloading file!
Remote URI: https://myhomeassistanturl/api/nest/event_media/mynestid1234/abcd1234/thumbnail
Local file: C:\Users\...\LAB02 Research\HASS.Agent\cache\images\1234.png
Error: Response status code does not indicate success: 401 (Unauthorized).
Hello,
Regarding 1: Are you able to properly see the image if you open "https://myhomeassistanturl/api/nest/event_media/mynestid1234/abcd1234/thumbnail" in private browser window? (on pc of course)
Regarding 2: This won't work, currently there is no support for opening the URL directly after clicking on the notification, you'll need to receive the event in HA and then active the HASS.Agent command to open the URL on the windows device - please see https://github.com/LAB02-Research/HASS.Agent/issues/322
Hi. The url image doesn't load when using a browser window (normal or private). I can view the image when using the url AND a bearer token in a rest client like this one: https://github.com/rangav/thunder-client-support.
Thanks for pointing me in the right direction for question 2. Cheers.
We'd have to download the resource whilst also providing the bearer token and then pass it on to the notification library, I'll see how Companion App does this (probably using the logon bearer token when resource URL matches the HA server address/hostname) and if it'd be viable to replicate.
Ok, doable, will be done as part of https://github.com/LAB02-Research/HASS.Agent.Staging/pull/18
Done, all URIs having the same domain name as HA configured within HASS.Agent will use the stored token for authentication.