From 87b6bb45d05b6071349174db33916c06e299adac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Hjelseth=20H=C3=B8yer?= Date: Thu, 1 Dec 2022 19:24:17 +0100 Subject: [PATCH] Remove home id from Tibber diagnostics (#83066) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Tibber diagnostic Signed-off-by: Daniel Hjelseth Høyer Signed-off-by: Daniel Hjelseth Høyer --- homeassistant/components/tibber/diagnostics.py | 18 ++++++++++-------- tests/components/tibber/test_diagnostics.py | 8 ++++---- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/homeassistant/components/tibber/diagnostics.py b/homeassistant/components/tibber/diagnostics.py index d9e04502509..75c76636f5f 100644 --- a/homeassistant/components/tibber/diagnostics.py +++ b/homeassistant/components/tibber/diagnostics.py @@ -17,15 +17,17 @@ async def async_get_config_entry_diagnostics( diagnostics_data = {} - homes = {} + homes = [] for home in tibber_connection.get_homes(only_active=False): - homes[home.home_id] = { - "last_data_timestamp": home.last_data_timestamp, - "has_active_subscription": home.has_active_subscription, - "has_real_time_consumption": home.has_real_time_consumption, - "last_cons_data_timestamp": home.last_cons_data_timestamp, - "country": home.country, - } + homes.append( + { + "last_data_timestamp": home.last_data_timestamp, + "has_active_subscription": home.has_active_subscription, + "has_real_time_consumption": home.has_real_time_consumption, + "last_cons_data_timestamp": home.last_cons_data_timestamp, + "country": home.country, + } + ) diagnostics_data["homes"] = homes return diagnostics_data diff --git a/tests/components/tibber/test_diagnostics.py b/tests/components/tibber/test_diagnostics.py index 38b5eb91a2f..78c0b6e321f 100644 --- a/tests/components/tibber/test_diagnostics.py +++ b/tests/components/tibber/test_diagnostics.py @@ -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) assert result == { - "homes": {}, + "homes": [], } 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) assert result == { - "homes": { - "home_id": { + "homes": [ + { "last_data_timestamp": "2016-01-01T12:48:57", "has_active_subscription": True, "has_real_time_consumption": False, "last_cons_data_timestamp": "2016-01-01T12:44:57", "country": "NO", } - }, + ], }