Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: notification image and uri #306

Open
2 tasks done
blairun opened this issue Apr 24, 2023 · 5 comments
Open
2 tasks done

Bug: notification image and uri #306

blairun opened this issue Apr 24, 2023 · 5 comments

Comments

@blairun
Copy link

blairun commented Apr 24, 2023

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.exe output): Version 21H2 (OS Build 19044.2846)
  • HASS.Agent version: 2022.14.0

Please check what's applicable (multiple answers possible):

  • Installed via installer
  • 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).
@amadeo-alex
Copy link

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 #322

@blairun
Copy link
Author

blairun commented Jul 9, 2023

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.

@amadeo-alex
Copy link

amadeo-alex commented Jul 24, 2023

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.

@amadeo-alex
Copy link

amadeo-alex commented Jul 24, 2023

Ok, doable, will be done as part of LAB02-Research/HASS.Agent.Staging#18

@amadeo-alex
Copy link

Done, all URIs having the same domain name as HA configured within HASS.Agent will use the stored token for authentication.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants