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

Image display fails on dynamic URL #5

Closed
brianhanifin opened this issue Dec 21, 2021 · 5 comments
Closed

Image display fails on dynamic URL #5

brianhanifin opened this issue Dec 21, 2021 · 5 comments
Labels
bug Something isn't working

Comments

@brianhanifin
Copy link

First, this is nice. Thank you!

I would like to use this to popup a still image of the person at the front door. In my testing I found the following.

The following URL works:

http://homeassistant.local:8123/local/brian.jpg

While a dynamic URL pulled from the entity_picture attribute of a camera does not.

http://homeassistant.local:8123/api/camera_proxy/camera.doorbell?token=da875fe850053b881f2fd8636c73faf7a0fc99ec7e18feb6ee69be992bb4890a

FYI. in my script.notify_pc I use the variables: section to extract the dynamic URL.

variables:
  image: |
    {% set camera = camera %}
    {%- if camera != "" %}
      {%- set image = "http://homeassistant.local:8123" + state_attr(camera,"entity_picture") %}
    {% endif %}
    {{ image }}
@LAB02-Admin LAB02-Admin transferred this issue from LAB02-Research/HASS.Agent-Notifier Dec 21, 2021
@LAB02-Admin LAB02-Admin added the bug Something isn't working label Dec 21, 2021
@LAB02-Admin
Copy link
Member

Hey Brian, thanks, glad you like it :)

I've transferred your issue to HASS.Agent, as that's where this is failing. I'll look into it and let you know!

@LAB02-Admin
Copy link
Member

Looks like it's failing in two places, at least when I'm trying to reproduce this.

For starters, the script was sending an empty image variable. I had to change the variable part as following (specifically the quotes, I didn't use a camera variable):

  variables:
    image: |
      {%- set image = "http://homeassistant.local:8123" + state_attr("camera.garden","entity_picture") %}
      {{ image }}

Afterwards I did receive a working url on my pc.

Perhaps your script already works fine: you can check by looking in the HASS.Agent logs - if you installed using the installer, they'll be in %appdata%\LAB02 Research\HASS.Agent\Logs. If there are Error downloading image exceptions, the url came through. Otherwise, you need to change the script.

This still didn't show the image; HASS.Agent failed to download the image, it got confused by the dot in camera.name in the url.. Released a bugfix.

Let me know if this fixes it for you!

@brianhanifin
Copy link
Author

Your update fixed it! Thank you! I love the idea of being able to see who is at the door without having to getting my phone out of my pocket when I'm at my PC!

@LAB02-Admin
Copy link
Member

Great! Good to hear, that was also one of my main reasons for that function 😄

@LAB02-Admin
Copy link
Member

Added your idea of using the proxy to the README file, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants