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
71.11k stars 29.79k forks source link

Broadlink - Failed to connect to device #35311

Closed mattyteds closed 4 years ago

mattyteds commented 4 years ago

The problem

I donno what's going on but I'm having a lot of issues with 0.109. First it was affecting my TP-Link devices https://github.com/home-assistant/core/issues/35137 and now my broadlink device has stopped working. I can open the IHC app and control the device from there.

Environment

Problem-relevant configuration.yaml

- platform: broadlink
  host: 192.168.1.85
  mac: 'c8:f7:42:f5:eb:6d'
  timeout: 15
  retry: 5
  type: rm_mini
  switches:
    #TV:
    tv_studio:
      friendly_name: "Studio TV"
      command_on: 'JgAyAXA7DQ8NLQ0PDg8NDw4PDQ8NEA4PDBANEA0PDg4PKw0QDBANEA0PDg8NEA0PDg8NDw4rDg8ODw0PDg8NDw0QDg4NEA4rDg8OKw0sDSwOKw4PDRANLA0PDSwOKw4sDisODg4sDgAJhHA6Dg8NLA0QDBAODw0PDQ4PDw4PDg8NDw0PDw4OKw4PDg8NDw0QDQ8NEA0PDg8ODw0sDQ8NEA4PEQsNEA4ODRAODg4sDQ8NLA4rDiwNLA0PDRAOKw4PDSwOKw4rDSwODw4rDQAJhXA7DQ8OKw4PDg8MEA4PDQ8NEA0PDRANEA0PDg8OKw4ODRAODwwQDRANDw0QDg4NEA0sDQ8PDg4PDRANDw0QDQ8ODw0sDg8MLQ0sDisOKw0QDg4NLA0QDSwNLA0sDS0NDw0sDgANBQAAAAAAAA=='
      command_off: 'JgAyAXA7DQ8NLQ0PDg8NDw4PDQ8NEA4PDBANEA0PDg4PKw0QDBANEA0PDg8NEA0PDg8NDw4rDg8ODw0PDg8NDw0QDg4NEA4rDg8OKw0sDSwOKw4PDRANLA0PDSwOKw4sDisODg4sDgAJhHA6Dg8NLA0QDBAODw0PDQ4PDw4PDg8NDw0PDw4OKw4PDg8NDw0QDQ8NEA0PDg8ODw0sDQ8NEA4PEQsNEA4ODRAODg4sDQ8NLA4rDiwNLA0PDRAOKw4PDSwOKw4rDSwODw4rDQAJhXA7DQ8OKw4PDg8MEA4PDQ8NEA0PDRANEA0PDg8OKw4ODRAODwwQDRANDw0QDg4NEA0sDQ8PDg4PDRANDw0QDQ8ODw0sDg8MLQ0sDisOKw0QDg4NLA0QDSwNLA0sDS0NDw0sDgANBQAAAAAAAA=='
    #Stereo:
    stereo_studio:
      friendly_name: "Studio Stereo"
      command_on: 'JgBQAAABJ5QRFBEUERQRORAVEhISFBAVETgRORI5EBQTOBA5ETkROREUEhMRFBEUETkRFBITEBURORA5EjkROBEVEDkRORI4EQAFIgABJ0oSAA0FAAAAAAAAAAA='
      command_off: 'JgBQAAABJ5QRFBEUERQRORAVEhISFBAVETgRORI5EBQTOBA5ETkROREUEhMRFBEUETkRFBITEBURORA5EjkROBEVEDkRORI4EQAFIgABJ0oSAA0FAAAAAAAAAAA='

Traceback/Error logs

2020-05-06 20:34:28 WARNING (MainThread) [homeassistant.components.switch] Setup of switch platform broadlink is taking over 10 seconds.
2020-05-06 20:34:33 ERROR (SyncWorker_37) [homeassistant.components.broadlink.switch] Failed to connect to device

Additional information

I tried the fix here https://github.com/home-assistant/core/issues/34918#issuecomment-623233471 though it made no change.

mattyteds commented 4 years ago

I got it working. I disabled some custom integration, and disabled my guest network (I recently enabled this and I'm just ruling stuff out, nothing is connected to the guest network). After it started working I enabled my custom integrations again and it's still working. So it was either power cycling my router (Google Nest Wifi) or disabling my guest network. I'll leave the guest network disabled for now and see what happens. My TP-Link switches did not return but that's unrelated to this.

mattyteds commented 4 years ago

So, if I reboot the system Home Assistant is running on, Broadlink brakes, if I do a restart within home assistant after the reboot it fixes it.

mattyteds commented 4 years ago

I enabled debug logging but there's barely anything logged:

2020-05-06 22:16:48 DEBUG (SyncWorker_1) [homeassistant.components.broadlink.switch] _retry_times : 5
2020-05-06 22:16:48 DEBUG (SyncWorker_1) [homeassistant.components.broadlink.switch] _retry_times : 5
2020-05-06 22:17:03 ERROR (SyncWorker_1) [homeassistant.components.broadlink.switch] Failed to connect to device

I rebooted the system which broke Broadlink I turned on logging (where the retries occur) I did a reboot of the system which triggered the "Failed to connect" After the error I restarted home assistant (which resolved the issue) and nothing was logged.

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

broadlink documentation broadlink source (message by IssueLinks)

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

Hey there @danielhiversen, @felipediel, mind taking a look at this issue as its been labeled with a integration (broadlink) you are listed as a codeowner for? Thanks! (message by CodeOwnersMention)

felipediel commented 4 years ago

@tedrock It looks like a problem with your connection and not with the Broadlink integration itself. Just to be sure, let's see if these instructions work for you.

mattyteds commented 4 years ago

This appears to have resolved the problem. I agree it looked like a connection problem. But I could consistently reproduce it with a reboot of the system and fix it with a restart of the container. I'm unsure if those instructions fixed it or whatever connection issue that was occuring while doing a system reboot resolved itself.

felipediel commented 4 years ago

This new version is more reliable when a connection problem occurs. Good to know that your problem is solved. Thanks for the feedback!

felipediel commented 4 years ago

Fixed in https://github.com/home-assistant/core/pull/34670.

stale[bot] commented 4 years ago

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue now has been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.