DeebotUniverse / docs

https://deebot.readthedocs.io
GNU General Public License v3.0
33 stars 9 forks source link

Taking a snapshot of the new 'Image' entity? #249

Closed mortenalbring closed 11 months ago

mortenalbring commented 1 year ago

In the latest update, the live 'camera' feed that showed the map was replaced by the new 'Image' entity. I was using the 'camera.snapshot' service to save the image locally of the robot map position. However, I can't seem to do this with the new 'image' entity. The docs on this new image integration are pretty sparse, and there don't seem to be any service calls related to it specifically.

I thought that the 'image' integration was supposed to be sort of a limited skew of the 'camera' integration, but I don't really understand how to interface with it.

Is there any way to 'save' locally the image served up by the image integration?

edenhaus commented 11 months ago

I changed the entity from camera to image because the map is a static image, and the new entity makes handling easier. The camera entity supports features that are unusable for the use case such as motion detection and streaming. The latter one for already requested to be implemented.

Depending on your exact use case you can directly use the attribute entity_picture, which is a URL pointing to the image, or create with a template entity a new entity, which is only updated on your needs.

mortenalbring commented 11 months ago

Hmm.. Yes, that does spit out a URL of the form

http://homeassistant.local:8123/api/image_proxy/image.fenrir_map?token=ec1a597cbe1c7ead40f6527103b05268f0ed3a00306c2bcc45d14440dd53b02

Do you have any idea how I can get HA to 'save' that URL as a png locally, to replicate the camera.snapshot service?

I've tried using the shell commands but it doesn't seem to work on this image_proxy path.

mortenalbring commented 11 months ago

Ah, I did find a solution for this! Like you suggested, I made a template entity for entity_picture

- sensor:
    - name: "Fenrir Map"
      state: >
        {{ state_attr('image.fenrir_map','entity_picture') }}

and then added a Generic Camera entity with the still image url http://192.168.1.4:8123{{states('sensor.fenrir_map')}}

And that spits me out a camera entity from the entity picture, which seems to function like it did previously!

Not sure if anyone else has the peculiar use-case that I do, but this is a solution.