hyperion-project / hyperion.control

Kodi Addon to control Hyperion.
MIT License
31 stars 10 forks source link

Separate Instance Handling #18

Closed clutwo closed 1 year ago

clutwo commented 2 years ago

Thank you for this addon, I have used it a long time and it almost always worked flawlessly. I have now setup another LED instance in Hyperion, and unfortunately, it only works for the first instance.

When having multiple LED instances set up in Hyperion (one Arduino and one WLED in my case), only the first one gets updated according to hyperion-control settings.

According to API documentation, only one instance can be controlled with a connection (defaults to instance 0). To switch to another instance, the following command has to be sent:

// Switch to instance 1 { "command" : "instance", "subcommand" : "switchTo", "instance" : 1 }

This switches the context to instance 1 which can then be controlled normally.

This addon should work with an arbitrary amount of instances. For my case, it would be enough to apply the same settings for all instances for now, but maybe applying different settings (configured in the Control GUI) to different instances should also be considered.

clutwo commented 2 years ago

I have implemented a simple applying of settings to all running LED instances in ec6698686a28d008a84ccf821c02d62cffac0a46

On init, Connection retrieves server info and stores it. When sendComponentState is called, it checks for running instances, switches to each, and applies the settings.

newkind commented 1 year ago

@clutwo awesome! thank you so much for this! this is exactly what I needed!

@Lord-Grey can we add this to the next addon update, od does the @clutwo need to prepare a PR?