fuatakgun / eufy_security

Home Assistant integration to manage Eufy Security devices as cameras, home base stations, doorbells, motion and contact sensors.
938 stars 79 forks source link

Eufy S120 Livestream Fails and crashes Eufy Add-On #1148

Open kmil4 opened 6 months ago

kmil4 commented 6 months ago

Describe the bug

FYI: I have a Eufy doorbell and multiple pan/tilt cameras that work flawlessly with this integration (Thank you!!). I've been using this integration for quite a while so I have a decent understanding.

The problem is with a new Eufy S120 when attempting to livestream to my HA dashboard. I encounter this error:

Failed to call service camera/turn_on. {'type': 'result', 'success': False, 'messageId': 'device.stop_livestream.c42ea6d5c7f742d0a678cc8f883e539e', 'errorCode': 'device_livestream_not_running}`

Around 20% of the time, I can get the feed to appear without issue from this camera (it's on the list of supported devices). The rest of the time, the stream will throw an error within about 10 seconds after clicking "Start Stream." But even if I'm able to get the stream running, most of the time it will be live for about 30 seconds before suddenly stopping, and throwing the same error above. Once the error appears, the Eufy Add-On hangs, and must be manually restarted or it will chew up CPU.

To reproduce

Assume Eufy Add-On + Integration are installed and configured, with other camera streams already working.

Assuming the root cause is related this bug reproes in two ways: First Repro

  1. Set Eufy S120 video and recording settings to low
  2. Copy the WebRTC dashboard card from the dev docs, replacing entity ID with camera.garage_camera and save
  3. Press "Start Stream"
  4. See error

Second Repro

  1. Set Eufy S120 video and recording settings to low
  2. Copy the WebRTC dashboard card from the dev docs, replacing entity ID with camera.garage_camera and save
  3. Press "Start Stream"
  4. Live stream will begin. Wait at least 60 seconds. Do not interact with the page or navigate away.
  5. Wait for livestream to disappear, observe error

Expected behavior

A livestream of the camera feed should start within 10 seconds of pressing "Start stream"

Additional information

Go to Settings -> System -> Repairs -> Click on 3 dots (...) -> System Information and get Version and Installation Type to below fields;

Hardware Information:

Additional context

Add any other context about the problem goes here. Mainly, share everything as log files and use screenshots as last resort.

A few things I've tried without notable changes in behavior:

kmil4 commented 4 months ago

For anyone struggling with the S120, I found a workaround to make it stream reliably. It's hacky and I wish it was seamless but at least this will work.

I wrote a script that does this:

  1. Toggle the light switch on the camera
  2. Wait 3 seconds
  3. Press "start p2p stream"
  4. Toggle the same light switch again
  5. Wait 1 second
  6. Force the dashboard page to refresh (I use Browser Mod from HACS which includes this service)

Something about toggling the light seems to get the camera feed "unstuck" but the actual stream will not appear until you navigate away from the dashboard page first (or refresh it like my script).

It's not ideal, but it works reliably for me. I went from basically never being able to see the stream and preview images to always having it show. Better than nothing

fabien4444 commented 2 months ago

For anyone struggling with the S120, I found a workaround to make it stream reliably. It's hacky and I wish it was seamless but at least this will work.

I wrote a script that does this:

  1. Toggle the light switch on the camera
  2. Wait 3 seconds
  3. Press "start p2p stream"
  4. Toggle the same light switch again
  5. Wait 1 second
  6. Force the dashboard page to refresh (I use Browser Mod from HACS which includes this service)

Something about toggling the light seems to get the camera feed "unstuck" but the actual stream will not appear until you navigate away from the dashboard page first (or refresh it like my script).

It's not ideal, but it works reliably for me. I went from basically never being able to see the stream and preview images to always having it show. Better than nothing

Hello

could you write your script please for a newbee? :)

Thanks

xtypebox commented 2 months ago

For anyone struggling with the S120, I found a workaround to make it stream reliably. It's hacky and I wish it was seamless but at least this will work.

I wrote a script that does this:

  1. Toggle the light switch on the camera
  2. Wait 3 seconds
  3. Press "start p2p stream"
  4. Toggle the same light switch again
  5. Wait 1 second
  6. Force the dashboard page to refresh (I use Browser Mod from HACS which includes this service)

Something about toggling the light seems to get the camera feed "unstuck" but the actual stream will not appear until you navigate away from the dashboard page first (or refresh it like my script).

It's not ideal, but it works reliably for me. I went from basically never being able to see the stream and preview images to always having it show. Better than nothing

And the motion sensors in HA are working? Mine doesn't do nothing.