fix: E340 talkback — streamType, seq counters, command routing#837
Open
CaCEO1 wants to merge 2 commits intobropat:developfrom
Open
fix: E340 talkback — streamType, seq counters, command routing#837CaCEO1 wants to merge 2 commits intobropat:developfrom
CaCEO1 wants to merge 2 commits intobropat:developfrom
Conversation
Develop > Master
…nd routing Three bugs prevent talkback (two-way audio) from working on the E340 Dual Cam Doorbell (T8214): 1. streamType 0x01 (doorbell mic) instead of 0x02 (talkback speaker) in buildTalkbackAudioFrameHeader — the doorbell silently ignores audio frames tagged with the wrong stream direction. 2. audioSeq and audioTimestamp are always zero — the doorbell expects incrementing sequence numbers (+1 per frame) and timestamps (+64 per frame for 64ms AAC-LC at 16kHz). Module-level counters are reset on each startTalkback() call. 3. startTalkback/stopTalkback route E340 through CMD_START_TALKBACK (1005) instead of CMD_DOORBELL_SET_PAYLOAD (1700) with CMD_START_SPEAK/CMD_END_SPEAK. The official Eufy app uses 1700 for this device — confirmed via pcap analysis. All three bugs confirmed via packet capture comparison between the official Eufy Security app and homebridge-eufy-security. Tested on real E340 hardware (T8214) with all fixes applied — talkback works. Ref: homebridge-plugins/homebridge-eufy-security#822
5c101da to
8836c85
Compare
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Talkback (two-way audio) is completely broken on the E340 Dual Cam Doorbell (T8214). Three bugs were identified through packet capture comparison between the official Eufy Security app and homebridge-eufy-security.
This PR fixes all three. Tested on real E340 hardware — talkback confirmed working.
Context: PR #793 fixed livestream routing for E340 but talkback routing was not addressed. These are the remaining talkback-specific bugs. Directed here by @lenoxys in homebridge-plugins/homebridge-eufy-security#822.
Bugs Fixed
1. Wrong
streamTypeinbuildTalkbackAudioFrameHeader(src/p2p/utils.ts)The magic bytes use
0x01(doorbell microphone stream) instead of0x02(talkback speaker stream). The doorbell silently ignores audio frames tagged with the wrong stream direction.Pcap evidence — official app always sends
0x02 0x00in the talkback audio header:2.
audioSeqandaudioTimestampalways zero (src/p2p/utils.ts,src/p2p/session.ts)Every talkback audio frame is sent with
audioSeq=0andaudioTimestamp=0. The doorbell expects incrementing values — the official app increments seq by 1 per frame and timestamp by 64 per frame (64ms AAC-LC frames at 16kHz).Inside
buildTalkbackAudioFrameHeader:Counters are reset at the start of each
startTalkback()call insession.ts.Pcap evidence — official app increments both fields:
3. Wrong talkback command routing (
src/http/station.ts)startTalkback()andstopTalkback()route E340 throughCMD_START_TALKBACK(command 1005), which the doorbell ignores. The official app usesCMD_DOORBELL_SET_PAYLOAD(1700) withCMD_START_SPEAK/CMD_END_SPEAK— the same path used by wired doorbells and indoor cameras.This is the same routing pattern already applied for livestream in #793, but was missing for talkback.
device.isOutdoorPanAndTiltCamera() || + device.isBatteryDoorbellDualE340() || (device.isIndoorPanAndTiltCameraS350() && !this.isDeviceControlledByHomeBase())Added to both
startTalkback()andstopTalkback()Branch A conditions.ECDH Key Exchange
PR #779 originally included an ECDH P2P key exchange fix for E340 alongside the livestream routing. It was reverted, and #793 re-applied only the livestream routing.
I've been running with the ECDH fix reintegrated on my E340 for weeks and P2P connectivity has been flawless — livestream connects reliably every time with no session failures. Without ECDH, the E340 intermittently fails to establish P2P sessions.
Could you share more context on why ECDH was excluded from the recovery in #793? Was there a specific concern, or was it simply scoped out to keep #793 minimal? I'd be happy to submit a separate PR for ECDH if the approach is acceptable.
Test Plan
npm run build:tscompiles without errorsisBatteryDoorbellDualE340()and the sharedbuildTalkbackAudioFrameHeader)Related