Post

Home Assistant Tapo Integration over Remote

Reading a remote Tapo H100 hub and its T310 sensors in Home Assistant through the Tapo cloud, no VPN needed.

Home Assistant Tapo Integration over Remote

I set up a Tapo H100 hub with a couple of T310 sensors on my Tapo cloud account. I pre-configured it with a Wi-Fi name (SSID), then moved it to a remote site with the same SSID, so it could connect directly. But Home Assistant’s built-in TP-Link integration1 only talks to the hub on the local network, so I couldn’t add it to HA.

A tunnel or VPN with a small Pi at the remote site would fix it. But the Tapo app shows the temperature from anywhere, so the cloud has it. Why not read it from there?

Passthrough Says “Offline”

TP-Link has no public API. tplink-cloud-api2 logs in like the Android app and sends passthrough requests that the cloud relays to a device. Login worked, but every request came back with:

1
{"error_code": -20571, "msg": "Device is offline"}

For every device, even the plug on my desk. The clue was "accessPlatform": "IOT" in the device list: current Tapo devices sit on TP-Link’s newer IoT platform, which passthrough can’t reach.

The IoT Shadows

Another project3 had hit the same wall with Tapo plugs and used an IoT app server instead, with the same login token:

EndpointGives
GET /v1/thingsall devices, hub sensors included, with an online flag
GET /v1/things/shadowseach device’s last reported state

The shadow had exactly what I wanted:

1
{"current_temp": 18.6, "current_humidity": 68, "at_low_battery": false}

One catch: the shadow has no timestamp. My second sensor showed 24.4 °C, which was my indoor temperature from before it moved. So when the cloud marks a sensor offline, HA shows unavailable, never an old number.

The Integration

I wrapped it into a custom integration, Tapo Remote (cloud)4:

  • Log in from the UI (two-step verification supported) and pick your sensors
  • Each sensor becomes a device: temperature, humidity, battery, connectivity
  • Read-only, polls every 5 minutes, standard library only
  • Also T100 motion, T110 door and T300 leak (untested, I only own T310s)

Tapo Remote integration page with two sensor devices The integration with both remote sensors as devices

Device page of a remote T310 sensor A remote T310: temperature and humidity, plus battery and cloud connectivity

Options dialog with the sensor list and update interval Configure picks the sensors and the update interval

Install it from HACS as a custom repository5 (https://github.com/zen29d/ha-tapo-remote, type Integration), restart, then add Tapo Remote (cloud) under Settings > Devices & services.

If HA can reach the hub on your network, use the built-in integration. It’s local and instant.

This is an unofficial API. It signs requests with the Tapo app’s key, and TP-Link can change it any day. Use it for your own devices.

Wrap Up

The code was the easy part. The real work was noticing that “offline” was lying, and that the old device list had only half the devices. Thanks to both projects that did the hard digging.

References

  1. piekstra, tplink-cloud-api: Tapo cloud login and request signing (GPL-3.0) ↩︎

  2. Aulig, solaredge-tplink-control: IoT app server and device shadows ↩︎

  3. zen29d, ha-tapo-remote: the integration from this post ↩︎

  4. HACS, Custom repositories ↩︎

This post is licensed under CC BY 4.0 by the author.