bropat / eufy-security-ws

Small server wrapper around eufy-security-client library to access it via a WebSocket.
MIT License
169 stars 24 forks source link

[Question]: rtsp stream command doesn't start stream #249

Closed stratacorps closed 10 months ago

stratacorps commented 1 year ago

Ask your question

In testing I have found that, at least for the T8160 cameras and homebase the device command to start the rtsp stream isn't enough to actually get the stream started.

For example:

device.start_rtsp_livestream T8160XXXXXXXXXXXXX

eufy-security> { type: 'result', success: true, messageId: 'start_rtsp_livestream', result: {} } eufy-security> { type: 'event', event: { source: 'device', event: 'rtsp livestream started', serialNumber: 'T8160XXXXXXXXXXXX' } } eufy-security> { type: 'event', event: { source: 'device', event: 'command result', serialNumber: 'T8160XXXXXXXXXXXXXX', command: 'set_property', returnCode: 0, returnCodeName: 'ERROR_PPCS_SUCCESSFUL', customData: { property: { name: 'rtspStream', value: true } } } }

However, there is no data coming from the stream (Using VLC to test)

device.is_rtsp_livestreaming T8160.... gets the status as true: { type: 'result', success: true, messageId: 'is_rtsp_livestreaming', result: { serialNumber: 'T8160...', livestreaming: true } }

The work-around I have found that works comes from the behavior of the camera physically--that is, when I enabled RTSP on the camera there is a brief moment in time that the stream is started (I presume for testing if I were using a NAS client, etc.)

So, if I enable rtsp streaming with the above, and then immediately follow up with and wait for the async response of the device.set_property T8160... rtspStream true command, the stream is successfully started.

Am I doing something wrong or is this the expected behavior, or at least what everyone else is seeing.

fuatakgun commented 1 year ago

you are always keeping this one as True, right? device.set_property T8160... rtspStream true

In my local setup, if it is true, calling start_rtsp_livestream initiates NAS setup and I receive a short (3 minutes?) stream.

stratacorps commented 1 year ago

First, I'm sorry I posted this to your repo, I'm an idiot. I was looking for answers from and thought I was on this (bropat) repo.

But yes, it is true and was set true when I set up RTSP in the iOS app. I didn't time to see how long the stream would last until you mentioned it.

It seems like the camera, when enabling rtsp, activates the stream temporarily so you can test the NAS. Then when you indicate from the app that setup is complete, the stream stops. In theory, only a motion trigger would restart the stream.

I did find, by accident, that--even though the property is already true--if I set the property to true again immediately after I send the start_rtsp command, I get a stream. I will time the stream now to see if it stops at 3 minutes.

EDIT: my stream ran for 5 minutes then quit. In fact, I don't even need to use the start_rtsp command at all to get this behavior. So for me it looks like the start_rtsp command doesn't do anything. The stop_rtsp works as expected, but I need to set the property above to true and I get a temporary stream. I will look at the live stream command to see how that works.

landolfi-us commented 1 year ago

This might or might not be related, but: I'm using camera.turn_on on a Lovelace card to get a live stream on demand from 1 of 4 T8410 cameras. I find that the tap action does not result in a live stream unless I tap another T8410 camera card to start its live stream. Then I get live streams for both simultaneously.

Eufy Security Home Assistant 2023.8.1 Supervisor 2023.08.1 Operating System 10.4 Frontend 20230802.0 - latest

stratacorps commented 1 year ago

Not sure. RTSP attribute isn't working on the T8160 cameras. The trick I mentioned that starts the rtsp stream is the same behavior as you experience from the app when enabling RTSP...there is a momentary period that rtsp streaming is enabled while it allows you to test your NAS server set up. This appears to be about 5 minutes and it times out.

luchtbakker commented 12 months ago

I have the same issue. I can preview, but de live stream won't open.

My log:

2023-08-20 08:17:50.282 DEBUG [Station.onCommandResponse] Got p2p command response { station: 'T8410P422307C0F2', commandType: 1144, channel: 255, returnCodeName: 'ERROR_PPCS_SUCCESSFUL', returnCode: 0, customData: undefined } 2023-08-20 08:17:50.282 DEBUG [P2PClientProtocol.handleMsg] Station T8410P422307C0F2 - DATA DATA - Received expected sequence (expectedSeqNo: 12 seqNo: 11 queuedData.size: 0) 2023-08-20 08:17:50.292 DEBUG [P2PClientProtocol.handleMsg] Station T8410P2021240C0C - DATA DATA - received from host 192.168.2.3:23231 - Processing sequence 12... 2023-08-20 08:17:50.293 DEBUG [P2PClientProtocol.parseDataMessage] Station T8410P2021240C0C - Received data { seqNo: 12, header: { commandId: 1144, bytesToRead: 12, channel: 255, signCode: 0, type: 1 }, bytesRead: 12, bytesToRead: 12, firstPartMessage: true, messageSize: 28 } 2023-08-20 08:17:50.294 DEBUG [P2PClientProtocol.handleData] Station T8410P2021240C0C - Received data { commandIdName: 'CMD_SDINFO_EX', commandId: 1144, resultCodeName: 'ERROR_PPCS_SUCCESSFUL', resultCode: 0, message: '\x01�\x01\x00�]\x00\x00', data: '0000000001d60100d85d0000', seqNumber: 13, energySavingDeviceP2PDataSeqNumber: 0, offsetDataSeqNumber: 0 } 2023-08-20 08:17:50.295 DEBUG [P2PClientProtocol.handleData] Station T8410P2021240C0C - Result data for command received { message: { sequence: 12, commandType: 1144, nestedCommandType: undefined, channel: 255, acknowledged: true, retries: 0, returnCode: -133, data: <Buffer d1 00 00 0c 58 5a 59 48 78 04 88 00 00 00 01 00 ff 00 00 00 00 00 00 00 00 00 00 00 64 32 31 32 30 62 33 36 31 36 38 39 33 36 65 31 66 31 63 31 36 34 ... 106 more bytes>, customData: undefined }, resultCodeName: 'ERROR_PPCS_SUCCESSFUL', resultCode: 0 } 2023-08-20 08:17:50.296 DEBUG [Station.onCommandResponse] Got p2p command response { station: 'T8410P2021240C0C', commandType: 1144, channel: 255, returnCodeName: 'ERROR_PPCS_SUCCESSFUL', returnCode: 0, customData: undefined } 2023-08-20 08:17:50.297 DEBUG [P2PClientProtocol.handleMsg] Station T8410P2021240C0C - DATA DATA - Received expected sequence (expectedSeqNo: 13 seqNo: 12 queuedData.size: 0) 2023-08-20 08:17:50.314 DEBUG [P2PClientProtocol.handleMsg] Station T8410P2021240C0C - DATA DATA - received from host 192.168.2.3:23231 - Processing sequence 12... 2023-08-20 08:17:50.314 DEBUG [P2PClientProtocol.handleMsg] Station T8410P2021240C0C - DATA DATA - Received already processed sequence (expectedSeqNo: 13 seqNo: 12 queuedData.size: 0) 2023-08-20 08:17:51.364 DEBUG [P2PClientProtocol.handleMsg] Station T8200N0020080C8E - DATA CONTROL - received from host 192.168.2.10:17334 - Processing sequence 50... 2023-08-20 08:17:51.365 DEBUG [P2PClientProtocol.parseDataMessage] Station T8200N0020080C8E - Received data { seqNo: 50, header: { commandId: 1103, bytesToRead: 66, channel: 0, signCode: 0, type: 0 }, bytesRead: 66, bytesToRead: 66, firstPartMessage: true, messageSize: 82 } 2023-08-20 08:17:51.366 DEBUG [P2PClientProtocol.handleDataControl] Station T8200N0020080C8E - Camera info { cameraInfo: '{"params":[{"dev_type":1000,"param_type":1103,"param_value":"1"}]}' } 2023-08-20 08:17:51.366 DEBUG [Station.onCameraInfo] Got camera infos { station: 'T8200N0020080C8E', cameraInfo: { params: [ { dev_type: 1000, param_type: 1103, param_value: '1' } ] } } 2023-08-20 08:17:51.367 DEBUG [P2PClientProtocol.handleMsg] Station T8200N0020080C8E - DATA CONTROL - Received expected sequence (expectedSeqNo: 51 seqNo: 50 queuedData.size: 0)