Changing Camera Token Value

please report back in a few days if its going like we hope.
i will find out together with andrew how we can make it that the ha url and password dont need to be set.
and then i will make a PR so that Andrew can implement it.

It took longer this time, almost 10 minutes but it started flashing again. Only way around it was to refresh the page. I’ll keep trying some things. Thanks again

thats really a cash problem.
i had something simular on my beebox running linux.
i use firefox there.
then i edited the settings that pages dont get cashed at all and my problems were gone.

several options for chrome are named here.

but now that its working feel free to try out other browsers and cash settings.

Just wanted to say thanks to ReneTode and photo64 for this! I’ve had the same issue with my synology camera setup and it’s been driving me nuts. This fix and refresh works perfectly so far! Thanks again.

1 Like

Is this still the best way to add a camera? I have an LTS (OEM for HIKVision) and my camera shows an image for 4 seconds, refreshes, takes 10 seconds with a blank image until it refreshes. In Lovelace it is working fine.

I have this in my dash file

    widget_type: camera
    camera: camera.garagaecam
    ha_url: http://mylocalip:8123
    password: api_password
    title: Garage Cam
    refresh: 10

and this in my configuration file

  - platform: generic
    name: garagaecam
    still_image_url: http://mylocalip/ISAPI/Streaming/channels/1/picture
    username: admin
    password: password
    verify_ssl: false

you got the custom camera widget i created.
try changing the refresh.

and you can try the original widget with a long lived token. (remove custom widget)

i tried an easy fix for long lived token, but i cant get access that way, so then i need to take more time to completely rewrite the widget.
so for the moment its all there is.

the fact that you have blank image for so many time has to do with networkspeed and cache.
lovelace doesnt need a token and uses stream in stead of pics.

One, thanks so much for all your assistance. It has been great.

Two, I did try the original widget with a long lived token (I think) but it keeps changing the token.

This method seems to work well other than the blank image for a bit, so I will tweak the refresh. I am also running a home run cable so my HA server is wired, instead of wireless. Hopefully that will help. Do you recommend a longer or shorter refresh time?

Thanks again. My HADashboard is almost complete!

HA server wired? and the device that runs the dashboard?

you got the refresh set to 10, with a still imageurl.
i dont know the default refreshrate from the still image cam, but i wouldnt go below that.

you could check in javaconsole if it blanks out at the moment it tries to reload, if thats the case it would be hard to get away from it.
i would first try it at 5 secs.

there is 1 other option i could try tonight. in my custom widget i retrieve the token from the entitypicture attribute.
that only gives the interval image and not the stream.
i could try to change that to stream and then there would be no refresh needed.

so ill come back to that.

i added stream option to the custom camera widget

here are the instructions again

  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 ( )
  5. copy the file camera.yaml from the custom_widgets directory here ( ) to your custom_widgets directory.
  6. create a dashboard that contains camera like this:
title: camera
widget_dimensions: [120, 120]
widget_size: [1,1]
widget_margins: [2, 2]
columns: 8

    - my_camera(3x2)

    widget_type: camera
    camera: camera.yourcamera
    ha_url: http://your_ha_url:8123
    password: your_ha_password
    title: any title
    stream: 1  #leave this out when streaming gives a to high load on the devices
    refresh: 2 # leave this out for stream (unless you got cache problems the use a high (180) refreshrate)

to update there are 2 options:

  1. replace your existing baseiframe.js and camera.yaml file with my new ones
  2. edit camera.yaml
    add the line
  stream: ""

after pasword: “”

and edit baseiframe.js and add these lines

        if ("stream" in self.parameters)
            url_part2 = url_part2.replace("camera_proxy","camera_proxy_stream");


        if ("password" in self.parameters)
            url_part3 = "&api_password=" + self.parameters.password;

in the function set_camera

Very cool! Going to try this when I get home. I will let you know how it works.


1 Like

I tried both with my HA server being wireless and wired. Getting the stream for about 10 seconds, then it goes black for about 10 seconds, and goes back to the stream for 10 seconds. I have stream: 1 and left out the refresh:

Still not perfect, but perhaps it is how I have the camera set up. I will keep playing. Thank you so much for all your work.

So now I tried without the stream, but putting the refresh at 2. That seems to have done it! My HA server is still hard wired which was always in the plan, but now it has become a must. I can live with a 2 second feed to my camera!

Now I really have to figure out the slider for the dimmer. On to a different forum post pertaining to that! Thanks so much ReneTode

1 Like

Hello ReneTode,
first off all i’am new here and so i have to say Hello @ all :slight_smile:

The code looks fine and after reading all messages i believe it will wokrs fine.
On my side I have the motioneye camera working in HA and the sensor shows a picture as well.

  • platform: push
    name: Haustuerklingel_Einfahrt
    webhook_id: WH_Einfahrt_Haustuer_01
    buffer: 2

On ui-lovelace.yaml the config works ass well to.

  • title: Camera Frontdoor
    - type: picture-entity
    entity: camera.haustuerklingel_einfahrt
    camera_image: camera.haustuerklingel_einfahrt
    left: 50%
    top: 50%
    width: 100%
    height: 100%

I use the Cloude9 IDE, and try to find the bug.
I think it will be the URL / IP Adress to the device or Buffer.
How it is possible to debug the code or visualizes the URL on run state?

I hope my English is readable enough to describe me problem.

Regards, Katzi

first you need to know that you need to show YAML and code as codeblock, or else it wont be readable.

that said, i dont know what your problem is.
you say it works well, but you dont say what is not working.

if you are trying to setup HADashboard and have a problem setting up widgets and also have trouble with english you can also reach me at where we have support in german. (i guess you are german, because you use german entity names :wink: )

interesting stuff here, i am also using the long url with the token, but i use it in a total other system in the cloud, where i fill in the url with token
but token changes, so url is not correct anymore

is there a way to exclude the token in the url , so i can use it in my other program? maybe with bearer or something?

Fantastic implementation, it works great!

works amazingly … thanks so much … I was struggling with constantly changing tokens …
really nice work

1 Like


For some reason i can only display images every 10 seconds apart. Not true streaming like lovelance UI. Any ideas what can i check? I applied ur code from Feb 20

i cant say without you showing me how you configured the widget.


Here it is.

    widget_type: camera
    camera: camera.front_door_camera
    ha_url: http://<REDACTED>:8123
    password: <REDACTED>

  - front_door_camera(4x2),  back_door_camera(4x2)
  - spacer, switch.front_door_switch, binary_sensor.front_door_motion, spacer(2x1), switch.back_door_switch, binary_sensor.back_door_motion