custom-cards / surveillance-card

A custom component for displaying camera feeds in the style of a surveillance system.
Apache License 2.0
244 stars 36 forks source link

websocket command 'camera_thumbnail' has been deprecated. #22

Closed tommyjlong closed 4 years ago

tommyjlong commented 4 years ago

Just started using this card in 0.107 and I'm getting a log warning (which I presume is coming from this card): The websocket command 'camera_thumbnail' has been deprecated.

The websocket documentation doesn't mention anything here about it being deprecated: camera_thumbnails

niemyjski commented 4 years ago

I'm going to close this as I'm not seeing this error. If you can give me the details of where you are seeing this with the latest HA release please comment back and we'll reopen it.

niemyjski commented 4 years ago

Ok I see this in the HASS Logs not the console or request stream where I'd expect to see them.

niemyjski commented 4 years ago

@tommyjlong can you file an issue and see what we are supposed to use: https://github.com/home-assistant/core/pull/32473/files has no information and https://developers.home-assistant.io/docs/api/websocket/#fetching-camera-thumbnails still says to use this.

tommyjlong commented 4 years ago

I hope you don't mind but I will decline. I would just be someone in the middle not contributing to the solution.

niemyjski commented 4 years ago

Logging an issue would be a huge help especially to this project (any help goes a long way). I asked in discord and got no response. I did look at what the front end is doing and it's calling camera_proxy but the image images are not updated very often at all.....

tommyjlong commented 4 years ago

Maybe this is helpful...after googling a bit, it was reported that Arlo cameras had this problem, but supposedly its been fixed (see here)

I haven't studied the code, but taking a look at the repository, around line 601 appears to be how they did it.

captainnapalm commented 4 years ago

I'm seeing this issue a lot with using this card.

Logger: homeassistant.components.camera
Source: components/camera/__init__.py:552
Integration: Camera (documentation, issues)
First occurred: 11:10:10 AM (3455 occurrences)
Last logged: 2:02:25 PM

The websocket command 'camera_thumbnail' has been deprecated.
balloob commented 4 years ago

This is what the HA frontend does: https://github.com/home-assistant/frontend/blob/dev/src/data/camera.ts#L36

If you don't want to use signed paths, you can use the camera access token that is part of the state:

export const computThumbnailUrl = (entity: CameraEntity) =>
  `/api/camera_proxy/${entity.entity_id}?token=${entity.attributes.access_token}`;
niemyjski commented 4 years ago

@balloob what is the delay on this? It seemed to refresh way slower than what the web sockets refreshed (almost real time). I was playing around with this and it's what I'm using locally (with the cameras token).

balloob commented 4 years ago

what do you mean with delay? We're deprecating the websocket version because we shouldn't push megabytes of data via the websocket API. It's not meant for that.

The camera thumbnail websocket API will be removed in a future version.

niemyjski commented 4 years ago

@balloob sorry for the delay, I haven't had much time lately but I started refactoring the whole component to be much more lightweight and not even use web sockets at all. I'm really close to pushing it out but stuck on two areas (working on trying to resolve issue 2 currently):

  1. Figuring out if there is a good way to import a built in function to do throttling (with tail) as the hass object updates super super often.
  2. I'm running into some kind of polymer data binding issue where the Dom isn't being updated when I update an objects property (mapping over an array of objects and state isn't being reflected in Dom).

For delay/interval I was referring to the camera_proxy_stream. Seems like other web socket functions should be deprecated too like getting any image (for media players).

niemyjski commented 4 years ago

Just down to figuring out the first issue and making sure changes are efficient. Turns out the dirty checking in polymer needed a bit of help: https://polymer-library.polymer-project.org/1.0/docs/devguide/model-data#override-dirty-check

balloob commented 4 years ago

Uh, don't use Polymer 1.0! If you're going to rewrite it, use their new https://lit-element.polymer-project.org/ , it's what we use in the frontend too.

niemyjski commented 4 years ago

@balloob I'm using that :-)

niemyjski commented 4 years ago

This has been fixed in 0.0.3

niemyjski commented 4 years ago

@balloob is it more reliable to just refresh the image every time the hass object changes (throttled) and the motion state changes or listen to the web socket.. What would be really nice if I just set the refresh interval on a camera_proxy_stream and when motion is detected server side it would refresh the proxy stream immediately disregarding the interval.

enkama commented 3 years ago

https://github.com/custom-cards/surveillance-card/commit/1524fcbf95ff7e228ba3bc4c08bbfa5c018b825a

Fix on another component for that error message.

niemyjski commented 3 years ago

@Wibias I did that commit to resolve this issue. Are you still seeing it?

enkama commented 3 years ago

Whoops that was on the wrong Issue. Had way to many tabs open, sorry! I am using another Component which is having the same problem. https://github.com/PiotrMachowski/lovelace-xiaomi-vacuum-map-card/issues/67