maxileith / homebridge-airport-express-connected

Homebridge plugin that creates an occupancy sensor that shows wether or not there is an active AirPlay 2 connection to AirPort Express (2nd Gen.) devices.
MIT License
5 stars 0 forks source link

Read / write operation failed in HomeKit scripts after several minutes #85

Open seanwalter opened 6 months ago

seanwalter commented 6 months ago

Analysis

When checking occupancy for these sensors in HomeKit scripts and iOS shortcuts, I get a Read/Write operation failed error after the child bridge has been running for a few to several minutes. Upon restarting the child bridge, everything works again for a few minutes.

I see this error in the plugin logs; not sure if it’s relevant, but it seems worth noting:

(node:14447) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 packets listeners added to [EventEmitter].

I have 14 Airport Expresses plus two Homebridge Minis, in case the plugin assumes a smaller number of devices.

Thank you for any advice/suggestions on resolving this.

Expected Behavior

HomeKit scripts and iOS shortcuts should get occupancy value from plugin accessory without an error being generated.

Steps To Reproduce

Install plugin. Allow it to run for a few to several minutes. Check occupancy status of one of the plugin accessories via HomeKit automation script or iOS shortcut.

Logs

(node:14447) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 packets listeners added to [EventEmitter].

Configuration

{
            "name": "Airport Express Connected",
            "update": {
                "refreshRate": 3,
                "ignoreGroupWithLeadingDevice": true,
                "unreachable": {
                    "ignore": false,
                    "threshold": 30,
                    "reportDisconnected": true
                }
            },
            "discovery": {
                "enabled": true,
                "always": false,
                "intervals": 30,
                "whitelist": {
                    "list": [],
                    "enabled": false
                },
                "blacklist": {
                    "list": [],
                    "enabled": false
                },
                "discardKnownDevices": false
            },
            "_bridge": {
                "username": "xx:xx:xx:xx:xx:xx",
                "port": 44803
            },
            "platform": "AirportExpressConnected"
        },

Environment

Additional Context

No response

maxileith commented 5 months ago

Yeah, this is an issue with the current architecture that occurs when using the plugin with a lot of AirPort Expresses.

I am planning to fix that issue eventually. I will update you here. Currently, I cannot give you a timeframe.

seanwalter commented 5 months ago

Thank you. I’ll sit tight for now.