Great Python coding, saved me from writing one from scratch (Why re-invent the wheel right??)
anyway this detected my Wiz lights no issues. and allow me to turn them on and off. GREAT!!
I have modified the code slightly to implement brightness control..
AND IT WORKS BRILLIANTLY if i do say so myself.
- added 9 more variables for Brightness.
- modified the _get_info_of_accessory function to detect if the accessory has a brightness control if it does then return all the values associated with the brightness (just in case someone wanted to implement checks on the values). if not then return basically what you initially had.
- modified the print_accessories function to include brightness values if the accessory has brightness.
as well as changed the accessory print out 'Value' to 'On' which will either be True or False depending on the accessories power state.
- ADDED function get_brightness to return the current brightness setting of the accessory
- ADDED function set_brightness to be able to set the brightness of the accessory.
NOTES: Brightness as implemented by myself, and used in the Wiz lights, is a percentile between 1 and 100. so to set the brightness you pass in an integer between 1 and 100.
example: controller = HomeBridgeController(host=hostname, port=port, auth=auth)
controller.set_brightness('', 100)
will set the accessory to 100% brightness.
Let me know what you think!! and if you will implement my modifications :)
Anyway have attached the modified init.py. I have incremented the version to 0.0.4ac (the ac representing my name (Alan Crichton))
init.zip
May be able to expand it further for volume control (for accessories that have volume control as well) I have a LG TV that does, but it is not implemented as an accessory in HomeBridge just as a platform. HomeBridge, and Siri can control the TV but the TV is not exposed as an accessory outside of HomeBridge. I may try implementing the volume setting for accessories if and when i wish to set the TV up as an accessory.