dave-code-ruiz / uhomeuponor

Custom Component to connect Home Assistant with Uhome Uponor Smatrix App
MIT License
19 stars 7 forks source link

Feature: Use one request to get lots of information #1

Closed LordMike closed 4 years ago

LordMike commented 4 years ago

Hi,

I've been reading the code a bit, and I think it's possible to reduce the number of API calls the code makes. As I read it, Uhome will make 14 + 11 * controllers + 23 * thermostats - which for me, at 2 controllers & 10 thermostats is 266 API calls.

I've just acquired a U@Home (R-167) and have tried making a call against it with two object requests instead of one. In the screenshots below (from fiddler), we can see the two responses come back. This should be expandable to all the objects and properties needed, so that Uhome.update() can become a three-call method.

image

image

Would an update like this be welcome?

dave-code-ruiz commented 4 years ago

Thanks a lot for your info. I know my code make a lot of API calls, but i dont know how can i reduce it. I try a change in my code with your info and work great! When i develop it for all objects i upload it. Thanks a lot.

dave-code-ruiz commented 4 years ago

Solved, thks @LordMike

LordMike commented 4 years ago

I see that you're doing a lot of JSON stuff manually. Wouldn't it make sense to build the JSON documents using the same JSON library you're parsing responses with?