brutella / hkknx-public

hkknx is a HomeKit KNX bridge for KNX.
https://hochgatterer.me/hkknx
97 stars 6 forks source link

write udp: use of closed network connection #327

Open thpeetz opened 1 week ago

thpeetz commented 1 week ago

Hi there.

I have a recurring issue with hkknx. Basically everything works fine after a system restart, then after a while I can't control the devices I added via hkknx anymore on Apple Home.

Example output in the system log triggered by me using Apple Home to try and activate an outlet:

` Type Time Source Message
DEBUG 2024/06/22 13:00:01 characteristics.go:180 {"characteristics":[{"aid":4,"iid":10,"value":1}],"pid":0}
DEBUG 2024/06/22 13:00:01 writer.go:45 write 1 to 4/0/20
DEBUG 2024/06/22 13:00:01 writer.go:48 write udp 169.254.138.248:36153->192.168.68.70:3671: use of closed network connection
DEBUG 2024/06/22 13:00:01 bool.go:37 write udp 169.254.138.248:36153->192.168.68.70:3671: use of closed network connection
DEBUG 2024/06/22 13:00:01 characteristics.go:259 {"characteristics":[{"aid":4,"iid":10,"status":-70402}]}
DEBUG 2024/06/22 13:00:01 logger.go:161 "PUT http://KNX-Homekit_Bridge._hap._tcp.local/characteristics HTTP/1.1" from 192.168.68.50:49366 - 207 56B in 2.845513ms
DEBUG 2024/06/22 13:00:43 characteristics.go:144 {"characteristics":[{"aid":1,"iid":7,"value":"2.8.2"}]}
DEBUG 2024/06/22 13:00:43 logger.go:161 "GET http://KNX-Homekit_Bridge._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.68.50:49366 - 200 55B in 492.603µs
DEBUG 2024/06/22 13:01:48 characteristics.go:144 {"characteristics":[{"aid":1,"iid":7,"value":"2.8.2"}]}
DEBUG 2024/06/22 13:01:48 logger.go:161 "GET http://KNX-Homekit_Bridge._hap._tcp.local/characteristics?id=1.7 HTTP/1.1" from 192.168.68.50:49366 - 200 55B in 554.79µs

`

At the same time the hkknx Group Monitor doesn't record anything anymore, and hkknx scripts stop working.

I'm running hkknx 2.8.2 on a Raspberry Pi using the disk image that is linked in the documentation. I updated hkknx from there using the web interface. The Pi is connected to my network by cable.

Things I've tried and that didn't change anything:

I am unable to reproduce the "crash", whatever it may be. It happens about once per 24 hours. I have multiple scripts running continuously but they don't spam messages - they mainly wait for specific times of the day to fire a single message.

Any help would be appreciated. I'm not enough of an expert to know if this is a duplicate of #308.

brutella commented 1 week ago

It looks like your connection to the KNX gateway gets closed after some time.

What KNX IP gateway are you using?

thpeetz commented 1 week ago

I have an MDT SCN-IP000.03.

brutella commented 5 days ago

Do you have other systems/software connected to your KNX IP gateway via tunnelling?

thpeetz commented 4 days ago

ETS6. Nothing else comes to mind.

For what it's worth, I have hkknx v2.8.1 running for a few days now and things still work without interruption. Much longer than I was able to run on 2.8.2. I'll switch off the nightly reboot of my Raspberry Pi and see if it really runs uninterrupted or if I was just lucky for a few days.

brutella commented 1 day ago

Are you able to check, if the connection issue still persists in any of the 3.0.0 beta version?