jso / py-wink

Python library for interfacing with Wink devices by Quirky
MIT License
46 stars 25 forks source link

Please support GE Link (and other) Light bulbs #9

Closed seitzbg closed 9 years ago

seitzbg commented 9 years ago

Please support GE Link (and other) Light bulbs as devices. alternatively, how would I add this support myself?

TIA,

jso commented 9 years ago

Hi Bryan,

I think it should be simple to add support for a new device type. All the device types are defined as classes in wink/devices.py.

1) You can get the base functionality (e.g. listing devices) by simply adding a class like: "class light_bulb(DeviceBase, Sharable): pass". (I'm not 100% familiar with the light bulb API, so you may need to change "light_bulb" to match the device/category name used by the API.) 2) Override the non_config_fields and mutable_fields static class members so py-wink knows what values it can read and write, and the type of the values to accept. 3) To my knowledge this isn't necessary for the light bulb use case, but you will also need to define the subdevice types and list them in the "subdevice_types" static class member if you want py-wink to be aware of these.

Feel free to send me a pull request for this and I'll review it tonight; I don't have a light bulb to test with, but would love to have this supported.

Thanks, John