Changing Camera Token Value

When I try to add the camera widget to HADashboard my setup works perfectly using the token value in the entity picture however it seems the token value is constantly updating/changing and once it does I can no longer see the picture. I tried eliminating the token as it was suggested in other posts but I couldn’t get it to work without the token value and I also tried using just the ip address but no luck. Only seems to work with the token included. Is it possible to get around a changing token value?

camera1:
    widget_type: camera
    #refresh: 5
    frame_style: ""
    entity_picture:  https://xxxxx.duckdns.org:8123/api/camera_proxy_stream/camera.xxxx?token=xxxxxxxxxx&api_pwd=xxxxxx

thats a problem that gets created by the home assistant component.
the only option i can think of is that you try to get the cam to work with the generic camera component.

by the way i suggest that you install a proxy server so that your dashboard isnt depending on an internet connection.

I am using the generic camera component for it. It’s an Amcrest webcam that I was thinking of switching to the amcrest component but sounds like that may not help me. I’ll have to look into a proxy server, might be a little over my head but I’ll take a look. I assume installing that would eliminate this issue?

it wont get rid of your problem.

a proxy server isnt that difficult.
i read that caddy is very easy, but i use nginx and that wasnt difficult also.
and there is enough info on the forum about it :wink:

about your changing token. i didnt know that generic also changed token.
what if you try this url:
entity_picture: https://xxxxx.duckdns.org:8123/api/camera_proxy/camera.xxxx?api_pwd=xxxxxx

i just took a look at my own camera and it also has a changing token, but i dont use it.
but i noticed something else that might be helpfull for a future update.

Still doesn’t show using entity_picture: https://xxxxx.duckdns.org:8123/api/camera_proxy/camera.xxxx?api_pwd=xxxxxx

I should also mention I am also using the android ip camera component for an android phone I re-purposed and that is doing the exact same thing. Works great with the token but disappears once the token changes.

what webbrowser are you using to try to show it?
i had the android ip cam also and i never used a token.

Using Vivaldi (fork of chrome)

try using normal google chrome on a pc.

Unfortunately same result

really strange.
but i am working on a change from the camera widget right now.
i will get back to you shortly in the hope you will try it as custom widget (and if it works i can make a PR to implement it)

Absolutely, sounds great !

i got a working custom widget that takes the token out of HA and when it changes it changes too in the dashboard. you dont even have to rhink about the token anymore.
at the moment it takes these settings:

my_camera:
    widget_type: camera
    camera: camera.hoofdterrascam
    ha_url: http://my_ha_ip:8123
    password: my_pw
    title: hoofdterrascam
    refresh: 2

i think i will create a github part tommorow, so you can test it.

Great, can’t wait !

Any update on this?

I haven’t seen any notification that it’s ready to be tested yet.

sorry, got distracted :wink:
ill upload it tonight.

oke it is online.
to test it do the following:

  1. create a directory custom_widgets as subdir from the directory that contains appdaemon.yaml (if you havent done that for other custom widgetss before)
  2. make sure that the user that runs AD hass full access to that directory
  3. create a directory called baseiframe in that directory
  4. copy the files that you find in the baseiframe directory from my github ( https://github.com/ReneTode/My-AppDaemon/tree/master/custom_widgets/baseiframe )
  5. copy the file camera.yaml from the custom_widgets directory here ( https://github.com/ReneTode/My-AppDaemon/tree/master/custom_widgets ) to your custom_widgets directory.
  6. create a dashboard that contains only 1 camera (to make sure nothing else is wrong) like this:
title: camera
widget_dimensions: [120, 120]
widget_size: [1,1]
widget_margins: [2, 2]
columns: 8

layout:
    - my_camera(3x2)

my_camera:
    widget_type: camera
    camera: camera.yourcamera
    ha_url: http://your_ha_url:8123
    password: your_ha_password
    title: any title
    refresh: 2

and save it in your dashboards dir and open it in a browser (preferably google chrome)

3 Likes

I was just about to say it worked as I added the camera and then waited for the token to change which it did and then continued to show the camera view however as I was writing that and about to reply I checked it again and unfortunately the view went blank again. I wasn’t paying attention to how long it took so I’ll try it again and see how long before it goes blank.

you can try to play with the refresh, to see what works and what not.
and in the console from google chorme you can follow if it still updates. (CTRL + SHIFT + I )

Somewhere between 4-5 minutes it started flashing off and on, meaning the video shows then doesn’t show and it’s continually doing that for another minute or two and then just goes blank. I’ll try changing the refresh setting.