withenergy construction option, get_homes() get_devices() get_energy() methods#7
withenergy construction option, get_homes() get_devices() get_energy() methods#7lupus78 wants to merge 1 commit intoDanielhiversen:mainfrom
Conversation
…sed on /content/ endpoint. get_homes() get_devices() get_energy() methods
|
Is that different than the energy data from fetch_energy_info? Line 141 in f0748e7 |
Not the same. This one is a log for each device and aggregate by hours. The one with the content endpoint is by Room and for the last hour. As you can see the Blue line is from the content?withEnergy endpoint. I query it every 10 minutes, and you can see it's progressing throughout the hour and resets. |
|
So the energy data is then stored in |
yes |
| @@ -104,13 +122,18 @@ async def _write_set_room_target_temperature(self, json_data): | |||
|
|
|||
| async def fetch_rooms_info(self): | |||
There was a problem hiding this comment.
I would suggest to add an include_energy parameter and then remove self.withenergy
There was a problem hiding this comment.
In the current structure that would mean to pass it down from get_room and update
| self._write_task = None | ||
| self._pending_writes = {"rooms": []} | ||
|
|
||
| async def get_homes(self): |
There was a problem hiding this comment.
I think it would be better to not do self.update() in all these functions. Should be possible to get self._homes without forcing an update.
(Should not had self.update() in get_rooms either)
There was a problem hiding this comment.
I didn't wanted to such refactor. Imho, the cleanest would be to have functions which are 1-on-1 with the API endpoints.

withenergy construction option, if True, the ?withEnergy=1 query is used on /content/ endpoint.
get_homes()
get_devices()
get_energy() methods
I just wanted to monitor the energyWh data points, ended up adidng a withenergy parameter to contrstuctor, and the about 3 getters