homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
165 stars 24 forks source link

[Bug]: [homebridge-eufy-security] This plugin slows down Homebridge. The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory 'Office E464' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info. #99

Closed metalcated closed 1 year ago

metalcated commented 2 years ago

What happened?

Describe The Bug: I am receiving an error when trying to open camera streams for the Eufy cameras.

To Reproduce: Attempt to open a camera stream in Apple HomeKit.

Expected behavior: Steam would work consistently every time I open a stream.

Device Type

Indoor Camera (Supported)

Plugin Version

v2.0.x (Supported)

HomeBridge Version

v1.4.x (Supported)

NodeJS Version

v16 (Supported)

Operating System

Ubuntu 18.04+ (Supported)

Relevant log output

[7/2/2022, 3:47:11 PM] [homebridge-eufy-security] This plugin slows down Homebridge. The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory 'Office E464' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
github-actions[bot] commented 2 years ago

Did you check this Common Issues pages ?

thieren commented 2 years ago

Hi @metalcated

Can you share a few more things?

  1. your config json (without the credentials)
  2. enable debug messages (instructions here) and some more log messages around the stream start event (~1-2 seconds before and up to 20 seconds after)
metalcated commented 2 years ago
{
    "platforms": [
        {
            "name": "Config",
            "port": 8581,
            "platform": "config",
            "auth": "form",
            "tempUnits": "c",
            "lang": "auto",
            "theme": "dark-mode"
        },
        {
            "enableCamera": true,
            "pollingIntervalMinutes": 30,
            "ignoreDevices": [
                ""
            ],
            "hkAway": 0,
            "username": "my@email.com",
            "platform": "EufySecurity",
            "hkHome": 1,
            "hkNight": 3,
            "ignoreStations": [
                ""
            ],
            "hkOff": 63,
            "enableDetailedLogging": 0,
            "password": "password",
            "country": "US",
            "_bridge": {
                "username": "MAC:ADDRESS",
                "port": 59101
            },
            "cameras": [
                {
                    "serialNumber": "SN",
                    "enableCamera": true,
                    "enableButton": true,
                    "motionButton": true,
                    "rtsp": true,
                    "unbridge": true,
                    "forcerefreshsnap": false,
                    "useCachedLocalLivestream": false,
                    "videoConfig": {
                        "audio": true
                    }
                },
                {
                    "serialNumber": "SN",
                    "enableCamera": true,
                    "enableButton": true,
                    "motionButton": true,
                    "rtsp": true,
                    "unbridge": true,
                    "forcerefreshsnap": false,
                    "useCachedLocalLivestream": false,
                    "videoConfig": {
                        "audio": true
                    }
                },
                {
                    "serialNumber": "SN",
                    "enableCamera": true,
                    "enableButton": true,
                    "motionButton": true,
                    "rtsp": true,
                    "unbridge": true,
                    "forcerefreshsnap": false,
                    "useCachedLocalLivestream": false,
                    "videoConfig": {
                        "audio": true
                    }
                },
                {
                    "serialNumber": "SN",
                    "enableCamera": true,
                    "enableButton": true,
                    "motionButton": true,
                    "rtsp": false,
                    "unbridge": true,
                    "forcerefreshsnap": false,
                    "useCachedLocalLivestream": false,
                    "videoConfig": {
                        "audio": true
                    }
                },
                {
                    "serialNumber": "SN",
                    "enableCamera": true,
                    "enableButton": true,
                    "motionButton": true,
                    "rtsp": true,
                    "unbridge": true,
                    "forcerefreshsnap": false,
                    "useCachedLocalLivestream": false,
                    "videoConfig": {
                        "audio": true
                    }
                },
                {
                    "serialNumber": "SN",
                    "enableCamera": true,
                    "enableButton": true,
                    "motionButton": true,
                    "rtsp": true,
                    "unbridge": true,
                    "forcerefreshsnap": false,
                    "useCachedLocalLivestream": false,
                    "videoConfig": {
                        "audio": true
                    }
                }
            ]
        },
        {
            "name": "Wemo",
            "mode": "auto",
            "platform": "Wemo"
        },
        {
            "email": "my@email.com",
            "password": "password",
            "name": "myQ",
            "platform": "myQ"
        },
        {
            "name": "TplinkSmarthome",
            "addCustomCharacteristics": true,
            "broadcast": "IP",
            "deviceTypes": [
                "plug",
                "bulb"
            ],
            "platform": "TplinkSmarthome"
        },
        {
            "name": "Nest",
            "refreshToken": "token",
            "platform": "Nest"
        },
        {
            "refreshToken": "token",
            "options": {
                "ffmpegCodec": "libx264",
                "streamQuality": 2,
                "alertCheckRate": 10,
                "alertCooldownRate": 180,
                "importantOnly": true,
                "motionDetection": true,
                "streamingSwitch": true,
                "announcementsSwitch": true,
                "audioSwitch": true,
                "fieldTest": false
            },
            "platform": "Nest-cam",
            "_bridge": {
                "username": "MAC:ADDRESS",
                "port": 34408
            }
        },
        {
            "name": "Govee",
            "username": "my@email.com",
            "password": "password",
            "apiKey": "api-key",
            "apiWhitelist": true,
            "debug": false,
            "_bridge": {
                "username": "MAC:ADDRESS",
                "port": 49718
            },
            "platform": "Govee"
        }
    ],
    "accessories": [],
    "bridge": {
        "pin": "home-pin",
        "name": "Homebridge 693E",
        "bind": [
            "ens160",
            "ens192"
        ],
        "port": 52238,
        "username": "MAC:ADDRESS",
        "advertiser": "bonjour-hap"
    },
    "disabledPlugins": [
        "homebridge-wemo",
        "homebridge-google-nest-sdm",
        "homebridge-gsh"
    ]
}

This seems to be a different error message when attempting to open a feed on the eufyCam Pro 2 cameras (same error on both cameras).

[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard RTSP rtspStream:true
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard RTSP cameraConfig: true
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard RTSP true
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard RTSP "rtsp://<user_token>:<user_password>@CAM_IP/live1"
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard RTSP URL: rtsp://<user_token>:<user_password>@CAM_IP/live1
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard VIDEOCONFIG: {"audio":true,"stillImageSource":"-i https://cdn-us.eufylife.com/etc","maxWidth":640,"maxHeight":480,"maxFPS":10,"maxStreams":2,"maxBitrate":99,"vcodec":"libx264","packetSize":188,"source":"-i rtsp://<user_token>:<user_password>@CAM_IP/live1","acodec":"libfdk_aac","encoderOptions":"-preset ultrafast -tune zerolatency","forceMax":false}
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] INFO:  Backyard Starting video stream: 640x480, 30 fps, 299 kbps  (AAC-eld)
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard Stream command: ffmpeg -hide_banner -loglevel level -use_wallclock_as_timestamps 1 -i rtsp://<user_token>:<user_password>@CAM_IP/live1 -an -sn -dn -r 30 -vcodec libx264 -pix_fmt yuv420p -color_range mpeg -f rawvideo -preset ultrafast -tune zerolatency -filter:v scale='min(640,iw)':'min(480,ih)':force_original_aspect_ratio=decrease,scale='trunc(iw/2)*2:trunc(ih/2)*2' -b:v 299k -bufsize 598k -maxrate 299k -payload_type 99 -ssrc 4150782 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params <session_hash> srtp://MY_IP:55138?rtcpport=55138&pkt_size=188 -progress pipe:1
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Backyard Stream command: ffmpeg -i rtsp://<user_token>:<user_password>@CAMERA_IP/live1 -vn -sn -dn -codec:a libfdk_aac -profile:a aac_eld -flags +global_header -ar 16k -b:a 24k -ac 1 -payload_type 110 -ssrc 15302105 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params fxZiLig8J3xkTORB1wdYFJPhgjpkqWQCv4EKIlB+ srtp://MY_IP:62136?rtcpport=62136&pkt_size=188 -progress pipe:1
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] ERROR: Backyard FFmpeg exited with code: 1 and signal: null (Error)
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Stopping session with id: c5d49b26-739d-432a-b4b8-145549822862
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] INFO:  Backyard Stopped video stream.
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] ERROR: Backyard FFmpeg exited with code: 1 and signal: null (Error)
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: Stopping session with id: c5d49b26-739d-432a-b4b8-145549822862
[7/3/2022, 8:39:54 PM] [EufySecurity-2.0.1] DEBUG: No session to stop.

Seems to be hit or miss with getting the stream to work from one camera to another. I even tried the same with the Solo Cam P24's I have and got the same error on one while another worked fine.

thieren commented 2 years ago

There seems to be a problem with the ffmpeg process. To narrow down the cause I'd like you to try something:

  1. disable audio on the stream (remove audio: true from every videoConfig for the cameras you'd like to test)
  2. enable debug output for ffmpeg (add debug: true to the videoConfig of the cameras) --> so in essence you could just replace audio with debug
  3. try again once with rtsp enabled. If that doesn't work please disable rtsp also and try once more.
thieren commented 2 years ago

Closed, since this is a stale issue.

Please report back if the issue persists. Also please try latest beta beforehand.

metalcated commented 2 years ago

Yeah sorry I have not had time to dig back into this but it is still an issue. Video simply does not work now after having been re-connected since I opened this issue. Not a single camera works in HomeKit. 100% works in the Eufy app. I will try and get back to this later on tonight or tomorrow if/when I have time. Thanks.

thieren commented 2 years ago

Ok, as I mentioned please try the latest beta and the steps I mentioned above.

If this doesn't help please send me the log-lib.log file. The storage path should be written to the log at startup.

thieren commented 1 year ago

Again is stale... please provide the logs if the issue persists.

metalcated commented 1 year ago

Sorry for the huge delay in my response, work has been absolutely insane. Here is a test while trying to pull up a stream in HomeKit.

[12/1/2022, 5:33:10 PM] [EufySecurity-2.1.3] INFO:  [Backyard] [Video Process] Starting video stream: 1280x720, 30 fps, 299 kbps
[12/1/2022, 5:33:10 PM] [EufySecurity-2.1.3] INFO:  [Backyard] [Video Process] Starting audio stream: 16 kHz, 24 kbps, codec: libfdk_aac
[12/1/2022, 5:33:10 PM] [EufySecurity-2.1.3] ERROR: [Backyard] [Video Process] FFmpeg exited with code: 1 and signal: null (Error)
[12/1/2022, 5:33:19 PM] [homebridge-eufy-security] This plugin slows down Homebridge. The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory 'Backyard 99BE' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] DEBUG: Backyard Receive Apple HK Stop request{"sessionID":"5b4abf77-32bf-4599-9e48-83c71f98caeb","type":"stop"}
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] DEBUG: Stopping session with id: 5b4abf77-32bf-4599-9e48-83c71f98caeb
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP rtspStream:true
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP cameraConfig: true
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP true
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP "rtsp://user:pass@<camera_ip>/live1"
[12/1/2022, 5:33:19 PM] [EufySecurity-2.1.3] INFO:  Backyard Stopped video stream.
metalcated commented 1 year ago

The debug steps above do not change much, I restarted the bridge and now all of the cameras work with audio true or false. Strangely though my gut says after a while this will stop working after having been idle for some time. I will check in a few hours and report back. Thanks.

metalcated commented 1 year ago

After about 5 minutes, stopped working.

[12/1/2022, 5:56:51 PM] [EufySecurity-2.1.3] DEBUG: snapshot byte lenght: 37690
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: Backyard VIDEOCONFIG: {"audio":true,"useSeparateProcesses":false}
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP rtspStream:true
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP cameraConfig: true
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP true
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP "rtsp://user:pass@<camera_ip>/live1"
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP URL: rtsp://user:pass@<camera_ip>/live1
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] DEBUG: [Backyard] [Video Process] Stream command: /homebridge/node_modules/homebridge-eufy-security/node_modules/ffmpeg-for-homebridge/ffmpeg -hide_banner -loglevel level+verbose -use_wallclock_as_timestamps 1 -i rtsp://user:pass@<camera_ip>/live1 -an -sn -dn -r 30 -vcodec libx264 -pix_fmt yuv420p -color_range mpeg -preset ultrafast -tune zerolatency -filter:v scale='min(1280,iw)':'min(720,ih)':force_original_aspect_ratio=decrease,scale='trunc(iw/2)*2:trunc(ih/2)*2' -b:v 299k -bufsize 598k -maxrate 299k -payload_type 99 -ssrc 3017213 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params H6wDFo06gp8VEUHRm99acilqd2xgN9SS7qsYjt9Z srtp://<my_ip>:54345?rtcpport=54345&pkt_size=1128 -i rtsp://user:pass@<camera_ip>/live1 -vn -sn -dn -acodec libfdk_aac -profile:a aac_eld -flags +global_header -b:a 24k -ar 16k -ac 1 -payload_type 110 -ssrc 15572628 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params ofwy8RTPN5CH1NLFRiR8DmV1Mgh+Bs7L9WxOZnIL srtp://<my_ip>:54336?rtcpport=54336&pkt_size=188 -progress tcp://127.0.0.1:18121
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] INFO:  [Backyard] [Video Process] Starting video stream: 1280x720, 30 fps, 299 kbps
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] INFO:  [Backyard] [Video Process] Starting audio stream: 16 kHz, 24 kbps, codec: libfdk_aac
[12/1/2022, 5:56:56 PM] [EufySecurity-2.1.3] ERROR: [Backyard] [Video Process] FFmpeg exited with code: 1 and signal: null (Error)
[12/1/2022, 5:57:05 PM] [homebridge-eufy-security] This plugin slows down Homebridge. The write handler for the characteristic 'Selected RTP Stream Configuration' on the accessory 'Backyard 99BE' didn't respond at all!. Please check that you properly call the callback! See https://homebridge.io/w/JtMGR for more info.
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] DEBUG: Backyard Receive Apple HK Stop request{"sessionID":"f938e5cb-848d-445d-a228-cb55d324f274","type":"stop"}
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] DEBUG: Stopping session with id: f938e5cb-848d-445d-a228-cb55d324f274
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP rtspStream:true
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP cameraConfig: true
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP true
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] DEBUG: Backyard RTSP "rtsp://user:pass@<camera_ip>/live1"
[12/1/2022, 5:57:05 PM] [EufySecurity-2.1.3] INFO:  Backyard Stopped video stream.
thieren commented 1 year ago

Hi @metalcated

There are multiple ways to go about this:

There seems to be an error with the ffmpeg process. In the beta the according error should be printed out.

metalcated commented 1 year ago

Yeah I was just checking that before seeing your comment above. I just disabled rstp and after a while checked the camera, seemed to work still.

thieren commented 1 year ago

Well I'd suggest to test a few days and report back if anything changes.

thieren commented 1 year ago

@metalcated and? How's it going?

metalcated commented 1 year ago

Disabling rstp seems to be working. I left one camera with it enabled and that still is not working. I just disabled it and tried again. Working. The only other thing I would like to see is possibly improvement in the video quality. The native app looks 10x better than through HomeKit. I know if you enabled HomeKit compatibility via the Eufy app, it mentions reduced quality, is that something out of the control of this plugin?

thieren commented 1 year ago

Well the video quality is influenced by a factor of things.

You have some settings in the eufy app itself to set video quality etc. Then there are plugin settings. You'd have to share your config json, so that I can check if there's anything going on there. But essentially you could try the copy preset in the advanced setting for the cameras. Maybe that works and fulfils your needs.

Then there's the possibility that your homebridge system just struggles with the video encoding. If that's the case you'd have to try with another system.

Regarding the RTSP: did you check your rtsp settings in the eufy app for every camera? Maybe there is something wrong there? But if the normal mode is working, I'd probably just stick with this.

metalcated commented 1 year ago

Copy does seem considerably better yes. I can share the config if you still feel some additional tweaking could be done?

thieren commented 1 year ago

In general you won't do any better than to use copy quality wise. As long as this setting works for you, leave it at that. The only thing you could try otherwise, would be to tweak the settings in the eufy app, since these will define the quality of the source material for the plugin.

Is the issue resolved by this? Then we could close it for good measure. :-)

metalcated commented 1 year ago

Yep, this does seem resolved at this point. Thanks for all of your help!