Remove home id from Tibber diagnostics (#83066)

Tibber diagnostic

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>

Signed-off-by: Daniel Hjelseth Høyer <github@dahoiv.net>
This commit is contained in:
Daniel Hjelseth Høyer 2022-12-01 19:24:17 +01:00 committed by GitHub
parent fa31192448
commit 87b6bb45d0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 12 deletions

View file

@ -17,15 +17,17 @@ async def async_get_config_entry_diagnostics(
diagnostics_data = {} diagnostics_data = {}
homes = {} homes = []
for home in tibber_connection.get_homes(only_active=False): for home in tibber_connection.get_homes(only_active=False):
homes[home.home_id] = { homes.append(
"last_data_timestamp": home.last_data_timestamp, {
"has_active_subscription": home.has_active_subscription, "last_data_timestamp": home.last_data_timestamp,
"has_real_time_consumption": home.has_real_time_consumption, "has_active_subscription": home.has_active_subscription,
"last_cons_data_timestamp": home.last_cons_data_timestamp, "has_real_time_consumption": home.has_real_time_consumption,
"country": home.country, "last_cons_data_timestamp": home.last_cons_data_timestamp,
} "country": home.country,
}
)
diagnostics_data["homes"] = homes diagnostics_data["homes"] = homes
return diagnostics_data return diagnostics_data

View file

@ -25,7 +25,7 @@ async def test_entry_diagnostics(recorder_mock, hass, hass_client, config_entry)
result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
assert result == { assert result == {
"homes": {}, "homes": [],
} }
with patch( with patch(
@ -35,13 +35,13 @@ async def test_entry_diagnostics(recorder_mock, hass, hass_client, config_entry)
result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry) result = await get_diagnostics_for_config_entry(hass, hass_client, config_entry)
assert result == { assert result == {
"homes": { "homes": [
"home_id": { {
"last_data_timestamp": "2016-01-01T12:48:57", "last_data_timestamp": "2016-01-01T12:48:57",
"has_active_subscription": True, "has_active_subscription": True,
"has_real_time_consumption": False, "has_real_time_consumption": False,
"last_cons_data_timestamp": "2016-01-01T12:44:57", "last_cons_data_timestamp": "2016-01-01T12:44:57",
"country": "NO", "country": "NO",
} }
}, ],
} }