[TP-Link] New service development

Hello,

I have started developing the TP-Link module to integrate this brand’s connected outlets and lamps.

You can test it with this Pull-Request and any feedback is welcome :smile:

Ping @Will9 @JPL @Boimb @damalgos @bouillou7 @Jap93

Top @cicoub13 congrats on this development :slight_smile:

I can’t wait to see this service running in Gladys Assistant

Hello
Cool, I just have 4 TPLink Wi-Fi bulbs ^^
To test, do we have to wait for the PR to be merged or is there a manipulation to perform to integrate it before?

It is possible to generate a test image from its branch.

Hello, I have generated a Docker image for all architectures: https://hub.docker.com/repository/registry-1.docker.io/cicoub13/gladys/tags?page=1

If you want to test:

docker run -d \
--log-opt max-size=10m \
--restart=always \
--privileged \
--network=host \
--name gladys-tp-link \
-e NODE_ENV=production \
-e SERVER_PORT=1080 \
-e TZ=Europe/Paris \
-e SQLITE_FILE_PATH=/var/lib/gladysassistant/gladys-tplink.db \
-v /var/run/docker.sock:/var/run/docker.sock \
-v /var/lib/gladysassistant:/var/lib/gladysassistant \
-v /dev:/dev \
cicoub13/gladys:dev-tp-link

I edited the command to avoid overwriting the production database and to use a different port.

Hello
I just tested your image

No devices found. Make sure you have connected one TP Link Plug to your wifi.

It does not detect any bulb on my network
The raspberry is on the same network as the bulbs and the ping works very well between them
What do I need for debugging?

Oh no. Can you run these two commands and give me the result?

Connecting to the Docker instance:
docker exec -it gladys-tp-link /bin/ash

Searching for devices on the network (this takes 10 seconds):
./services/tp-link/node_modules/.bin/tplink-smarthome-api search

Hello
Here is the return:

┌┼─┤ pi @ gladys ─┤├─ 09:06:43 ─┤(1200Mhz:61.8’C)
└┼─┤ ~ | $ :play_button:docker exec -it gladys-tp-link /bin/ash
/src/server # ./services/tp-link/node_modules/.bin/tplink-smarthome-api search
Searching…
startDiscovery({
discoveryInterval: 2000,
discoveryTimeout: 10000,
breakoutChildren: true,
broadcast: ‹ 255.255.255.255 ›
})
LB120(EU) bulb IOT.SMARTBULB 192.168.1.22 9999 50C7BFEFFFBA 8012059DA69A4DBED01168CE56FA04F018D122A6 Bedroom
LB100(EU) bulb IOT.SMARTBULB 192.168.1.23 9999 50C7BFA361C8 801236FAD6778A0D8E460CF84E7D2BC4189AA1E8 Kitchen
LB100(EU) bulb IOT.SMARTBULB 192.168.1.21 9999 50C7BFDAD944 8012C22D7A9D34CF0AEABD83255C2B6A18C57DCC Living room
/src/server #

There are indeed the 3 bulbs ^^

Thanks for the test :slight_smile:
I found a way to simulate bulbs and there was an error in device detection.
I published a new image with the fix :whale:

You can run the following commands to test:

docker stop gladys-tp-link
docker rm gladys-tp-link
docker pull cicoub13/gladys:dev-tp-link

And the command above to start a new container with this image (docker run …)

No problem

Re-test with the new image, it’s much better :grin:
Everything works except that I had to refresh several times to get the 3 bulbs (3 times in total)
I saw 2 the first time (bedroom, living room)
one only the second time (living room)
and the last one the third time (kitchen) :sweat_smile:

Thanks

For now, what about the on/off control for the bulbs?
Is there no color and brightness management? (0 to 100%)
Is this planned or not?

It’s planned, there is a feature here:

I’ve only worked on the On/Off functionality for outlets and lights.
It’s quite difficult for me to develop features for the lights without having them physically :sweat_smile:
I will probably finish the integration and testing for the simple integration of TP-Link devices.
And later integrate new features (based on Philips Hue, it should be fine).
What do you think about that?

And as @Tlse-vins says, I’m not sure that the boxes/dashboards front are ready.

A technical issue has been opened on the PR. It’s not ready yet.

I have completed all developments, tests, and documentation. PR ready.

Time for your tests and reviews :rocket: :sweat_smile:

I bought an hs110, I’m testing it this weekend

@cicoub13 Ok with the HS110 plug

Do you plan to bring back the consumption as well?

Yes, some outlets reduce consumption.
Should we add a feature like SWITCH.VOLTAGE?

I will check the information that is being reported.