[TP-Link] New service development

Yes the HS110 (consumption in watts)

If you want information don’t hesitate

I found this but I need to review my physics lessons :slight_smile:
I need to see if Gladys handles all this data:

current_ma: 125, (instantaneous consumption in milli Amperes?)
power_mw: 3140, (instantaneous consumption in milli Watts?)
total_wh: 51493, (total consumption in WattHour?)
voltage_mv: 122049 (instantaneous consumption in milli Volt?)

I have a HS100, I’m patiently waiting for the release :smiley:

Same for me, I just got equipped with 2 outlets: HS110 and HS100

Since the PR is almost merged, I think we should do it in several steps:

  • add the TP-Link service to allow adding bulbs / outlets with basic features (on/off) in the next release of Gladys
  • make a second PR to integrate the consumption of the outlets
  • make another PR to integrate colors/brightness/… when the boxes and features are ready in Gladys

Otherwise, integrating the service will take 1 month to be integrated. You will need to delete/recreate the devices to add the new features when they are available.

Would that work for you?

No problem at all, consumption is a bonus.

By the way, I tried to retrieve the information with the library but I failed. In the mobile app, I only have watts.

It suits me very well, I love seeing my devices appear in Gladys, even if not all the features are integrated yet… It calms my impatience a bit ^^ haha

100% agree on doing incremental (feature level, not quality level), that’s what we’ve been doing in v4 from the start :slight_smile: It’s better to ship progressively rather than have a several-month tunnel effect and end up with an integration that doesn’t meet the needs!

I repeat, in v4 the mantra is « we do a few things, but what we do, we do well ».

Since the service is ready and working on my separate instance, will it be integrated into Gladys 4.0.4?

Hello,

I may not be in the right place, but I just installed Gladys on my Raspberry 4. Gladys does not detect my TP-Link L510E bulb.

It is well configured in Wi-Fi but with the TAPO app (and not Kasa), I think it’s a compatibility issue (not the same app), but I wanted to know if that’s the case and if there will be development on it.

(And if I can help and how?)

Thank you.

Hello and welcome :wave: I’ve developed the TP-Link integration and it’s normally quite generic but I may have forgotten something. This should also work with the TAPO app.

Could you run the following commands on your Raspberry Pi and give me the result?
This will help me better understand the problem and integrate your device into Gladys if necessary.

docker exec gladys ./services/tp-link/node_modules/.bin/tplink-smarthome-api search

(you should get a result like this)

Searching...
startDiscovery({
  discoveryInterval: 2000,
  discoveryTimeout: 10000,
  breakoutChildren: true,
  broadcast: '255.255.255.255'
})
HS100(FR) plug IOT.SMARTPLUGSWITCH 192.168.1.95 9999 68FF7B01B726 8006838CDF953259CE6262C2644D32991B354C18 Coffee machine

Then, if a device is found, the result of the following command (replacing the IP with that of your device)?

docker exec gladys ./services/tp-link/node_modules/.bin/tplink-smarthome-api getSysInfo 192.168.1.95

(you should get a result like this)

Sending getSysInfo command to 192.168.1.95:  via tcp...
response:
{
  sw_ver: '1.5.5 Build 191125 Rel.114303',
  hw_ver: '2.0',
  type: 'IOT.SMARTPLUGSWITCH',
  model: 'HS100(FR)',
  mac: '68:FF:7B:01:B7:26',
  dev_name: 'Smart Wi-Fi Plug',
  alias: 'Coffee machine',
  relay_state: 0,
  on_time: 0,
  active_mode: 'none',
  feature: 'TIM',
  updating: 0,
  icon_hash: '',
  rssi: -58,
  led_off: 0,
  longitude_i: -5869,
  latitude_i: 448426,
  hwId: '11D803E325E41BCC381AE00341B472B4',
  fwId: '00000000000000000000000000000000',
  deviceId: '8006838CDF953259CE6262C2644D32991B354C18',
  oemId: '1967B9D71C3666B0D196769EE4452D38',
  next_action: { type: -1 },
  err_code: 0
}

hello, thank you for the quick reply,
i’m still discovering raspberry and the linux universe!
unfortunately, i can’t log in to the raspberry, it asks for a login/password that i don’t know (and i can’t type my email as login because of the qwerty keyboard)

i see in the requests that it talks about docker, i just flashed my sd card with gladys and i saw after that there is a dockerized installation, do you advise me to reinstall with docker?

finally, i didn’t find how to access the log… it’s frustrating!

sorry to bother you with noob questions!

thank you

Not noob questions at all :slight_smile:

To connect to the Raspberry Pi via SSH, you need to run the following command from the same network:
ssh pi@raspberry.local

The default password is raspberry (be careful with your qwerty keyboard). If that doesn’t work, you need to find the IP address of your Raspberry Pi (from your Wi-Fi box, for example) and run this command (with the IP):
ssh pi@192.168.1.10

If you have flashed an SD card with Gladys, everything is preinstalled. The commands I gave you earlier will work because Gladys is already installed on your Raspberry with Docker.

To access the logs, you can run the following command (once connected via SSH):
docker logs gladys

Don’t hesitate if one of the commands doesn’t work.

I was able to perform the commands (thanks for the manipulations)
I have

startDiscovery({
  discoveryInterval: 2000,
  discoveryTimeout: 10000,
  breakoutChildren: true,
  broadcast: '255.255.255.255'
})

but then nothing happens as if it couldn’t find it

I can ping the bulb from the Raspberry Pi; they are on the same local network through my Freebox (Raspberry Pi on 192.168.1.6 and bulb on 192.168.1.31)

Oh no. Can you run the following command anyway?

docker exec gladys ./services/tp-link/node_modules/.bin/tplink-smarthome-api getSysInfo 192.168.1.31

I will check if the library we are using supports this type of device.

@cicoub13 how is the DHCP managed?

I just realized that I have a lot of errors in the logs

2021-02-08T20:23:22+0100 <error> device.poll.js:24 (DeviceManager.poll) Error: connect ECONNREFUSED 192.168.1.13:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '192.168.1.13',

It has changed its IP (I don’t know why the lease was not renewed) Anyway

{
  sw_ver: '1.0.5 Build 200917 Rel.095956',
  hw_ver: '4.0',
  model: 'HS110(FR)',
  deviceId: '8006A89E9A29647E0C74D9BE87DE9D7B1D4B0D12',
  oemId: '246DE416BF8E57EE7F43ED52A8648B8E',
  hwId: '9DA4C15B2058AC9665D8E067D78A32BE',
  rssi: -63,
  alias: 'Office Plug',
  status: 'new',
  mic_type: 'IOT.SMARTPLUGSWITCH',
  feature: 'TIM:ENE',
  mac: '3C:84:6A:6B:3E:59',
  updating: 0,
  led_off: 0,
  relay_state: 1,
  on_time: 305009,
  active_mode: 'none',
  icon_hash: '',
  dev_name: 'Smart Wi-Fi Plug With Energy Monitoring',
  next_action: { type: -1 },
  err_code: 0
}

The IP change is not managed. If it changes, it must be reintegrated into Gladys.
But it should not change IP :neutral_face:

I’ll fix it for him, but this might happen to others. Is there anything we can do about that?

I could scan the network from time to time and if I find a device with the same deviceId but a different IP address, I update it in the database.

But doesn’t that seem too magical?

:slight_smile: or scan and remap via the MAC address if connection error?

Edit: Yes, that’s exactly what was just said ^^ but with the deviceId


I deleted my outlet from the integration, then scanned directly, and it didn’t find it

I had to change the page and go back to the integration to have my outlet detected.