Closed mariusz2108 closed 5 years ago
@mariusz2108 I agree that this is quite inefficient; however, implementing this isn't straight forward due to the way HomeKit requests information.
The way I can see around it is for there to be a central function called something like getStatus
which will do the one request; then, when a variable is requested e.g. getTargetTemperature
, it asks the getStatus
function for this info rather than requesting it directly from the thermostat. However, the central function must ensure that the info is up-to-date.
Like I said, I agree that this would be an improvement and I'm interested in looking into implementing this into my fork of the plugin in the near future then creating a pull request into the main branch.
Best, Tom
I also agree, but according on how you will ask SIRI/Home App information, you will still have 4 Calls. Indeed, we can separate the call to get a lighter payload, but at the time I did the plugin, I didn't saw much difference.
And then I think about all the peoplle the have a working API that could be broken with a new implementation.
Do you think this is really an issue ?
@Tommrodrigues, if you do a PullRequest (what can be nice) I will wrap it into a new version. V1.X.X
Thx
I have made POC with "caching" results and it makes huge difference for me (my home bridge runs on raspberry pi). First request gets data and save it. Then I start timer for one minut. Sice now for one minute every request is taken from "cache".
I am not sure if it's good solution since I don't know well JS. But it works.
Not bad ;) it may be a good in between :) If you want to add a config param if unset that don’t cache it can make a good pull request :) Sent from my mobile device.
Le 19 févr. 2019 à 21:45, mariusz2108 notifications@github.com a écrit :
I have made POC with "caching" results and it makes huge difference for me (my home bridge runs on raspberry pi). First request gets data and save it. Then I start timer for one minut. Sice now for one minute every request is taken from "cache".
I am not sure if it's good solution since I don't know well JS. But it works.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub, or mute the thread.
Currently for one thermostat there are at least four exactly the same requests.
Below log: [19.02.2019, 18:29:11] [Thermostat] getTargetHeatingCoolingState from: http://localhost:9010/REST/homekit/status [19.02.2019, 18:29:11] [Thermostat] getTargetRelativeHumidity: 0.5 [19.02.2019, 18:29:11] [Thermostat] getTemperatureDisplayUnits: 0 [19.02.2019, 18:29:11] [Thermostat] getHeatingThresholdTemperature : 25 [19.02.2019, 18:29:11] [Thermostat] getCurrentTemperature from: http://localhost:9010/REST/homekit/status [19.02.2019, 18:29:11] [Thermostat] getCurrentHeatingCoolingState from: http://localhost:9010/REST/homekit/status [19.02.2019, 18:29:11] [Thermostat] getTargetTemperature from: http://localhost:9010/REST/homekit/status
So in above example there are four calls to http://localhost:9010/REST/homekit/statusw which is very inefficient