ebaauw / homebridge-music

Homebridge plugin for iTunes with AirPlay speakers
Apache License 2.0
92 stars 7 forks source link

homebridge is loosing the devices from homebridge-music #12

Closed DJay-X closed 4 years ago

DJay-X commented 4 years ago

Hi there. Thanks for the time you are investing in this plugin and for your work.

I recently did a clean install of macOS Catalina. No Backup nothing. I freshly installed homebridge on my I iMac just to run your homebridge-music plugin. https://github.com/nfarina/homebridge/wiki/Install-Homebridge-on-macOS So on my installation is only this plugin and config-ui-x.

Everything was working fine. Homebridge is running and the first installation of the plugin and using it with Catalina and the new Music App instead of iTunes worked as well. All my Speakers and of course the Music switch (naming it still iTunes) was visible.

    "platforms": [
        {
            "name": "iTunes",
            "service": "switch",
            "platform": "Music"
        },

Unfortunately and I have no Idea why, the 10 devices are disappearing from time to time. The Bridge is still in HomeKit Home App but showing no devices anymore. After unload and load Homebridge, the devices are back but of course back in the default room.

Any idea what this issue could be?

Thanks in advance for your help to investigate in this.

Napkin 22 10 19, 6 51 22 PM

ebaauw commented 4 years ago

Accessories can only disappear when homebridge restarts. Typically this happens, when homebridge's server starts before the plugin has declared its accessories. In homebridge-music, this might happen when the AppleScript getState() doesn't return the speakers when run for the first time. It could be because of a timeout (which, unfortunately, is hard-coded to 5 sec), but you should see an error in the log. Especially when iTunes/Apple Music needs to be started it might take longer. When restarting homebridge after that, iTunes/Apple Music is still running, so now the script returns on time.

It could also be that the AppleScript works somewhat differently on Catalina, but I'm unable to test that. I haven't upgraded yet - I've burned myself in the past upgrading macOS too soon and now typically wait for the *.2 version.

DJay-X commented 4 years ago

Thanks Erik for you reply. I'll have an eye on the behavior of the iMac Homebridge and the Plugin in the next days. Maybe I can figure out or find a pattern when and how this occurs. But shouldn't the Plugin store everything of the devices somewhere? I'm more familiar with Homebridge on Raspberry and on the Pi, even restart several times in the week, never looses any devices.

Anyway, thanks again and maybe we will find a solution together. I appreciate your time and interest.

ebaauw commented 4 years ago

But shouldn't the Plugin store everything of the devices somewhere?

That depends on the plugin design. Older platform plugins, like homebridge-music, use the static accessory model, where accessories need to be advertised to homebridge, before the server starts. With the dynamic accessory model, plugins can add and remove accessories at runtime, and homebridge persists previously exposed accessories across restarts. I plan to refactor all my plugins to the dynamic accessory model, but this will take time.