tomeko12 / pyelectroluxconnect

A python module to communicate with Elecrolux Connectivity Platform
Apache License 2.0
25 stars 9 forks source link

Cache the model names when acquired from Electrolux. #6

Closed LordMike closed 1 year ago

LordMike commented 1 year ago

Hi,

I'm using this project, where I reported an issue regarding a log message I'm seeing a lot.

I didn't get any response on it, so maybe I'll have more luck here :).

I'm seeing this log message, all the time, it seems like it occurs on every update of my electrolux devices, which is a lot. Each log line seems to represent a request to the Electrolux site, bombarding them with unecessary requests. I've looked at the code in this project, and I can see there is some caching somehow, but I can't understand it. So I can't workaround this by ensuring whatever cache isn't being populated properly, is prepared.

Nov 15 22:30:35 mbwodr01 homeassistant[559]: 2022-11-15 22:30:35.512 INFO (SyncWorker_4) [pyelectroluxconnect.Session] No model name in profile file, try to find in other sites
Nov 15 22:30:35 mbwodr01 homeassistant[559]: 2022-11-15 22:30:35.512 INFO (SyncWorker_4) [pyelectroluxconnect.Session] Trying to get model 914555442_02 info from https://www.electrolux-ui.com/ website
Nov 15 22:30:37 mbwodr01 homeassistant[559]: 2022-11-15 22:30:37.112 INFO (SyncWorker_4) [pyelectroluxconnect.Session] No model name in profile file, try to find in other sites
Nov 15 22:30:37 mbwodr01 homeassistant[559]: 2022-11-15 22:30:37.113 INFO (SyncWorker_4) [pyelectroluxconnect.Session] Trying to get model 916098764_00 info from https://www.electrolux-ui.com/ website
Nov 15 22:31:08 mbwodr01 homeassistant[559]: 2022-11-15 22:31:08.320 INFO (SyncWorker_5) [pyelectroluxconnect.Session] No model name in profile file, try to find in other sites
Nov 15 22:31:08 mbwodr01 homeassistant[559]: 2022-11-15 22:31:08.320 INFO (SyncWorker_5) [pyelectroluxconnect.Session] Trying to get model 914555442_02 info from https://www.electrolux-ui.com/ website
Nov 15 22:31:09 mbwodr01 homeassistant[559]: 2022-11-15 22:31:09.665 INFO (SyncWorker_5) [pyelectroluxconnect.Session] No model name in profile file, try to find in other sites
Nov 15 22:31:09 mbwodr01 homeassistant[559]: 2022-11-15 22:31:09.666 INFO (SyncWorker_5) [pyelectroluxconnect.Session] Trying to get model 916098764_00 info from https://www.electrolux-ui.com/ website

I'm writing here in the hopes that this can be fixed, such that both the log message disappears, and that Electrolux can relax a bit .. :)

The messages appear every 30 seconds, once for each device - of which I have two, so that's roughly 5.760 requests each day to Electrolux to get .. a model name .. :)

Mike.

tomeko12 commented 1 year ago

Cache added in 99020d0f06298fc4ae29f787f5f37e281f8181e9 (release 0.3.5)

LordMike commented 1 year ago

Seems to work, I now only get this log entry No model name in profile file, try to find in other sites, which seems to indicate that no request is made. Thanks! :)

Could that log entry also be removed if it's not too much?

I'm using a disk that can handle writes, so it's not an issue for me, but I know that many other users of Home Assistant (and other projects) who might use this library are running on disks that can't handle too many writes.

Mike.

tomeko12 commented 1 year ago

Logging minimalized in 8c580c640298b2c995485d8110eeaf39bda2866e (release 0.3.6)

LordMike commented 1 year ago

Thanks :)