Reading out TP-Link HS110 on Linux/Raspberry Pi

By Atomstar on Sunday 25 November 2018 13:47 - Comments (2)
Categories: Linux, Smarthome, Views: 2.334

I bought a TP-Link HS110 version 3.0 smart wi-fi plug for 30 EUR to read out power usage of some appliances. I have a Raspberry Pi 3B+ to connect this to running domoticz and influxdb/grafana to visualise the data.

The device identifies itself as:
  "system": {
    "get_sysinfo": {
      "sw_ver": "1.4.3 Build 171009 Rel.104144",
      "hw_ver": "2.0",
      "type": "IOT.SMARTPLUGSWITCH",
      "model": "HS110(EU)",
      "mac": "ab:cd:ef:gh:ij:kl",
      "dev_name": "Smart Wi-Fi Plug With Energy Monitoring",
      "alias": "TP-LINK_Smart Plug_IJKL",
      "relay_state": 1,
      "on_time": 336,
      "active_mode": "none",
      "feature": "TIM:ENE",
      "updating": 0,
      "icon_hash": "",
      "rssi": 33,
      "led_off": 0,
      "longitude_i": 0,
      "latitude_i": 0,
      "hwId": "044A516EE63C875F9458DA25C2CCC5A0",
      "fwId": "00000000000000000000000000000000",
      "oemId": "1998A14DAA86E4E001FD7CAF42868B5E",
      "err_code": 0
where mac, the last 4 digits of alias, and the last 36 digits of deviceId have been masked.

Device setup

Here we connect the HS110 to our existing WiFi network without using the TP-link Kasa app and without it ever connecting to the TP-link cloud server.
  1. Plug into wall socket, the wifi symbol will blink green-amber.
  2. Get python clients
  3. Connect to HS110 access point TP-LINK_Smart Plug_XXXX.
    1. Get initial information:
      ./ -t -c info
  4. Disable cloud access:
    1. Set to resolve to (or similar)
    2. Set cloud server to new dummy value of trusted party: using
      ./ -t -j '{"cnCloud":{"set_server_url":{"server":""}}}'
      N.B. err_code:0 means no error
  5. Bind to existing WiFi network:
    ./ -t -j '{"netif":{"set_stainfo":{"ssid":"WiFi","password":"123","key_type":3}}}'
    N.B. This command is not encrypted so it will leak your SSID and network. There is no way around it as the official Kasa app uses the same protocol.
  6. Recommend to give it a fixed IP

Device read out

Now the device is connected to our WiFi network and we can use it as a measurement device
  1. Find out new IP
    1. On your router, look at connected devices, write down IP
    2. Ping broadcast address to find IP of all connected devices responding to ping: e.g. ping, the TP-link HS110 will respond
  2. Read out device:
    ./ -t -c energy

Implementing in Domoticz/Influxdb

Here I automate measurement data collection on my Rpi:
  1. Get updated script from, store somewhere
    git clone
  2. Install as crontab, e.g.
    */1 * * * * /home/pi/workers/hs110_reader/ -t -c energy --influxdb smarthome --influxdb_energy "energy,type=elec,device=hs110" --influxdb_power "power,type=elec,device=hs110"
Todo, probably: create virtual sensor/meter, update script to push to domoticz, adapt cron, done.


Accuracy is comparable to Brennenstuhl PM 231E offline power meter, which has a reported accuracy of 1% or 0.2W.
15W incandescent bulb
  • Reference measurement: 15.0±0.2W (average-by-eye)
  • TP-Link measurement: 15.03±0.09W (average of 10 measurements)
1300W heating iron
  • Reference measurement: 1340±5W (average-by-eye)
  • TP-link measurement: 1342W±5W (average of 14 measurements)
N.B. the heating iron's load drops 20W over the timeframe of a minute, such that these uncertainties are upper limits.

Power usage

The TP-link HS110 itself uses 4.3±0.2 Watt (as measured by Brennenstuhl PM 231E)


The plug starts up in ±8 seconds, and then takes ±3 seconds to join the WiFi network.


  1. Elgato Eve Energy works with Bluetooth (vs WiFi), compatible with Homekit. Could work on Linux using Homebridge, but this sounded like more trouble than reading out over Wi-Fi/HTTP
  2. Fibaro Wall Plug works with Z-wave (vs WiFi), requires additional Z-wave dongle, which I don't have. It's also more expensive than the TP-link. After that it could work on Linux, e.g. via this OpenHab post or this Youtube Tutorial


Volgende: Smarthome data logging with RPi/domoticz/influxdb/grafana 02-12 Smarthome data logging with RPi/domoticz/influxdb/grafana


By Tweakers user spone, Sunday 25 November 2018 22:47

The TP-link HS110 itself uses 4.3±0.2 Watt
Weet je zeker dat dit klopt? Lijkt me tamelijk hoog voor een mini bordje met wifi en een relais.

By Tweakers user Atomstar, Monday 26 November 2018 20:19

spone wrote on Sunday 25 November 2018 @ 22:47:

Weet je zeker dat dit klopt? Lijkt me tamelijk hoog voor een mini bordje met wifi en een relais.
4.3W is similar to a Raspberry Pi. After all, remember this is a mini Linux server including Wifi radio. It's a bit high, but not unreasonably so.

Comment form
(required, but will not be displayed)