smarthomeNG / smarthome

Device integration platform for your smart home
https://www.smarthomeNG.de
GNU General Public License v3.0
122 stars 92 forks source link

scheduler: add method to get all schedulers for smartplugin #652

Closed onkelandy closed 3 months ago

onkelandy commented 4 months ago

e.g. to easily remove all active scheduler on stop, etc. for scheduler in self.scheduler_get_all(): self.scheduler_remove(scheduler)

Feel free to improve/adapt the method, however I think it's convenient and useful when stopping/suspending plugins.

Morg42 commented 3 months ago

Alternative method with smartplugin tracking its own schedulers...

https://github.com/Morg42/smarthome/commit/9974633b7a308762278c245406c67a1a366fdb90

onkelandy commented 3 months ago

Actually alternative is cleaner. Maybe we could add a remove_all method to make it even easier eg for deleting schedulers on suspend/stop..?