home-assistant / core

:house_with_garden: Open source home automation that puts local control and privacy first.
https://www.home-assistant.io
Apache License 2.0
73.23k stars 30.58k forks source link

TPLink sockets stopped working #53755

Closed bessarabov closed 3 years ago

bessarabov commented 3 years ago

The problem

After updating from 2021.8.0b1 to 2021.8.0b4 all my 3 TPLink sockets stopped working (I'm using TPLink HS110 model).

On 2021.8.0b1 everything worked fine.

On the page IP:8123/config/integrations is see error "Retrying setup: Communication error":

Screen Shot 2021-07-30 at 15 46 26

I see that in beta4 two pull requests was added about TPLink:

What is version of Home Assistant Core has the issue?

core-2021.8.0b4

What was the last working version of Home Assistant Core?

core-2021.8.0b1

What type of installation are you running?

Home Assistant Supervised

Integration causing the issue

tplink

Link to integration documentation on our website

https://www.home-assistant.io/integrations/tplink/

Example YAML snippet

tplink:
  discovery: false
  switch:
    - host: 192.168.31.125
    - host: 192.168.31.138
    - host: 192.168.31.160
    - host: 192.168.31.242

Anything in the logs that might be useful for us?

Config entry 'TP-Link Smart Home' for tplink integration not ready yet: Communication error; Retrying in background

Additional information

No response

probot-home-assistant[bot] commented 3 years ago

Hey there @rytilahti, @thegardenmonkey, mind taking a look at this issue as it has been labeled with an integration (tplink) you are listed as a code owner for? Thanks! (message by CodeOwnersMention)


tplink documentation tplink source (message by IssueLinks)

bessarabov commented 3 years ago

I make a couple of experiments and now I know exactly that this broke in 2021.8.0b2. I've downgraded to 2021.8.0b1 and tplink sockets works fine, then I upgdate to 2021.8.0b2 and the sockets stop working.

I see that in 2021.8.0b2 there was PR #53596

mib1185 commented 3 years ago

Hi @bessarabov there are 4 hosts defined in your config, but only 3 devices on your screenshot. The message Config entry 'TP-Link Smart Home' for tplink integration not ready yet: Communication error; Retrying in background says, that there was an connection issue with one of the - in your configuration defined - devices and those setup of tplink platform will be retried until all devices become available.

For further troubleshooting, please enable debug log and provide the logs - to do so, please add the following to your configuration.yaml

logger:
  default: info
  logs:
    homeassistant.components.tplink: debug
    pyHS100: debug
bessarabov commented 3 years ago

I have 4 TPLInk HS110, but only 3 are now connected (the one is disconnected and stored in a box).

I have once again updated to the version 2021.8.0b2, configured the logger as you said — and here are the logs:

https://gist.github.com/bessarabov/dabd7c637b2a38c3ccd536fcd9a87fe5

bessarabov commented 3 years ago

I have commented out the socket that is not connected:

tplink:
  discovery: false
  switch:
    - host: 192.168.31.125
#    - host: 192.168.31.138
    - host: 192.168.31.160
    - host: 192.168.31.242

after that the sockets are working on 2021.8.0b2

But on version 2021.8.0b1 sockets were working even with ip address of not connected device.

mib1185 commented 3 years ago

@bessarabov may I ask you to test the linked PR if it works now without commenting the not connected socket?

bessarabov commented 3 years ago

Yes, I have tried your code on my server. Everything is working as expected. 3 sockets are available in HA and for the disconnected socket I see line in the logs Device at '192.168.31.138' not reachable during setup, will retry later

Thank you!

Some tech info how I tested it. I've used the code from commit 89f7cee1c53317365fb6ddbc993828c4ee0eae10 from your fork https://github.com/mib1185/homeassistant-core (link — https://github.com/mib1185/homeassistant-core/commit/89f7cee1c53317365fb6ddbc993828c4ee0eae10 )

I have taken 2 files from it:

And I have put them in my docker container homeassistant:

# docker exec -it homeassistant bash
bash-5.1# cd /usr/src/homeassistant/homeassistant/components/tplink
bash-5.1# cp __init__.py __init__.py.orig
bash-5.1# cp const.py const.py.orig
bash-5.1# vi __init__.py.new
bash-5.1# vi const.py.new
bash-5.1# cp const.py.new const.py
bash-5.1# cp __init__.py.new __init__.py

And then I have restarted HA.

bessarabov commented 3 years ago

Thank you for solving this!

(I have updated to 2021.8.0b7 and everything is fine with this version)

mbilsky commented 3 years ago

I updated to 2021.8 this morning and while it successfully added the new sensors to my HS300 power strip, it now broke all the switches that controlled the individual outlets. Any ideas?

mib1185 commented 3 years ago

I updated to 2021.8 this morning and while it successfully added the new sensors to my HS300 power strip, it now broke all the switches that controlled the individual outlets. Any ideas?

@mbilsky please open a new issue and please also enable debug log and provide the logs - to do so, please add the following to your configuration.yaml

logger:
  default: info
  logs:
    homeassistant.components.tplink: debug
    pyHS100: debug
mbilsky commented 3 years ago

Thanks! Posted here: https://github.com/home-assistant/core/issues/53989