dcmeglio / hubitat-bond

BOND Home Integration for Hubitat
32 stars 20 forks source link

Update to asyncHttp commands #6

Open apwelsh opened 4 years ago

apwelsh commented 4 years ago

Can you rework the code to use the asyncHttpGet, asyncHttpPut, and asyncHttpPost commands? My hub is performing very poorly and it started when I installed the Bond Integration App. There is a known performance issue with the non-async http methods that slows down the hub. And converting the async resolves this. I am happy to fork the project and make the changes if you would be willing to merge them back into the master branch. To do this asynchronous calls does require some re-design of the code to eliminate the blocking http call based logic...

dcmeglio commented 4 years ago

Where did you hear of this "known performance issue"? On more than one occasion the hubitat staff has encouraged me to use synchronous calls instead of async

apwelsh commented 4 years ago

I looked closer at the code and see that your synchronous calls are really only for the configuration. I still need to dig into how the status refresh works, and API calls work in this code to see if it is an issue there.

I read a lot about this a while back when I was writing my Roku Integration. I am having a hard time locating the information right now. But I ended up switch everything from httpGet and hubEvent. (Which hubEvent is actually async) to asyncHttpGet and sure enough my Alexa integration and overall network integrations ran smoother. It had something to do with how the hub handles the event stack. And I just noticed that since I implemented the Bond integration my Hub evaluates events really slowly. A simply rule that turns on the ceiling fan when a button is pressed takes nearly 10 seconds. Another Ike that turns in a Hue Light when a button is pressed went from 2-3 seconds to 7-10 seconds. It could be hub related, but I noticed this uses synchronous calls and the HE devs don’t seem to acknowledge there are performance issues at present. And as stated, it started when I added the Bond integration.

I have not removed the Bond integration as a test, as I need it at the moment, but can do so once I can afford to not have the controls for a day.