starkillerOG / motion-blinds

Python library for interfacing with Motion Blinds
MIT License
23 stars 9 forks source link

Question / RFC #8

Closed d-EScape closed 3 years ago

d-EScape commented 3 years ago

How can a callback tell which blind triggered it when it is not possible to pass an argument to the callback?

If line 813 is changed from callback() to callback(self) then the (sending) MotionBlind instance would be available to the callback. But maybe there are better ways?

d-EScape commented 3 years ago

Solved it by wrapping the motion blind object inside another class that also includes it's own callback function.

https://github.com/d-EScape/MotionShades-for-Domoticz

starkillerOG commented 3 years ago

Yes you are correct, wrapping the motion blind object in a class is the way to go (at least I intended it that way). That is also how it is done in HomeAssistant.