smhex / homebridge-wled-ws

Homebridge Plugin for LED strips controlled by WLED
Apache License 2.0
8 stars 1 forks source link

Update plugin to support homebridge v2 #145

Open LeLunZ opened 1 month ago

LeLunZ commented 1 month ago

With the newest homebridge version you now get a warning (that's not plugin specific):

NOTICE TO USERS AND PLUGIN DEVELOPERS
> Homebridge 2.0 is on the way and brings some breaking changes to existing plugins.
> Please visit the following link to learn more about the changes and how to prepare:
> https://github.com/homebridge/homebridge/wiki/Updating-To-Homebridge-v2.0

I currently can't test the plugin with v2 beta, because my esp isn't working :/


Also: With the newest version they have now also implemented a warning for characters in device names which can cause errors. In a plugin I help to maintain we use this function and just wrap all names/configuredNames.

smhex commented 1 month ago

I have seen those warnings too. However, I do not have a v2 beta up and running. Regarding the name functionality: where in the code would you implement it? It could be part of the configuration scheme...

LeLunZ commented 1 month ago

If you think about creating a scheme which a user has to follow when configuring the plugin, I am not 100% sure, If I would do it like that. Because for example with the Presets, if a user already has Presets configured in Wled, and now also needs to change the naming of them (to get them in sync with homebridge-wled-ws) it would be a bit of a hassle.

But I think the issue can just be resolved when stripping all unnecessary characters the initialisation step of a Service. Because you aren't really accessing the service anymore, because you got the actual name stored in your WledControllerPreset object.

I am actually not sure about the ConfiguredName (Characteristic) and displayName (second argument in the constructor). I will check that and see if those are also affected.

smhex commented 1 month ago

Yes, that sounds reasonable. Changing all the preset names is not the best option. However, the usage of the ConfiguredName property led to different results during my tests. My assumption is that Apple changed the something over the time...