Illegal login - camera entity IDs always changing

Hello

Recently moved over to hassio and have appdaemon/hadash up and running. Everything works apart from the camera views.

If i put the entity IDs of the cameras into my camera panel, the cameras load but after approx 5min they disappear. On the HA front end i then start getting illegal logins from the IP the dash is running on. When i check the entity IDs in HA they have changed.

As anybody experienced this? Im not using SSL or DuckDNS as i managed everything internal or via VPN.

Thanks

the entity IDs in HA change?
can you give a little more info about that?
they change from what to what?
what kind of camera?
what version from HA?
how do you check that they change?
how did you setup the cam in HA?

you get illegal logins? is appdaemon at that moment still running? what is in the appdaemon logs?
what do you have in your appdaemon.yaml?

Sorry my mistakes its the access tokens that keep changing. Cameras i have are Axis
Latest version of Hassio on virtulbox with appdaemon installed from addon store.

see configs below for HA and appdaemon. Its only the cameras im having trouble with and all other aspects of the dashboard work as expected.

Logs from HA
2018-12-09 22:37:16 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.5.236
2018-12-09 22:37:16 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.5.236
2018-12-09 22:37:18 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.5.236
2018-12-09 22:37:18 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.5.236
2018-12-09 22:37:20 WARNING (MainThread) [homeassistant.components.http.ban] Login attempt or request with invalid authentication from 192.168.5.236

Every 2 seconds as per refresh interval. IF i removed the camera from HADash, the illegal logins disappear.

axis:
  yardcamera:
host: 192.168.5.74
username: root
password: removed
location: Yard
include:
  - camera
  - vmd3

  doorcamera:
host: 192.168.5.199
username: root
password: removed
location: Front_Door
include:
  - camera

secrets: /config/secrets.yaml
log:
  logfile: STDOUT
  errorfile: STDERR
appdaemon:
  threads: 10
  app_dir: /config/appdaemon/apps
  plugins:
HASS:
  type: hass
  ha_url: http://hassio/homeassistant
  token: 0db10b500f8b7999f4d5a3016fecfa38688c11fbac401fbc95723c841b46aad2
hadashboard:
  dash_url: http://127.0.0.1:5050
  dash_dir: /config/appdaemon/dashboards

oke.
yeah a cam with a changing token is a problem
i know that i some cases the token isnt required, so you could try without.

i also know that other have struggled with this, so you might want to search the forum in the dashboard section to see if there was a solution that you can use.

we are planning to change the way a cam gets connected, but that can take a while.

Did there not used to be a widget where you could connect directly to the camera stream, rather than via HA?

I get no stream when I don’t put the token in.

I have searched the forums, but hindsight I was probably searching for entity ID rather than access token :see_no_evil::see_no_evil:

After a bit of frustration trying to get my cams to work again in HADashboard after moving everything over to the Token based security model - I am now having this issue as well. Camera tokens change regularly. I am using the Synology camera component

i think i’ve figured it out, they have been stable for a while now.

I had to add the following to configuration.yaml

http:
api_password: xxxxxxx

Then add the camera in dash as follows
http://192.168.5.xxx:8123/api/camera_proxy/camera.shed_rear?token=123456&api_password=123456

In this case, where are you getting the token? Is it the same place as before?

Has anyone managed to come up with a long term solution to this problem.I’m having the same issue with the changing token on the camera.

I’m using two old Samsung phones running IP Webcam and they were working fine with version HA v0.73.

I thought the point of generating a long term token was to resolve issues similar to this.

the point is that the camera doesnt use long term tokens.
and the HADashboard camera widget was build by someone who didnt have tokens.
we are going to change a lot in HADashboard after the next release from appdaemon, but Andrew is very busy IRL again, which slows down development.

No problem.

Camera on a Dashboard 1 works fine until you navigate away to Dashboard 2. As soon as you return to Dashboard 1 the widgets are blank.

Does including your Home Assistant password in the Appdaemon.yaml under api_key help with the problem.

I was using HA v073 but with so many upgrade issues I experienced I opted for a fresh install of v087

are you sure that your cam needs a token?
you dont need the HA api_key in appdaemon.yaml but you need it in HA.
my cams (foscam) work with api password from HA only.

does refreshing the dashboard work to get the cam back?

I ended up enabling the api password. Worked fine since then. Running latest version of HA

Definitely needs a token. Just confirmed that by leaving it out and trying to access the stream.

Yes I have the long term token I generated entered in the configuration.yaml for HA

Refreshing the browser is what causes the stream to disappear.

I’m interested in that solution.

When you say you enabled the password do you mean you entered the HA password into the appdaemon.yaml file.

no in HA i got

http: 
  api_password: !secret http_password

and in my dashboard:

camera_name:
  widget_type: camera
  entity_picture: http://HA_IP:8123/api/camera_proxy/camera.terrascam? 
  api_password=MY_PASSWORD

appdaemon.yaml should stay as it is. (with token)

@ReneTode I tried that solution but it’s not working for me.

As I mentioned earlier the streams are working fine as long as I don’t navigate (refresh the screen) from the current Dashboard using the frequently generated token for the camera stream I get from HA.

This is really puzzling me.

This setup all worked fine in v73. I do understand that the Appdaemon is a little behind development wise but the introduction of the token system seems to be what is at issue here for me.

Simplifying things as far as I can see it I have the following situation

Home Assistant -> Appdaemon-> HADashboard

Calling the url 192.168.0.75:5050 gives me a list of Dashboards. As long as I edit the dash file with the current token that HA is offering the streams will display in HADashboard. As soon as I refresh the browser those tokens are no longer valid and I see no streams.

I definitely need those frequently generated tokens to see a stream though and they need to be manually updated in the dash file each time. Not ideal.

like i said my cams all have a token. (also the generic cam) but i dont need the token in the url, because the api password takes care of that.
i must say that i didnt update HA after 0.82.1, so i cant tell for versions after that.

you did set the api password?
and you did try without token?

then its just 1 of those cams that dont work, but then you should have had that problem from the beginning. (unless there has been an update for your camera component, which can be found in the blogs)

for cams its actually homeassistant>HAdashboard
thats why you need to give a working url. the cam just connects to the api in js.

The cameras are working fine. They worked in v073 so it’s down the token system.

I’m getting Login attempt or request with invalid authentication from 192.168.x.xx on my device as soon as I refresh the browser. This problem disappears as soon as I blank out the camera widgets so it’s definitely down to the cameras.

I need to find some way of permanently authorising the camera streams each time I access the Dashboard and not having to edit the dash file with the changed token before I can see the stream.

@frank451 when you say you ended up enabling api password was that the api_key in Appdaemon.yaml