mrlt8 / docker-wyze-bridge

WebRTC/RTSP/RTMP/LL-HLS bridge for Wyze cams in a docker container
GNU Affero General Public License v3.0
2.58k stars 158 forks source link

API command <cam-name>/stop seems to restart immediately #717

Open wilsonjeff72 opened 1 year ago

wilsonjeff72 commented 1 year ago

If I run a http://localhost:5000/api/shop-cam/stop I can see the {"success":true} response and I can also see it go to standby but almost immediately it reconnects. This seems to be a bug.

Using v1.11.7

Taken from api/sse_status:

data: {"shop-cam": "connected", "music-room-cam": "connected"}
data: {"shop-cam": "standby", "music-room-cam": "connected"}
data: {"shop-cam": "connecting", "music-room-cam": "connected"}
data: {"shop-cam": "connected", "music-room-cam": "connected"}
mrlt8 commented 1 year ago

Is this with on-demand enabled? The stream will also auto-restart if you have recording enabled.

wilsonjeff72 commented 1 year ago

Ah yes recording is enabled so that explains it, thanks. I was hoping to find a way to automate enabling/disabling of recording. Do you know if that is somehow possible? Surprised this is not possible via HomeKit automations. Thanks for your efforts on this work btw, tremendous!

wilsonjeff72 commented 1 year ago

Btw I did look into turning off a camera for a while using the Wyze app but when I turned it back on I believe it would not get picked up again until I did a Restart -> Connection To Cameras in the bridge UI. Is there a way to programatically call that?

mrlt8 commented 1 year ago

You should be able to select any motion under Recording Options > More Options in the Home app.

Do you have Ignore offline? Otherwise, it should keep retrying until the camera comes back.

wilsonjeff72 commented 1 year ago

No I'm not using IGNORE_OFFLINE. Should I be?

I do understand the different types of monitoring in HomeKit.

Currently I'm just trying to find a way to briefly stop and start the motion detection in some automated way. I can use IFTTT with Wyze to turn off/on the cameras but that won't work well with the bridge if the cams don't come back into the bridge automatically after they turn back on.

mrlt8 commented 1 year ago

hmmm... Default setting should reconnect to the cams when they come back online.

I believe we might be able to toggle the motion alarm on the camera, but that would only stop the notifications being pushed to the wyze app.

I'll try to see if there's something else we might be able to do.

wilsonjeff72 commented 1 year ago

Thanks, I'll try again today to see if I can reproduce that behavior of the cam not coming back online into the bridge after being off a while (via the Wyze app ON/OFF).

Yes what I'm really after here is stopping/starting the monitoring/notifications within HomeKit in an automated way. An example scenario is an outdoor camera that I want detecting motion and triggering alerts at all times EXCEPT when I decide to "disable" it for a while (gardening or anything else like that).

wilsonjeff72 commented 1 year ago

Ok I did some investigation thinking I'd find out how long the cam needs to be OFF before it won't come back into the bridge automatically when turned back ON.

I checked several OFF durations all the way up to 2 hours and each time the feed eventually came back. I might not have been patient enough yesterday and went ahead and restarted the camera in the bridge UI thinking that's what brought it back online. So there seems to be no problem after all. I should be able to automate the ON/OFF through Wyze/IFTTT to disable the cams when I need to.

Thanks again :)

wilsonjeff72 commented 1 year ago

Hi @mrlt8 I'm slowly discovering that the cam will not always come back online into the bridge after being off for a while. It seems to work most of time but not all the time. The fix seems to be Restart -> Connection to Cameras in the UI.

Is there any way to add an option to programmatically restart the cams? i.e. The same thing that happens with you click Restart -> Connection to Cameras in the UI?

Something like: http://localhost:5000/api/shop-cam/restart or http://localhost:5000/api/reconnect-to-cameras

Or maybe that will be rolled up into the enable camera stream which I see you're working on above?

mrlt8 commented 1 year ago

Restart -> Connection to Cameras just makes a call to :5000/restart/cameras which in turn just stops and starts each camera. So you could potentially emulate the behavior for an individual camera with <cam-name>/stop followed by a <cam-name>/start