-
Notifications
You must be signed in to change notification settings - Fork 72
Migrate to Hue-sensors-phue #20
Comments
Created branch dev-phue. Currently I have copied |
Sure: in 0.60 the hue component handles both discovery and configuration; then it calls Now that I look at this again, I suspect this block is not called any more after that |
In other words, you have to change this:
should become something like:
|
@andreacampi thanks for your suggestion, I've made the changes and the component is now functional. I understand now that your HueBridge object is a wrapper to the phue bridge, so I end up with some awkward syntax of
My question is, what changes do you recommend to improve performance? Cheers! |
Awesome! I took a quick look but didn’t see anything obviously slow. I’d take a look at the API call’s timing, but you might not be able to do much to speed that up much. You can at least log the time it takes to get a sense of it. I was wondering if the hue component does any of the API calls, but it doesn't look like it. At most, it has instance of the phue |
Yeah I don't think you can do much about performance, other than reducing the polling interval (can't remember how from the top of my head). |
BTW I agree with you So for example
It's not a big deal but it encapsulated |
@technicalpickles & @andreacampi I believe the slow performance may be an issue with the way phue queries the API using get_sensor_objects(). There are rate limits and this issue highlights that the polling by phue is inefficient. One solution is to use get_sensor() with no id passed, which returns the full API data. However then I am using phue just to make a single request. Could you guys take a look and let me know what you think? If this is the case then I see no good reason to use phue as directly calling the API as I implemented previously performs well. EDIT: OK perhaps its parsing the phue object which is slow.. The following is parsing the json from the API, much faster.. EDIT 2: In ba6d923 I'm using the phue bridge object, calling get_sensors() and parsing with hue_sensors, and with scan_interval = 0.1 the updates are nice and fast :-) Note that these changes are required to the hue hub component - should submit a PR to update. |
Complete in c01de37 |
To do: migrate Hue-sensors-HASS to use https://github.com/robmarkcole/Hue-sensors-phue in preparation for submission as a full component in HA.
The text was updated successfully, but these errors were encountered: