studioimaginaire / phue

A Python library for the Philips Hue system
Other
1.52k stars 267 forks source link

get_sensor inefficient with requests #126

Open robmarkcole opened 6 years ago

robmarkcole commented 6 years ago

Currently the method to update the state of a sensor (get_sensor) is inefficient since each sensor makes a request:

https://github.com/studioimaginaire/phue/blob/00c85d8ce9790d7cc794d277af2d153c92c6009c/phue.py#L951

This is unnecessary since get_sensor_objects can request the data for all sensors in a single request:

https://github.com/studioimaginaire/phue/blob/00c85d8ce9790d7cc794d277af2d153c92c6009c/phue.py#L801

get_sensor could be updated to minimise the number of requests, as users with many sensors may run into request limits (I believe 30 requests per second is the maxiumum).

robmarkcole commented 6 years ago

OK this appears to be addressed in issue https://github.com/studioimaginaire/phue/issues/109

natcl commented 6 years ago

Would you be interested to make a PR ?