Supereg / homebridge-http-switch

Powerful http switch for Homebridge: https://github.com/homebridge/homebridge
ISC License
219 stars 36 forks source link

Add option to specify an init step #58

Closed bachandi closed 3 years ago

bachandi commented 4 years ago

Sometimes the device needs some kind on initialisation before being able to report the status. An config option is added to allow an url being called to check if initialisation is needed and call another initialisation url in that case.

Supereg commented 4 years ago

Could you please explain the changes made in this PR in more detail? What do the new properties initStatusUrl, initStatusPattern and initUrl do? Why do you need them?

For me it seems this change makes http-switch unnecessary complicated and nobody really needs this features. It seems this is really only engineered to your exact problem statement. I don't really think I would want that added to http-switch.

bachandi commented 4 years ago

It is a bit cumbersome. But some http services need some initialization step first before they are able to react to commands. I tried to add it via these initStatusUrl,initStatusPattern and initUrl variables in the same style as you already have them.

initStatusUrl: Is the url to call to check if initialization has occurred. initStatusPattern: Is the pattern to be able to check if initialization has occurred. initUrl: Is finaly the url to be able to perform the init step.

It adds a bit more flexibility to the http switch and not that much more to justify an http-switch-with-initializer-option

Supereg commented 3 years ago

I don't think I will add this PR to the plugin as it solves a very specific problem only a minor subset of people need or encounter.