I have been experimenting with local two-way audio on a physical Tapo C200 (HW 1.0, FW 1.3.17) and I think there is a reasonably small, self-contained media protocol layer that could fit in python-kasa.
The goal would not be to add media-player, TTS, transcoding or WebRTC support to python-kasa, but only to expose the low-level local Tapo media primitives required for microphone/talkback.
What I verified
On the C200, the media protocol is separate from the regular management API:
management: HTTPS :443
media: HTTP :8800 /stream
Talkback works locally using:
HTTP Digest authentication
→ open `talk` session (`mode: aec`)
→ receive a session id
→ G.711 A-law / PCMA, 8 kHz mono
→ minimal MPEG-TS
→ multipart stream with X-Session-Id
→ camera speaker
I validated this with a standalone Python POC against the physical camera:
audible generated tones played successfully through the speaker;
8/8 loopback checks captured the expected tone through the camera microphone;
a talk session remained stable for 30 seconds;
reopening sessions repeatedly works;
talkback works while preview is active;
talkback also works while the Tapo app live view is open;
no FFmpeg or other media framework is required for the speaker path.
The speaker path can be implemented using standard Python networking plus a small MPEG-TS muxer.
Relationship with existing python-kasa support
python-kasa already exposes or queries useful SmartCam information such as:
getAudioConfig;
audio_capability.device_speaker;
audio_capability.device_microphone;
getMediaEncrypt;
vhttpd;
the existing SmartCam credentials / SHA-256 credential hashing logic.
The existing SslAesTransport itself is not reusable because the media protocol is different, but some authentication/capability primitives can be shared.
Reference implementation
go2rtc already implements the same Tapo media protocol:
That works on the same C200, but I would prefer to keep it out of the first PR because it adds considerably more complexity and firmware/codec variations.
A second PR could add a low-level preview/audio iterator once the talkback transport is accepted.
Open questions
Before turning the POC into a proper PR, I would like feedback on:
Is a low-level SmartCam media transport within python-kasa's intended scope?
Would a speaker-only first PR be preferable?
Should the public API accept only encoded PCMA frames initially, or would a small PCM16 → G.711 helper also be appropriate?
Is there a preferred place for this transport/session layer in the current SmartCam architecture?
If this direction is acceptable, I can prepare a focused first PR with unit tests for authentication, session setup, multipart framing and deterministic MPEG-TS output, plus validation against the physical C200.
In case it helps with the design: the same port 8800 session also carries the recording side (SD card clip download, per clip thumbnails, live snapshot), and I wrote that part up in detail after getting it working from scratch on a C510W: https://github.com/freeKC/tapo-v4-protocol/blob/main/PROTOCOL.md (section 7, media port).
A few things from that work that may matter for the layer you propose:
the digest realm is shared by all media requests, but the password hash depends on the encrypt_type the camera advertises in WWW-Authenticate ("3" means SHA-256 upper of the cloud password, older firmware wants MD5);
one connection is bound to the media type of its first request, so talk, video and thumbnails need separate connections;
the camera only keeps one video session at a time and answers -52405 / -52407 / -52417 / -52435 when another one is active, so the layer needs an explicit stop and a short pause between sessions;
the multipart parts are AES-128-CBC with a key derived from the digest nonce, and the reader has to ack every 25 parts within a window of 50 or the camera stalls.
Happy to test a draft against my cameras (C510W on the new login, C410 on the old one) if that is useful.
Hey @juherr and thanks for the detailed proposal. I am not that familiar on details how av transports work, so I am just leaving a coupe of quick notes on high-level:
Exposing low-level interfaces through some API sounds good to me. We should try avoid doing any encoding/decoding etc. if feasible.
Speaker-only would definitely be preferred as there might be several moving parts, so the simpler the initial implementation the better. Having a way to output will also make funny demos possible (or using it as a speaker/doorbell, I guess). I have a TC65, so I can help with testing.
We should not add any dependencies or transcoding/encoding, the first step would be to accept a raw audio file and stream it to the device.
It would make sense to check how homeassistant handles such transports and what primitives are necessary, as that could be a candidate for this.
Activity
juherr commented on Sep 18, 2026
@rytilahti wdyt
freeKC commented on Sep 27, 2026
In case it helps with the design: the same port 8800 session also carries the recording side (SD card clip download, per clip thumbnails, live snapshot), and I wrote that part up in detail after getting it working from scratch on a C510W: https://github.com/freeKC/tapo-v4-protocol/blob/main/PROTOCOL.md (section 7, media port).
A few things from that work that may matter for the layer you propose:
Happy to test a draft against my cameras (C510W on the new login, C410 on the old one) if that is useful.
rytilahti commented on Oct 4, 2026
Hey @juherr and thanks for the detailed proposal. I am not that familiar on details how av transports work, so I am just leaving a coupe of quick notes on high-level:
It would make sense to check how homeassistant handles such transports and what primitives are necessary, as that could be a candidate for this.