Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

homebridge is loosing the devices from homebridge-music #12

Closed
DJay-X opened this issue Oct 22, 2019 · 3 comments
Closed

homebridge is loosing the devices from homebridge-music #12

DJay-X opened this issue Oct 22, 2019 · 3 comments
Labels
enhancement New feature or request question Further information is requested

Comments

@DJay-X
Copy link

DJay-X commented Oct 22, 2019

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
Copy link
Owner

ebaauw commented Oct 22, 2019

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
Copy link
Author

DJay-X commented Oct 22, 2019

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
Copy link
Owner

ebaauw commented Oct 22, 2019

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.

@ebaauw ebaauw closed this as completed Nov 12, 2019
@ebaauw ebaauw added the question Further information is requested label Nov 23, 2019
ebaauw added a commit that referenced this issue Nov 23, 2019
@ebaauw ebaauw added the enhancement New feature or request label Nov 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants