Skip to content

feat: room list and live map over the local P2P channel - #169

Open
hclaria wants to merge 4 commits into
jeppesens:mainfrom
hclaria:feat/p2p-room-list
Open

hclaria wants to merge 4 commits into
jeppesens:mainfrom
hclaria:feat/p2p-room-list

Conversation

@hclaria

@hclaria hclaria commented Sep 5, 2026

Copy link
Copy Markdown

What

Adds the room list (with names) and the live floor map for mqtt=False devices like the S1 Pro. These devices expose neither on any DPS nor on the biz/ MQTT stream, so today the room dropdown is empty and the map camera stays blank.

image

How

  • New api/p2p/: opens the encrypted Tuya P2P map channel on the LAN with the device local key, runs the ICE/KCP handshake, and decodes the map stream. Pure asyncio, no new dependency. The channel and how to open it are documented in docs/P2P_MAP_CHANNEL.md.
  • The coordinator fetches the RTC config (device_password + ICE servers) from Tuya Cloud, runs one P2P session in the background on local connect, then:
    • fills data.rooms (room select enabled for local devices);
    • builds a MapData and feeds the existing map camera, so camera.<device>_map now works on local Tuya devices too.

Tested

  • End to end on an S1 Pro (T2080A, fw 7.0.170): 8 rooms and the rendered floor map show up live in HA, using the Tuya Cloud RTC config and LAN P2P, no capture involved.
  • Unit tests in tests/test_p2p.py: framing, KCP tag, room decode (keeps room id 0).

Notes

  • The device streams the real-time map only while moving; at rest it sends the room outline, which is enough to render a floor plan (the base is synthesized from it).
  • Live robot position and cleaning path ride the same channel and could follow.

Adds a pure-asyncio Tuya P2P client (api/p2p) that opens the encrypted map
channel on the LAN with the device local key, and returns the room list for
mqtt=False devices (e.g. S1 Pro) that expose it nowhere else. The coordinator
fetches the RTC config (device_password + ICE servers) from Tuya Cloud, runs the
P2P session in the background on local connect, and populates data.rooms; the
room select entity is enabled for local devices. Verified end to end against an
S1 Pro (T2080A, fw 7.0.170). See docs/P2P_MAP_CHANNEL.md.
Extends the P2P session to return the full conversation-5 snapshot, builds a
MapData from it (room outline synthesised into the renderer's base when the
real-time map is absent), and feeds the existing map camera. The camera now
works on local Tuya devices, not just MQTT. Rooms unchanged.
@hclaria hclaria changed the title feat: fetch the room list over the local P2P channel feat: room list and live map over the local P2P channel Sep 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant