Extend the history of Elvia history to 3 years (#109490)

Extend the history of Elvia data to 3 years
This commit is contained in:
Joakim Sørensen 2024-02-03 08:16:28 +01:00 committed by GitHub
parent a1cbc62ddc
commit 6f9876d5e0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 29 additions and 11 deletions

View file

@ -35,8 +35,10 @@ class ConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
self._api_token = api_token = user_input[CONF_API_TOKEN]
client = Elvia(meter_value_token=api_token).meter_value()
try:
end_time = dt_util.utcnow()
results = await client.get_meter_values(
start_time=(dt_util.now() - timedelta(hours=1)).isoformat()
start_time=(end_time - timedelta(hours=1)).isoformat(),
end_time=end_time.isoformat(),
)
except ElviaError.AuthError as exception: