TomFaulkner / SenseMe

Python Library for Haiku SenseMe app controlled fans/lights
GNU General Public License v3.0
21 stars 10 forks source link

Consider fan, light, light+fan classes #8

Open TomFaulkner opened 7 years ago

TomFaulkner commented 7 years ago

Is there an advantage to that?

As far as I know a fan without a light kit shouldn't have a problem with irrelevant commands sent to it.

But, what happens when a light query is sent to a fan without a light kit, or a light without a fan?

Potential advantages: Easier to add other IoT devices if BAF/Haiku makes another IoT device that is neither a fan or a light. (Garage door opener?) Or, perhaps a garage door opener with a light. This would make for fewer methods to have to look through when controlling a device. (Does that matter?)

Potential downsides: Discovery will end up returning a list of objects that have different methods and user will have to avoid calling a method that isn't appropriate for the device type.

Could alleviate this by allowing for discovery of only fans, only lights, only fans with light kits, only garage door openers, etc.

Complicates things


Thoughts on this are a SenseMe class and Fan, Light, Toaster would inherit from SenseMe. Then a combination device FanWithLight would inherit from Fan and Light.