Get Motion Picture from Tuya Camera

I have few Tuya cameras
When motion is detected in cloud debugging i can see event:

is is encoded camera snapshot? if yes, how can i get it and throw picture with motioin into Home Assistant?

Looks like it might be a base64 encoding. Maybe copy it out and paste it into a base64 decoder to see what the content is?

Check if it’s text content: https://www.base64decode.org/
Check if it’s image content: Base64 Image Decoder - Online Tool

1 Like

thanks!
this is information about snapshot file stored on memory card

{“v”:“3.0”,“bucket”:“ty-eu-storage30-pic”,“files”:[[“/e9904c-14381554-dgcx8c2fe9c89090c746/detect/1668560375.jpeg”,“8d452d4a58997c7”]]}

  1. how can i track motion event in HA
  2. how can i get snapshot in HA?

Sorry I don’t know enough about how the tuya cameras are setup to fully answer those questions for you.

Are the cameras setup in HA as a camera? If so I have a similar automation that captures an image directly from the camera and saves it to a local file on the HA filesystem which I can then use for other things (Slack notifications in my case). This is done by calling the camera snapshot service.

Then for the motion event itself, does the event change any entity states within HA? If so then you can use that as the trigger for your automation.

Camera added, but with limited functionality
No entities or attributes for motion events and getting files from SD card

What is your camera vendor and model?

Is the camera setup as a camera device in HA? ie. when you go to Media → Camera can you see them there?
This will tell you if HA has access to the camera feed or not (which is what you need for the snapshot to work).

My camera’s are Unifi either G3 Flex, G3 Instant or G4 doorbell

this is the doc page for getting the image url:

https://developer.tuya.com/en/docs/cloud/ipc?id=K9jgsgd4ty96p

if you never called Tuya API before, it’s kinda hard. Plus, you need to subscribe to this API. I’m still waiting on tech support to see if they will allow it. I was unable to find which API this call belongs to.

To track a motion event, you could add a virtual switch in the Tuya app and change it’s state on motion with an automation in the app - this should then be visible in Home Assistant.