[TP-Link] New service development

OK, I’ll take a look. You’ll tell me how to change the IP of a port so I can test it :wink:

It seems to refuse the connection:

TCP 192.168.1.31:9999 Error: connect ECONNREFUSED 192.168.1.31:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '192.168.1.31',
  port: 9999
}
Error:
Error: connect ECONNREFUSED 192.168.1.31:9999
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1144:16) {
  errno: 'ECONNREFUSED',
  code: 'ECONNREFUSED',
  syscall: 'connect',
  address: '192.168.1.31',
  port: 9999
}

Thanks for the tests. After investigation, Tapo plugs and lights use a different communication protocol and security algorithms :slightly_frowning_face:
So no easy integration in Gladys without developing specifically for these devices.

If you want more details, there is a thread from our competitors about a P100 plug that also doesn’t work: TP-Link Tapo P100 - #5 by iain - Hardware - Home Assistant Community

Tapo is a company that TP-Link bought with everything that comes with it (application, …). There is an issue here to add support for Tapo devices to the library we use. But you will still need to enter your TP Link Cloud account to generate the keys necessary for local communication…

ok thanks for the support, I was looking for cheap bulbs before I started, and I had tested this one that I found near me, and I only found that which could have been compatible. otherwise I only have access to Ledvance or Nordlux! I’ll have to change my shopping location ^^’

Hello!

I just reconnected my two plugs at home (HS100 and HS110)… But neither of them appears during the network scan… :thinking:
I did everything right in terms of connection / reset of the plugs, they are connected to my local network, just like Gladys.

Any idea for debugging this?

@guim31 It’s strange because the library we’re using is indeed compatible with these models.

Cf:

Yeah, I admit I’m lost here. Both outlets do appear in my Kasa app.

No issues on my end, is gladys installed at your place too?

Tested last night, my HS100 outlet (reset) is still detected.

Gladys OS on a rpi4 boots from a USB key

It seems that either I’ve found a little bug… Or I’m doing something wrong! :joy:

Network scans are always very shaky and depend on many factors:

  • Your network configuration: anything special?
  • If you use a network scanning app (Network Scanner on Android or iNet on iOS), do you see your outlets?

Another possibility I see by reading the code is that the search timeout in the integration is 1.9 seconds, which I find extremely low…

Cf: Gladys/server/services/tp-link/lib/smart-device/smart-device.getDevices.js at master · GladysAssistant/Gladys · GitHub

@cicoub13 any idea why this value? I think on the Philips Hue side the scan timeout is 10 seconds…

This was a compromise between discovering the most devices and waiting as little as possible.
According to my tests, 2 scans (1 every 800ms) were sufficient.
I can increase the value.

But it would be better if @guim31 could test it first (to isolate the bug).
Can you install this library and test the discovery?

npm install -g tplink-smarthome-api
tplink-smarthome-api search

I agree, it’s not necessarily that, so @guim31 should do a test on his side.

My network configuration has one particular feature: I use Openmptcprouter to aggregate my Adsl and 4G.
However, I am connected to my local network (address type 192.168.100.xxx), so I don’t think there’s anything very special.

Ok @pierre-gilles @cicoub13 … MY BAD!
I always feel stupid when I ask people for help when the problem is on my end… Sorry guys.

During my recent move, I had to reconfigure my WiFi router and I messed it up, so the outlets ended up not being on the same sub-network as Gladys (even though I was convinced otherwise). Your messages really helped me identify the issue.

By the way @cicoub13, I don’t know if you had worked more extensively on the power consumption reporting? My HS110 appears as a simple plug (like the HS100 in fact).

No worries, it happens to everyone :slight_smile: Good to hear it’s working now!