# \[TP-Link\] New service development

**URL:** <https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747>\
**Category:** Développement\
**Created:** [November 15, 2020, 2:24pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747 "2020-11-15T14:24:45Z")\
**Posts on this page:** 17\
**Page:** 3

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [February 8, 2021, 7:45pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/41 "2021-02-08T19:45:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Ook](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/o/74df32/32.png) [@Ook](https://community.gladysassistant.com/u/Ook)\
**Post date:** [February 9, 2021, 7:41am UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/42 "2021-02-09T07:41:26Z")

</div>

It seems to refuse the connection:

```Sending
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
}

```

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [February 9, 2021, 10:03pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/43 "2021-02-09T22:03:54Z")

</div>

Thanks for the tests. After investigation, Tapo plugs and lights use a different communication protocol and security algorithms 🙁  
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](https://community.home-assistant.io/t/tp-link-tapo-p100/147792/5)

Tapo is a company that TP-Link bought with everything that comes with it (application, …). There is an issue [here](https://github.com/plasticrake/tplink-smarthome-api/issues/112) 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…

---

<div class="post-metadata">

**Author:** ![Ook](https://gladys-assistant-community.b-cdn.net/letter_avatar_proxy/v4/letter/o/74df32/32.png) [@Ook](https://community.gladysassistant.com/u/Ook)\
**Post date:** [February 9, 2021, 10:15pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/44 "2021-02-09T22:15:01Z")

</div>

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 ^^’

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 12, 2022, 4:22pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/45 "2022-01-12T16:22:47Z")

</div>

Hello!

I just reconnected my two plugs at home (HS100 and HS110)… But neither of them appears during the network scan… 🤔  
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?

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 12, 2022, 7:17pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/46 "2022-01-12T19:17:07Z")

</div>

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

Cf:

> **[tplink-smarthome-api](https://plasticrake.github.io/tplink-smarthome-api/)**
>
> Documentation for tplink-smarthome-api

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 12, 2022, 8:00pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/47 "2022-01-12T20:00:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![VonOx](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/vonox/32/10128_2.png) [@VonOx](https://community.gladysassistant.com/u/VonOx)\
**Post date:** [January 13, 2022, 8:16am UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/48 "2022-01-13T08:16:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [January 13, 2022, 8:31am UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/49 "2022-01-13T08:31:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 13, 2022, 9:15pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/50 "2022-01-13T21:15:54Z")

</div>

Gladys OS on a rpi4 boots from a USB key

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 13, 2022, 9:16pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/51 "2022-01-13T21:16:32Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 14, 2022, 9:21am UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/52 "2022-01-14T09:21:50Z")

</div>

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](https://play.google.com/store/apps/details?id=com.easymobile.lan.scanner&hl=fr) on Android or [iNet](https://itunes.apple.com/fr/app/inet-network-scanner/id340793353?mt=8) 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](https://github.com/GladysAssistant/Gladys/blob/master/server/services/tp-link/lib/smart-device/smart-device.getDevices.js#L26)

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

---

<div class="post-metadata">

**Author:** ![cicoub13](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/cicoub13/32/4482_2.png) [@cicoub13](https://community.gladysassistant.com/u/cicoub13)\
**Post date:** [January 14, 2022, 9:56am UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/53 "2022-01-14T09:56:34Z")

</div>

> [@pierre-gilles](#):
>
> why this value?

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?

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

```

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 14, 2022, 10:12am UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/54 "2022-01-14T10:12:32Z")

</div>

> [@cicoub13](#):
>
> But it would be better if @guim31 could do a test first (to isolate the bug).  
> Can you install this library and test the discovery?

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

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 14, 2022, 12:27pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/55 "2022-01-14T12:27:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![guim31](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/guim31/32/4840_2.png) [@guim31](https://community.gladysassistant.com/u/guim31)\
**Post date:** [January 14, 2022, 1:58pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/56 "2022-01-14T13:58:29Z")

</div>

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).

---

<div class="post-metadata">

**Author:** ![pierre-gilles](https://gladys-assistant-community.b-cdn.net/user_avatar/community.gladysassistant.com/pierre-gilles/32/5886_2.png) [@pierre-gilles](https://community.gladysassistant.com/u/pierre-gilles)\
**Post date:** [January 14, 2022, 2:23pm UTC](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747/57 "2022-01-14T14:23:13Z")

</div>

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

[Previous page](https://community.gladysassistant.com/t/tp-link-developpement-nouveau-service/5747.md?page=2)
