fuatakgun / eufy_security

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

Stream fails to reset after initial stream #127

Closed LordNex closed 2 years ago

LordNex commented 2 years ago

Please check Services, Known Bug / Issues and Troubleshooting over here first: https://github.com/fuatakgun/eufy_security/blob/master/README.md

Describe the bug I've followed your instructions and even have the conditional cards to display the static image and then be able to click on that to start the live stream. That works the first time. After about 3 min or so the stream stops (from what I've read this is baked into the hardware by eufy), and then goes back to the last captured image.

If you attempt to click on the image again nothing happens. If I go look at the state of the sensors, they all come up unavailable. The only way I have been able to successfully recover from this is to restart the Eufy Security add-on, and then reload the integration. I've built a somewhat hacked together solution with an automation to restart the add on and then using the home assistant.reload_config_entry I attempt to reload the integration. So far this has been somewhat hit or miss

To Reproduce Steps to reproduce the behavior: After running the initial p2p stream, you have to restart both the admin and integration before it resets

Expected behavior After the normal 3 min stream, the camera feed goes back to a standby displaying an image of the last captured image with the smiling to click on the image to restart the stream. That or be able to have the stream run constantly which I would prefer since it's a wired version.

Screenshots If applicable, add screenshots to help explain your problem.

Hardware Information about Home Assistant Latest stable version of HA running on ESXi 7.0 on an i5 laptop Hardware Information about Cameras

Additional context Add any other context about the problem here.

fuatakgun commented 2 years ago

Sensors becoming unavailable is very extreme, we should work out this together.

If you are willing to share your camera, please follow readme to do so.

I will take a look in next 1-2 days. Otherwise, we can set a specific date/time if you want to be more in control

LordNex commented 2 years ago

Sure, I did some further testing. Sometimes they won't go unavailable, but the stream won't start either. For instance, on a new start, I see the still image captured. I can click on the image and it will stream for a random interval. It will then return to normal and all the sensors show normal, except the Streaming Source Address and Streaming Source Type will be unavailable. It will not allow me to see the stream again until i reload the integration.

Now comes a weird bit. If i goto the Developer Tools and run the homeassistant.reload_config_entry with the camera as the entity, it will reload the integration and resolve the issue. But when I try to do the same command in a script or automation, nothing happens. I've also tried useing the RESTFull API to call a reload on the specific ID with a Long Lived Access Token and that did nothing. I then tried doing basically the same command but in a shell script to fire off curl and it still would not reload.

So I do have a workaround but have been unable to find a way to automate it. Give me a few min and I'll share it to the US email address you have listed in the readme. Thanks again for your help!

LordNex commented 2 years ago

Ok Ive added you to the app with Admin rights. Let me know if you need logs or anything

LordNex commented 2 years ago

Here is an error from the log I found

`2021-11-22 08:36:19 ERROR (MainThread) [custom_components.eufy_security] eufy_security - Exception - process_messages: 'T8201N0020382261' - traceback: Traceback (most recent call last): File "/config/custom_components/eufy_security/websocket.py", line 62, in process_messages await self.on_message(msg) File "/config/custom_components/eufy_security/websocket.py", line 68, in on_message await self.message_callback(message) File "/config/custom_components/eufy_security/coordinator.py", line 160, in on_message self.devices[serial_number].set_codec(message["metadata"]["videoCodec"].lower()) KeyError: 'T8201N0020382261'

fuatakgun commented 2 years ago

Ok, i found the problem, it is inside add-on. When live stream is started once and stopped manually, add-on is hanging, I am not able to kill local instance, it is frozen. you might need to share your camera

Please create issue here: https://github.com/bropat/eufy-security-ws

fuatakgun commented 2 years ago

I have debugged your camera yesterday, you can reopen the original issue and mention about my findings here and i will also jump there

LordNex commented 2 years ago

Just so you know I've removed and replaced that camera with Amcrest AD410's and have had so much better experience. Just overall everything I feel is just better minus maybe the look. But I'll be installing it at the in-laws anyway and they can just use the app. Just in case you need to reassign this issue as I probably won't be able to do any testing until after xmass at the soonest. Thanks for your help!

fuatakgun commented 2 years ago

thanks for sharing the updates, let me resolve this and wait for another volunteer. enjoy