core icon indicating copy to clipboard operation
core copied to clipboard

Somfy Homekit controller connection lost

Open Mariusthvdb opened this issue 2 years ago • 40 comments

The problem

as title

no way to reinstall, connection keeps 'trying'

reloading either Overkiz, or Homekit controller does not solve

device Tahoma Box is readily available on the network, at the correct ip address listed in the error, and cloud connection via the Overkiz intergration is functional, as is the native Somfy app

What version of Home Assistant Core has the issue?

2023.6 beta 0

What was the last working version of Home Assistant Core?

2023.5.x

What type of installation are you running?

Home Assistant OS

Integration causing the issue

Overkiz Homekit controller

Link to integration documentation on our website

https://www.home-assistant.io/integrations/homekit_controller/ https://www.home-assistant.io/integrations/overkiz/

Diagnostics information

No response

Example YAML snippet

No response

Anything in the logs that might be useful for us?

Logger: homeassistant.config_entries
Source: config_entries.py:1247 
First occurred: 07:55:58 (5 occurrences) 
Last logged: 08:12:59

Config entry 'Somfy TaHoma' for homekit_controller integration not ready yet: Timeout while waiting for connection to device 192.168.1.59:xxxxx; Retrying in background

Additional information

Scherm­afbeelding 2023-06-01 om 08 16 07

Mariusthvdb avatar Jun 01 '23 06:06 Mariusthvdb

Hey there @jc2k, @bdraco, mind taking a look at this issue as it has been labeled with an integration (homekit_controller) you are listed as a code owner for? Thanks!

Code owner commands

Code owners of homekit_controller can trigger bot actions by commenting:

  • @home-assistant close Closes the issue.
  • @home-assistant rename Awesome new title Renames the issue.
  • @home-assistant reopen Reopen the issue.
  • @home-assistant unassign homekit_controller Removes the current integration label and assignees on the issue, add the integration domain after the command.

(message by CodeOwnersMention)


homekit_controller documentation homekit_controller source (message by IssueLinks)

home-assistant[bot] avatar Jun 01 '23 06:06 home-assistant[bot]

Do you have any other (non Bluetooth) devices with homekit_controller that are working?

If this is the beta, my guess is it's the python upgrade. But @bdraco has a lot of homekit stuff so surprised he's not having troubles if it was that.

Can you post debug logs? Enable debug level for aiohomekit.

Jc2k avatar Jun 01 '23 06:06 Jc2k

yes my other integrations work fine:

Scherm­afbeelding 2023-06-01 om 08 29 06

If update b1 has finished I'll see for the logs

Mariusthvdb avatar Jun 01 '23 06:06 Mariusthvdb

Which ones of those are WiFi/Ethernet?

Jc2k avatar Jun 01 '23 06:06 Jc2k

Somfy: ethernet Dirigera: ethernet Smart CO: bluetooth

2023-06-01 09:27:02.763 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Accessories cache loaded (c#: 21) (gsn: None) (has broadcast_key: False)
2023-06-01 09:27:02.763 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Description updated: old=None new=HomeKitService(name='Somfy TaHoma', id='6b:79:c7:dc:45:0c', model='TaHoma', feature_flags=<FeatureFlags.SUPPORTS_SOFTWARE_AUTHENTICATION: 2>, status_flags=<StatusFlags: 0>, config_num=21, state_num=25, category=<Categories.BRIDGE: 2>, protocol_version='1.1', type='_hap._tcp.local.', address='192.168.1.59', addresses=['192.168.1.59', 'fe80::fa81:1aff:fe5b:c759', 'fd40:876f:9246:4b45:fa81:1aff:fe5b:c759', 'fd40:876f:9246:4b45:3046:df05:82b4:ab69', 'fe80::fa81:1aff:fe5b:c759', 'fd40:876f:9246:4b45:fa81:1aff:fe5b:c759', 'fd40:876f:9246:4b45:3046:df05:82b4:ab69'], port=xxxxx)
2023-06-01 09:27:02.763 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Disconnected event notification received; Triggering catch-up poll
2023-06-01 09:27:02.763 DEBUG (MainThread) [aiohomekit.zeroconf] 6B:79:C7:DC:45:0C: Device rediscovered
2023-06-01 09:27:02.763 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.1.59:xxxxx
2023-06-01 09:27:02.764 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-01 09:27:02.765 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 0 seconds
2023-06-01 09:27:03.517 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-01 09:27:03.518 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 0 seconds
2023-06-01 09:27:04.645 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-01 09:27:04.647 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 1 seconds
2023-06-01 09:27:06.337 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-01 09:27:06.340 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 1 seconds
2023-06-01 09:27:08.872 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-01 09:27:08.875 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 2 seconds
2023-06-01 09:27:12.673 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-01 09:27:12.675 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 3 seconds

does that help?

btw, I forgot to mention I also hard booted the Somfy Tahoma box to see if it would reconnect, but no change there

Mariusthvdb avatar Jun 01 '23 06:06 Mariusthvdb

But @bdraco has a lot of homekit stuff so surprised he's not having troubles if it was that.

All good here. No idea whats going on with this one.

Probably need a tcpdump

bdraco avatar Jun 01 '23 16:06 bdraco

exactly what do I do for that?

also, and it might be coincidence, but the last 2 days, I relied completely on the homekit controller because the Cloud connection to Somfy was down. It worked flawlessly before the Beta.... Luckily the cloud connection returned today, so I can still control the covers.

should I maybe delete the connection and try re-setup?

Mariusthvdb avatar Jun 01 '23 20:06 Mariusthvdb

I've never seen a homekit_controller bug that was fixed be re-doing the setup, and sometimes we just end up with 2 bugs to fix 😆

Jc2k avatar Jun 01 '23 21:06 Jc2k

I had it temporarily disabled, re-enabled it now and restarting.... fingers crossed..


nope, didnt help ;-(

Mariusthvdb avatar Jun 01 '23 21:06 Mariusthvdb

Screenshot 2023-06-01 at 4 52 56 PM

From the py-spy .. intresting.

bdraco avatar Jun 01 '23 21:06 bdraco

I'm adding some more logging in https://github.com/Jc2k/aiohomekit/pull/290

bdraco avatar Jun 01 '23 21:06 bdraco

with b3 and pr installed I now see thisnusing aiohomekit:debug :

2023-06-02 15:38:34.218 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Accessories cache loaded (c#: 21) (gsn: None) (has broadcast_key: False)
2023-06-02 15:38:34.218 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Description updated: old=None new=HomeKitService(name='Somfy TaHoma', id='6b:79:c7:dc:45:0c', model='TaHoma', feature_flags=<FeatureFlags.SUPPORTS_SOFTWARE_AUTHENTICATION: 2>, status_flags=<StatusFlags: 0>, config_num=21, state_num=35, category=<Categories.BRIDGE: 2>, protocol_version='1.1', type='_hap._tcp.local.', address='192.168.1.59', addresses=['192.168.1.59', 'fe80::fa81:1aff:fe5b:c759', 'fe80::fa81:1aff:fe5b:c759'], port=xxxxx)
2023-06-02 15:38:34.219 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Disconnected event notification received; Triggering catch-up poll
2023-06-02 15:38:34.219 DEBUG (MainThread) [aiohomekit.zeroconf] 6B:79:C7:DC:45:0C: Device rediscovered
2023-06-02 15:38:34.220 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.1.59:xxxx
2023-06-02 15:38:34.220 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-02 15:38:34.225 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 0 seconds
2023-06-02 15:38:34.978 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-02 15:38:34.981 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 0 seconds
2023-06-02 15:38:36.109 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-02 15:38:36.112 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 1 seconds
2023-06-02 15:38:37.803 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-02 15:38:37.805 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 1 seconds
2023-06-02 15:38:40.402 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-02 15:38:40.417 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 2 seconds
2023-06-02 15:38:44.216 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:xxxxx
2023-06-02 15:38:44.219 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Connecting to accessory failed. Retrying in 3 seconds

which doesn't really offer a lot more info I fear?

this seems to be new to me:

2023-06-02 15:40:04.392 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:xxxxx] (id=6B:79:C7:DC:45:0C): Disconnected event notification received; Triggering catch-up poll

Mariusthvdb avatar Jun 02 '23 13:06 Mariusthvdb

Is the ip address correct?

Jc2k avatar Jun 02 '23 13:06 Jc2k

And you have censored the port, but can you test it's open?

curl --verbose http://ip:port

Should do it

Jc2k avatar Jun 02 '23 14:06 Jc2k

no.... connection refused.

the ip address is correct though and I have no idea why it uses the port it does.

I did notice that after rebooting the Tahoma box, it got another portnumber, on the same ip address It's on my default network, so no client separation or stuff like that

Mariusthvdb avatar Jun 02 '23 15:06 Mariusthvdb

The port number is often random. On the Aqara hubs it changes at least once a day. So it changing is not that interesting, at least on its own.

Does the curl command work? What output do you get?

Jc2k avatar Jun 02 '23 15:06 Jc2k

That doesn’t look like the b3 message. I don’t think b3 is done yet

bdraco avatar Jun 02 '23 15:06 bdraco

ahh you're right, im sorry for that. still on b2 indeed.

curl did work, but connection refused:

curl --verbose http://192.168.1.59:xxx
*   Trying 192.168.1.59:xxx...
* connect to 192.168.1.59 port xxx failed: Connection refused
* Failed to connect to 192.168.1.59 port xxx after 11 ms: Couldn't connect to server
* Closing connection 0
curl: (7) Failed to connect to 192.168.1.59 port xxx after 11 ms: Couldn't connect to server

no idea why I redacted this port numbers.... maybe because there's talk of hackers currently and making it just a bit more difficult ;-)

btw, if I leave out the port it defaults to 80, and then the same message is returned

Mariusthvdb avatar Jun 02 '23 16:06 Mariusthvdb

Right - so if you used the same port as HA is currently using then your HA can't reach the ip, or the device itself is broken.

(HomeKit is HTTP like, but not exactly, so the test I suggest is technically undefined behaviour, but connection refused is an indication that the device is not even looking for connections on the ports you tried).

Jc2k avatar Jun 02 '23 16:06 Jc2k

what I dont get it this has worked up to 2 days ago, as said I even replace the failing Cloud connection of the official app/intergration with it.

from the moment that Cloud connection returned this is borked (and it coincided with the beta install, but that might be mere coincidence...)

I know I had developer mode local api enabled on the Tahoma, (for the integration to test local api connection. I dont use that currently)

thing is when I go to developer.somfy.com, I can get to my account, but not to the device page (figuring there might be some setting to control the Box). There is an error on their page...

that got fixed, I can see the dev page, and dev mode is indeed still enabled. all seems well there.

so for now I got to work with local tools. Is there anything else you can let me do to check the box (other than completely reset factory) and test the network capabilities.

scary thing is if I enter arp -a I see my lan devices, but not the ip address of the Tahoma box... while is there on the unifi switch and saying it is all good.. maybe reboot the switch?

And I repeat: It is online, has the latest firmware as confirmed by the developer site, and the app is fully functional, as is the core integration using that.

( I do understand Homekit is a different beast, but just saying)

Mariusthvdb avatar Jun 02 '23 18:06 Mariusthvdb

Let's see if anything turns up in the b3 logs.

Also, if you can get shell access to the HA container (not the OS) (use "which hass" to make sure you are in the right place) you can do:

tcpdump -ni eth0 host 192.168.1.59

That will let us see all traffic going to and from the device.

You can also do

tcpdump -w /config/capture.pcap -ni eth0 host 192.168.1.59

To make a file you can send to us with the full data.

(If command isn't there you can "apk --no-cache add tcpdump" - that will install it only until the next container upgrade).

Jc2k avatar Jun 02 '23 18:06 Jc2k

Also, if you can get shell access to the HA container (not the OS)

just so I do the right thing, you mean ssh [email protected] -p 22222

as I do for the py-spy's? https://community.home-assistant.io/t/instructions-to-install-py-spy-on-haos/480473

Mariusthvdb avatar Jun 02 '23 20:06 Mariusthvdb

If it's the right place "which hass" will return the path to the hass binary. If it returns nothing you are in the wrong place.

I think that command gets you into the OS, but not the container where HA lives.

Jc2k avatar Jun 02 '23 21:06 Jc2k

Your'e right, thats not it...

it needed the second command also: docker exec -it homeassistant /bin/bash

which hass
/usr/local/bin/hass

and, after having installed tcpdump I see this:

tcpdump -w /config/capture.pcap -ni eth0 host 192.168.1.59
tcpdump: eth0: No such device exists
(No such device exists)

using this in system monitor:

      - type: network_in
        arg: enp2s0

so should I replace that in the command maybe?

tcpdump -w /config/capture.pcap -ni enp2s0 host 192.168.1.59

it does not seem to hold a lot of info though

capture.pcap.zip

2nd run a bit longer, after having rebooted the switch. capture.pcap.zip

running that arp -a command now does reveal the box:

(192.168.1.59) at f8:81:1a:5b:c7:59 [ether] on enp2s0

so that at least is something

Mariusthvdb avatar Jun 02 '23 21:06 Mariusthvdb

Yes

Jc2k avatar Jun 02 '23 21:06 Jc2k

You can also use https://apps.apple.com/us/app/discovery-dns-sd-browser/id305441017 to verify which port is being published via mdns

bdraco avatar Jun 03 '23 15:06 bdraco

this is what I see on b4 now:

2023-06-03 22:24:57.156 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Accessories cache loaded (c#: 21) (gsn: None) (has broadcast_key: False)
2023-06-03 22:24:57.156 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Description updated: old=None new=HomeKitService(name='Somfy TaHoma', id='6b:79:c7:dc:45:0c', model='TaHoma', feature_flags=<FeatureFlags.SUPPORTS_SOFTWARE_AUTHENTICATION: 2>, status_flags=<StatusFlags: 0>, config_num=21, state_num=35, category=<Categories.BRIDGE: 2>, protocol_version='1.1', type='_hap._tcp.local.', address='192.168.1.59', addresses=['192.168.1.59', 'fe80::fa81:1aff:fe5b:c759'], port=32127)
2023-06-03 22:24:57.157 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Disconnected event notification received; Triggering catch-up poll
2023-06-03 22:24:57.157 DEBUG (MainThread) [aiohomekit.zeroconf] 6B:79:C7:DC:45:0C: Device rediscovered
2023-06-03 22:24:57.157 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.1.59:32127
2023-06-03 22:24:57.158 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:32127
2023-06-03 22:24:57.161 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Somfy TaHoma [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Connecting to accessory failed: [Errno 111] Connect call failed ('192.168.1.59', 32127); Retrying in 0 seconds
2023-06-03 22:24:57.914 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:32127
2023-06-03 22:24:57.917 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Somfy TaHoma [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Connecting to accessory failed: [Errno 111] Connect call failed ('192.168.1.59', 32127); Retrying in 0 seconds
2023-06-03 22:24:59.044 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:32127
2023-06-03 22:24:59.047 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Somfy TaHoma [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Connecting to accessory failed: [Errno 111] Connect call failed ('192.168.1.59', 32127); Retrying in 1 seconds
2023-06-03 22:25:00.736 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:32127
2023-06-03 22:25:00.740 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Somfy TaHoma [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Connecting to accessory failed: [Errno 111] Connect call failed ('192.168.1.59', 32127); Retrying in 1 seconds
2023-06-03 22:25:03.274 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:32127
2023-06-03 22:25:03.276 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Somfy TaHoma [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Connecting to accessory failed: [Errno 111] Connect call failed ('192.168.1.59', 32127); Retrying in 2 seconds
2023-06-03 22:25:06.078 DEBUG (MainThread) [aiohomekit.controller.abstract] [192.168.1.72:8000] (id=0E:E6:80:61:57:3D): Accessories cache loaded (c#: 14) (gsn: None) (has broadcast_key: False)
2023-06-03 22:25:06.078 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Starting reconnect loop to 192.168.1.72:8000
2023-06-03 22:25:06.078 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.72:8000
2023-06-03 22:25:07.090 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.59:32127
2023-06-03 22:25:07.091 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Somfy TaHoma [192.168.1.59:32127] (id=6B:79:C7:DC:45:0C): Connecting to accessory failed: [Errno 111] Connect call failed ('192.168.1.59', 32127); Retrying in 3 seconds
2023-06-03 22:25:09.165 DEBUG (MainThread) [aiohomekit.controller.ip.connection] [192.168.1.72:8000] (id=0E:E6:80:61:57:3D): Connecting to accessory failed: [Errno 113] Connect call failed ('192.168.1.72', 8000); Retrying in 0 seconds
2023-06-03 22:25:09.917 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.72:8000
2023-06-03 22:25:12.238 DEBUG (MainThread) [aiohomekit.controller.ip.connection] [192.168.1.72:8000] (id=0E:E6:80:61:57:3D): Connecting to accessory failed: [Errno 113] Connect call failed ('192.168.1.72', 8000); Retrying in 0 seconds
2023-06-03 22:25:13.364 DEBUG (MainThread) [aiohomekit.controller.ip.connection] Attempting connection to 192.168.1.72:8000
2023-06-03 22:25:15.310 DEBUG (MainThread) [aiohomekit.controller.ip.connection] [192.168.1.72:8000] (id=0E:E6:80:61:57:3D): Connecting to accessory failed: [Errno 113] Connect call failed ('192.168.1.72', 8000); Retrying in 1 seconds

uncensored...

notice the 192.168.1.72 address, which is a bit of a surprise, as I dont have that...

Mariusthvdb avatar Jun 03 '23 20:06 Mariusthvdb

That's consistent with the curl failure. So looking like a zeroconf problem (try the app @bdraco said) or a network problem.

Jc2k avatar Jun 03 '23 20:06 Jc2k

Discovery gives me

Somfy TaHoma._hap._tcp.local.

gateway-1236-2325-6238.local:32127 192.168.1.59:32127 fe80::fa81:1aff:fe5b:c759%en0:32127 192.168.1.59:32127

c# = 21 ci = 2 ff = 2 id = 6B:79:C7:DC:45:0C md = TaHoma pv = 1.1 s# = 35 sf = 0 sh = xxdxpA==

Mariusthvdb avatar Jun 03 '23 20:06 Mariusthvdb

Can you post the output of this (from your ha container ideally)

ip route get 192.168.1.59

Jc2k avatar Jun 03 '23 20:06 Jc2k