A REST api client (adapter) for the proprietary TP-Link Smart Home protocol to control TP-Link HS110 WiFi Smart Plugs. The SmartHome protocol runs on TCP port 9999 and uses a trivial XOR autokey encryption that provides no security. This application uses a REST api as a wrapper on the TCP socket connection. There is no authentication mechanism and REST endpoints documented in open api 3.1.
This project inspired by tplink-smartplug written in python and improves my Go knowledge.
Semantic Versioning 2.x is used. Version number MAJOR.MINOR.PATCH with
- MAJOR version increase on incompatible API changes
- MINOR version increase on adding new functionality in a backwards compatible manner
- PATCH version increase on backwards compatible bug fixes or documentation
The easiest way is to use the docker image. Otherwise, the artifact will have to be built by yourself.
$ docker pull larmic/tp-link-hs110-api
$ docker run -d -p 8080:8080 --rm --name larmic-tp-link-hs110-api larmic/tp-link-hs110-api
$ curl http://localhost:8080/tp-link-api # Open Api 3.1 specification
$ curl http://localhost:8080/tp-link-api/10.0.0.1 # General energy plug information
$ curl http://localhost:8080/tp-link-api/10.0.0.1/consumption # Energy consumption
- Docker
- Go 1.17.x (if you want to build it without using docker builder)
$ make docker-build # build local docker image
$ make docker-all # build docker container
$ make IMAGE_TAG="0.0.1" docker-all # build docker container with specific version
$ make run # start native app
$ curl http://localhost:8080/api/10.0.0.210 # call rest service
$ ctrl+c # stop native app
$ make docker-run # start docker image
$ curl http://localhost:8080/api/10.0.0.210 # call rest service
$ make docker-stop # stop and remove docker app