From a1d2907b9563ee8702aa929c843bf0171f72d5fb Mon Sep 17 00:00:00 2001 From: Bouwe Date: Fri, 16 Feb 2024 19:18:20 +0100 Subject: [PATCH 1/6] Bump plugwise to v0.37.1 --- homeassistant/components/plugwise/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/plugwise/manifest.json b/homeassistant/components/plugwise/manifest.json index 9b89830589907c..135c999f8ed7b4 100644 --- a/homeassistant/components/plugwise/manifest.json +++ b/homeassistant/components/plugwise/manifest.json @@ -7,6 +7,6 @@ "integration_type": "hub", "iot_class": "local_polling", "loggers": ["crcmod", "plugwise"], - "requirements": ["plugwise==0.36.3"], + "requirements": ["plugwise==0.37.1"], "zeroconf": ["_plugwise._tcp.local."] } diff --git a/requirements_all.txt b/requirements_all.txt index 51614015597af3..70ad107d49e058 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1541,7 +1541,7 @@ plexauth==0.0.6 plexwebsocket==0.0.14 # homeassistant.components.plugwise -plugwise==0.36.3 +plugwise==0.37.1 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 7e9104bc45e3f3..7df7000a5deaaa 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -1212,7 +1212,7 @@ plexauth==0.0.6 plexwebsocket==0.0.14 # homeassistant.components.plugwise -plugwise==0.36.3 +plugwise==0.37.1 # homeassistant.components.plum_lightpad plumlightpad==0.0.11 From 40b926d8ef215e27a075ce66d6314d3fe506a696 Mon Sep 17 00:00:00 2001 From: Bouwe Date: Fri, 16 Feb 2024 19:22:14 +0100 Subject: [PATCH 2/6] Update and clean-up test-fixtures --- .../all_data.json | 2 +- .../device_list.json | 20 -------- .../notifications.json | 5 -- .../anna_heatpump_heating/device_list.json | 5 -- .../anna_heatpump_heating/notifications.json | 1 - .../fixtures/m_adam_cooling/device_list.json | 8 --- .../m_adam_cooling/notifications.json | 1 - .../fixtures/m_adam_heating/device_list.json | 8 --- .../m_adam_heating/notifications.json | 1 - .../fixtures/m_adam_jip/all_data.json | 2 +- .../fixtures/m_adam_jip/device_list.json | 13 ----- .../fixtures/m_adam_jip/notifications.json | 1 - .../m_anna_heatpump_cooling/device_list.json | 5 -- .../notifications.json | 1 - .../m_anna_heatpump_idle/device_list.json | 5 -- .../m_anna_heatpump_idle/notifications.json | 1 - .../fixtures/p1v3_full_option/all_data.json | 49 ------------------- .../p1v3_full_option/device_list.json | 1 - .../p1v3_full_option/notifications.json | 1 - .../fixtures/p1v4_442_single/all_data.json | 49 +++++++++++++++++++ .../fixtures/p1v4_442_triple/device_list.json | 1 - .../p1v4_442_triple/notifications.json | 5 -- .../fixtures/stretch_v31/all_data.json | 2 +- .../fixtures/stretch_v31/device_list.json | 10 ---- .../fixtures/stretch_v31/notifications.json | 1 - 25 files changed, 52 insertions(+), 146 deletions(-) delete mode 100644 tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/device_list.json delete mode 100644 tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/notifications.json delete mode 100644 tests/components/plugwise/fixtures/anna_heatpump_heating/device_list.json delete mode 100644 tests/components/plugwise/fixtures/anna_heatpump_heating/notifications.json delete mode 100644 tests/components/plugwise/fixtures/m_adam_cooling/device_list.json delete mode 100644 tests/components/plugwise/fixtures/m_adam_cooling/notifications.json delete mode 100644 tests/components/plugwise/fixtures/m_adam_heating/device_list.json delete mode 100644 tests/components/plugwise/fixtures/m_adam_heating/notifications.json delete mode 100644 tests/components/plugwise/fixtures/m_adam_jip/device_list.json delete mode 100644 tests/components/plugwise/fixtures/m_adam_jip/notifications.json delete mode 100644 tests/components/plugwise/fixtures/m_anna_heatpump_cooling/device_list.json delete mode 100644 tests/components/plugwise/fixtures/m_anna_heatpump_cooling/notifications.json delete mode 100644 tests/components/plugwise/fixtures/m_anna_heatpump_idle/device_list.json delete mode 100644 tests/components/plugwise/fixtures/m_anna_heatpump_idle/notifications.json delete mode 100644 tests/components/plugwise/fixtures/p1v3_full_option/all_data.json delete mode 100644 tests/components/plugwise/fixtures/p1v3_full_option/device_list.json delete mode 100644 tests/components/plugwise/fixtures/p1v3_full_option/notifications.json create mode 100644 tests/components/plugwise/fixtures/p1v4_442_single/all_data.json delete mode 100644 tests/components/plugwise/fixtures/p1v4_442_triple/device_list.json delete mode 100644 tests/components/plugwise/fixtures/p1v4_442_triple/notifications.json delete mode 100644 tests/components/plugwise/fixtures/stretch_v31/device_list.json delete mode 100644 tests/components/plugwise/fixtures/stretch_v31/notifications.json diff --git a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json index f97182782e6bef..47c8e4dceb0a76 100644 --- a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json +++ b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/all_data.json @@ -28,7 +28,7 @@ "model": "Plug", "name": "Playstation Smart Plug", "sensors": { - "electricity_consumed": 82.6, + "electricity_consumed": 84.1, "electricity_consumed_interval": 8.6, "electricity_produced": 0.0, "electricity_produced_interval": 0.0 diff --git a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/device_list.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/device_list.json deleted file mode 100644 index 104a723e4637b2..00000000000000 --- a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/device_list.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - "fe799307f1624099878210aa0b9f1475", - "90986d591dcd426cae3ec3e8111ff730", - "df4a4a8169904cdb9c03d61a21f42140", - "b310b72a0e354bfab43089919b9a88bf", - "a2c3583e0a6349358998b760cea82d2a", - "b59bcebaf94b499ea7d46e4a66fb62d8", - "d3da73bde12a47d5a6b8f9dad971f2ec", - "21f2b542c49845e6bb416884c55778d6", - "78d1126fc4c743db81b61c20e88342a7", - "cd0ddb54ef694e11ac18ed1cbce5dbbd", - "4a810418d5394b3f82727340b91ba740", - "02cf28bfec924855854c544690a609ef", - "a28f588dc4a049a483fd03a30361ad3a", - "6a3bf693d05e48e0b460c815a4fdd09d", - "680423ff840043738f42cc7f1ff97a36", - "f1fee6043d3642a9b0a65297455f008e", - "675416a629f343c495449970e2ca37b5", - "e7693eb9582644e5b865dba8d4447cf1" -] diff --git a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/notifications.json b/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/notifications.json deleted file mode 100644 index 8749be4c345414..00000000000000 --- a/tests/components/plugwise/fixtures/adam_multiple_devices_per_zone/notifications.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "af82e4ccf9c548528166d38e560662a4": { - "warning": "Node Plug (with MAC address 000D6F000D13CB01, in room 'n.a.') has been unreachable since 23:03 2020-01-18. Please check the connection and restart the device." - } -} diff --git a/tests/components/plugwise/fixtures/anna_heatpump_heating/device_list.json b/tests/components/plugwise/fixtures/anna_heatpump_heating/device_list.json deleted file mode 100644 index ffb8cf62575a2a..00000000000000 --- a/tests/components/plugwise/fixtures/anna_heatpump_heating/device_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "015ae9ea3f964e668e490fa39da3870b", - "1cbf783bb11e4a7c8a6843dee3a86927", - "3cb70739631c4d17a86b8b12e8a5161b" -] diff --git a/tests/components/plugwise/fixtures/anna_heatpump_heating/notifications.json b/tests/components/plugwise/fixtures/anna_heatpump_heating/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/anna_heatpump_heating/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/m_adam_cooling/device_list.json b/tests/components/plugwise/fixtures/m_adam_cooling/device_list.json deleted file mode 100644 index 35fe367eb3417e..00000000000000 --- a/tests/components/plugwise/fixtures/m_adam_cooling/device_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "da224107914542988a88561b4452b0f6", - "056ee145a816487eaa69243c3280f8bf", - "e2f4322d57924fa090fbbc48b3a140dc", - "ad4838d7d35c4d6ea796ee12ae5aedf8", - "1772a4ea304041adb83f357b751341ff", - "e8ef2a01ed3b4139a53bf749204fe6b4" -] diff --git a/tests/components/plugwise/fixtures/m_adam_cooling/notifications.json b/tests/components/plugwise/fixtures/m_adam_cooling/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/m_adam_cooling/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/m_adam_heating/device_list.json b/tests/components/plugwise/fixtures/m_adam_heating/device_list.json deleted file mode 100644 index 35fe367eb3417e..00000000000000 --- a/tests/components/plugwise/fixtures/m_adam_heating/device_list.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - "da224107914542988a88561b4452b0f6", - "056ee145a816487eaa69243c3280f8bf", - "e2f4322d57924fa090fbbc48b3a140dc", - "ad4838d7d35c4d6ea796ee12ae5aedf8", - "1772a4ea304041adb83f357b751341ff", - "e8ef2a01ed3b4139a53bf749204fe6b4" -] diff --git a/tests/components/plugwise/fixtures/m_adam_heating/notifications.json b/tests/components/plugwise/fixtures/m_adam_heating/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/m_adam_heating/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/m_adam_jip/all_data.json b/tests/components/plugwise/fixtures/m_adam_jip/all_data.json index 915f438c105ca1..378a5e0a760120 100644 --- a/tests/components/plugwise/fixtures/m_adam_jip/all_data.json +++ b/tests/components/plugwise/fixtures/m_adam_jip/all_data.json @@ -67,7 +67,7 @@ "name": "Tom Slaapkamer", "sensors": { "setpoint": 13.0, - "temperature": 24.3, + "temperature": 24.2, "temperature_difference": 1.7, "valve_position": 0.0 }, diff --git a/tests/components/plugwise/fixtures/m_adam_jip/device_list.json b/tests/components/plugwise/fixtures/m_adam_jip/device_list.json deleted file mode 100644 index 049845bc828538..00000000000000 --- a/tests/components/plugwise/fixtures/m_adam_jip/device_list.json +++ /dev/null @@ -1,13 +0,0 @@ -[ - "b5c2386c6f6342669e50fe49dd05b188", - "e4684553153b44afbef2200885f379dc", - "a6abc6a129ee499c88a4d420cc413b47", - "1346fbd8498d4dbcab7e18d51b771f3d", - "833de10f269c4deab58fb9df69901b4e", - "6f3e9d7084214c21b9dfa46f6eeb8700", - "f61f1a2535f54f52ad006a3d18e459ca", - "d4496250d0e942cfa7aea3476e9070d5", - "356b65335e274d769c338223e7af9c33", - "1da4d325838e4ad8aac12177214505c9", - "457ce8414de24596a2d5e7dbc9c7682f" -] diff --git a/tests/components/plugwise/fixtures/m_adam_jip/notifications.json b/tests/components/plugwise/fixtures/m_adam_jip/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/m_adam_jip/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/device_list.json b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/device_list.json deleted file mode 100644 index ffb8cf62575a2a..00000000000000 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/device_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "015ae9ea3f964e668e490fa39da3870b", - "1cbf783bb11e4a7c8a6843dee3a86927", - "3cb70739631c4d17a86b8b12e8a5161b" -] diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/notifications.json b/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_cooling/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/device_list.json b/tests/components/plugwise/fixtures/m_anna_heatpump_idle/device_list.json deleted file mode 100644 index ffb8cf62575a2a..00000000000000 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/device_list.json +++ /dev/null @@ -1,5 +0,0 @@ -[ - "015ae9ea3f964e668e490fa39da3870b", - "1cbf783bb11e4a7c8a6843dee3a86927", - "3cb70739631c4d17a86b8b12e8a5161b" -] diff --git a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/notifications.json b/tests/components/plugwise/fixtures/m_anna_heatpump_idle/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/m_anna_heatpump_idle/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json b/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json deleted file mode 100644 index 0a47893c077ad0..00000000000000 --- a/tests/components/plugwise/fixtures/p1v3_full_option/all_data.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "devices": { - "cd3e822288064775a7c4afcdd70bdda2": { - "binary_sensors": { - "plugwise_notification": false - }, - "dev_class": "gateway", - "firmware": "3.3.9", - "hardware": "AME Smile 2.0 board", - "location": "cd3e822288064775a7c4afcdd70bdda2", - "mac_address": "012345670001", - "model": "Gateway", - "name": "Smile P1", - "vendor": "Plugwise" - }, - "e950c7d5e1ee407a858e2a8b5016c8b3": { - "available": true, - "dev_class": "smartmeter", - "location": "cd3e822288064775a7c4afcdd70bdda2", - "model": "2M550E-1012", - "name": "P1", - "sensors": { - "electricity_consumed_off_peak_cumulative": 551.09, - "electricity_consumed_off_peak_interval": 0, - "electricity_consumed_off_peak_point": 0, - "electricity_consumed_peak_cumulative": 442.932, - "electricity_consumed_peak_interval": 0, - "electricity_consumed_peak_point": 0, - "electricity_produced_off_peak_cumulative": 154.491, - "electricity_produced_off_peak_interval": 0, - "electricity_produced_off_peak_point": 0, - "electricity_produced_peak_cumulative": 396.559, - "electricity_produced_peak_interval": 0, - "electricity_produced_peak_point": 2816, - "gas_consumed_cumulative": 584.85, - "gas_consumed_interval": 0.0, - "net_electricity_cumulative": 442.972, - "net_electricity_point": -2816 - }, - "vendor": "ISKRAEMECO" - } - }, - "gateway": { - "gateway_id": "cd3e822288064775a7c4afcdd70bdda2", - "item_count": 31, - "notifications": {}, - "smile_name": "Smile P1" - } -} diff --git a/tests/components/plugwise/fixtures/p1v3_full_option/device_list.json b/tests/components/plugwise/fixtures/p1v3_full_option/device_list.json deleted file mode 100644 index 8af35165c7e3cb..00000000000000 --- a/tests/components/plugwise/fixtures/p1v3_full_option/device_list.json +++ /dev/null @@ -1 +0,0 @@ -["cd3e822288064775a7c4afcdd70bdda2", "e950c7d5e1ee407a858e2a8b5016c8b3"] diff --git a/tests/components/plugwise/fixtures/p1v3_full_option/notifications.json b/tests/components/plugwise/fixtures/p1v3_full_option/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/p1v3_full_option/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/tests/components/plugwise/fixtures/p1v4_442_single/all_data.json b/tests/components/plugwise/fixtures/p1v4_442_single/all_data.json new file mode 100644 index 00000000000000..318035a5d2c195 --- /dev/null +++ b/tests/components/plugwise/fixtures/p1v4_442_single/all_data.json @@ -0,0 +1,49 @@ +{ + "devices": { + "a455b61e52394b2db5081ce025a430f3": { + "binary_sensors": { + "plugwise_notification": false + }, + "dev_class": "gateway", + "firmware": "4.4.2", + "hardware": "AME Smile 2.0 board", + "location": "a455b61e52394b2db5081ce025a430f3", + "mac_address": "012345670001", + "model": "Gateway", + "name": "Smile P1", + "vendor": "Plugwise" + }, + "ba4de7613517478da82dd9b6abea36af": { + "available": true, + "dev_class": "smartmeter", + "location": "a455b61e52394b2db5081ce025a430f3", + "model": "KFM5KAIFA-METER", + "name": "P1", + "sensors": { + "electricity_consumed_off_peak_cumulative": 17643.423, + "electricity_consumed_off_peak_interval": 15, + "electricity_consumed_off_peak_point": 486, + "electricity_consumed_peak_cumulative": 13966.608, + "electricity_consumed_peak_interval": 0, + "electricity_consumed_peak_point": 0, + "electricity_phase_one_consumed": 486, + "electricity_phase_one_produced": 0, + "electricity_produced_off_peak_cumulative": 0.0, + "electricity_produced_off_peak_interval": 0, + "electricity_produced_off_peak_point": 0, + "electricity_produced_peak_cumulative": 0.0, + "electricity_produced_peak_interval": 0, + "electricity_produced_peak_point": 0, + "net_electricity_cumulative": 31610.031, + "net_electricity_point": 486 + }, + "vendor": "SHENZHEN KAIFA TECHNOLOGY \uff08CHENGDU\uff09 CO., LTD." + } + }, + "gateway": { + "gateway_id": "a455b61e52394b2db5081ce025a430f3", + "item_count": 31, + "notifications": {}, + "smile_name": "Smile P1" + } +} diff --git a/tests/components/plugwise/fixtures/p1v4_442_triple/device_list.json b/tests/components/plugwise/fixtures/p1v4_442_triple/device_list.json deleted file mode 100644 index 7b301f5092423d..00000000000000 --- a/tests/components/plugwise/fixtures/p1v4_442_triple/device_list.json +++ /dev/null @@ -1 +0,0 @@ -["03e65b16e4b247a29ae0d75a78cb492e", "b82b6b3322484f2ea4e25e0bd5f3d61f"] diff --git a/tests/components/plugwise/fixtures/p1v4_442_triple/notifications.json b/tests/components/plugwise/fixtures/p1v4_442_triple/notifications.json deleted file mode 100644 index 49db062035aa38..00000000000000 --- a/tests/components/plugwise/fixtures/p1v4_442_triple/notifications.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "97a04c0c263049b29350a660b4cdd01e": { - "warning": "The Smile P1 is not connected to a smart meter." - } -} diff --git a/tests/components/plugwise/fixtures/stretch_v31/all_data.json b/tests/components/plugwise/fixtures/stretch_v31/all_data.json index 6b1012b0d87bed..f42cde65b394f1 100644 --- a/tests/components/plugwise/fixtures/stretch_v31/all_data.json +++ b/tests/components/plugwise/fixtures/stretch_v31/all_data.json @@ -23,7 +23,7 @@ "electricity_produced": 0.0 }, "switches": { - "lock": false, + "lock": true, "relay": true }, "vendor": "Plugwise", diff --git a/tests/components/plugwise/fixtures/stretch_v31/device_list.json b/tests/components/plugwise/fixtures/stretch_v31/device_list.json deleted file mode 100644 index b2c839ae9d301f..00000000000000 --- a/tests/components/plugwise/fixtures/stretch_v31/device_list.json +++ /dev/null @@ -1,10 +0,0 @@ -[ - "0000aaaa0000aaaa0000aaaa0000aa00", - "5871317346d045bc9f6b987ef25ee638", - "e1c884e7dede431dadee09506ec4f859", - "aac7b735042c4832ac9ff33aae4f453b", - "cfe95cf3de1948c0b8955125bf754614", - "059e4d03c7a34d278add5c7a4a781d19", - "d950b314e9d8499f968e6db8d82ef78c", - "d03738edfcc947f7b8f4573571d90d2d" -] diff --git a/tests/components/plugwise/fixtures/stretch_v31/notifications.json b/tests/components/plugwise/fixtures/stretch_v31/notifications.json deleted file mode 100644 index 0967ef424bce67..00000000000000 --- a/tests/components/plugwise/fixtures/stretch_v31/notifications.json +++ /dev/null @@ -1 +0,0 @@ -{} From 2d0aa4fcf343b59d924944569062d7ffbcfba29f Mon Sep 17 00:00:00 2001 From: Bouwe Date: Fri, 16 Feb 2024 19:25:40 +0100 Subject: [PATCH 3/6] Update related test-code --- tests/components/plugwise/conftest.py | 7 +++---- tests/components/plugwise/test_sensor.py | 26 ++++++++---------------- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/tests/components/plugwise/conftest.py b/tests/components/plugwise/conftest.py index 140d56715ef0db..8b158415531880 100644 --- a/tests/components/plugwise/conftest.py +++ b/tests/components/plugwise/conftest.py @@ -273,15 +273,15 @@ def mock_smile_anna_3() -> Generator[None, MagicMock, None]: @pytest.fixture def mock_smile_p1() -> Generator[None, MagicMock, None]: """Create a Mock P1 DSMR environment for testing exceptions.""" - chosen_env = "p1v3_full_option" + chosen_env = "p1v4_442_single" with patch( "homeassistant.components.plugwise.coordinator.Smile", autospec=True ) as smile_mock: smile = smile_mock.return_value - smile.gateway_id = "e950c7d5e1ee407a858e2a8b5016c8b3" + smile.gateway_id = "a455b61e52394b2db5081ce025a430f3" smile.heater_id = None - smile.smile_version = "3.3.9" + smile.smile_version = "4.4.2" smile.smile_type = "power" smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" @@ -289,7 +289,6 @@ def mock_smile_p1() -> Generator[None, MagicMock, None]: smile.connect.return_value = True - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] diff --git a/tests/components/plugwise/test_sensor.py b/tests/components/plugwise/test_sensor.py index 46f31e1458f2bb..d1df8454f4eda9 100644 --- a/tests/components/plugwise/test_sensor.py +++ b/tests/components/plugwise/test_sensor.py @@ -111,38 +111,28 @@ async def test_anna_as_smt_climate_sensor_entities( assert float(state.state) == 86.0 -async def test_anna_climate_sensor_entities( - hass: HomeAssistant, mock_smile_anna: MagicMock, init_integration: MockConfigEntry -) -> None: - """Test creation of climate related sensor entities.""" - state = hass.states.get("sensor.opentherm_outdoor_air_temperature") - assert state - assert float(state.state) == 3.0 - - async def test_p1_dsmr_sensor_entities( hass: HomeAssistant, mock_smile_p1: MagicMock, init_integration: MockConfigEntry ) -> None: """Test creation of power related sensor entities.""" state = hass.states.get("sensor.p1_net_electricity_point") assert state - assert float(state.state) == -2816.0 + assert int(state.state) == 486 state = hass.states.get("sensor.p1_electricity_consumed_off_peak_cumulative") assert state - assert float(state.state) == 551.09 + assert float(state.state) == 17643.423 state = hass.states.get("sensor.p1_electricity_produced_peak_point") assert state - assert float(state.state) == 2816.0 + assert int(state.state) == 0 state = hass.states.get("sensor.p1_electricity_consumed_peak_cumulative") assert state - assert float(state.state) == 442.932 + assert float(state.state) == 13966.608 state = hass.states.get("sensor.p1_gas_consumed_cumulative") - assert state - assert float(state.state) == 584.85 + assert not state async def test_p1_3ph_dsmr_sensor_entities( @@ -151,15 +141,15 @@ async def test_p1_3ph_dsmr_sensor_entities( """Test creation of power related sensor entities.""" state = hass.states.get("sensor.p1_electricity_phase_one_consumed") assert state - assert float(state.state) == 1763.0 + assert int(state.state) == 1763 state = hass.states.get("sensor.p1_electricity_phase_two_consumed") assert state - assert float(state.state) == 1703.0 + assert int(state.state) == 1703 state = hass.states.get("sensor.p1_electricity_phase_three_consumed") assert state - assert float(state.state) == 2080.0 + assert int(state.state) == 2080 entity_id = "sensor.p1_voltage_phase_one" state = hass.states.get(entity_id) From f0cf014b9def4e6b66eb03a53d13e487a07f25cd Mon Sep 17 00:00:00 2001 From: Bouwe Date: Fri, 16 Feb 2024 19:51:18 +0100 Subject: [PATCH 4/6] Clean-up conftest.py --- tests/components/plugwise/conftest.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/tests/components/plugwise/conftest.py b/tests/components/plugwise/conftest.py index 8b158415531880..c211cd0a7410cb 100644 --- a/tests/components/plugwise/conftest.py +++ b/tests/components/plugwise/conftest.py @@ -87,10 +87,7 @@ def mock_smile_adam() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Adam" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -116,10 +113,7 @@ def mock_smile_adam_2() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Adam" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -145,10 +139,7 @@ def mock_smile_adam_3() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Adam" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -174,10 +165,7 @@ def mock_smile_adam_4() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Adam" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -202,10 +190,7 @@ def mock_smile_anna() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Smile Anna" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -230,10 +215,7 @@ def mock_smile_anna_2() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Smile Anna" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -258,10 +240,7 @@ def mock_smile_anna_3() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Smile Anna" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -286,9 +265,7 @@ def mock_smile_p1() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Smile P1" - smile.connect.return_value = True - all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -313,10 +290,7 @@ def mock_smile_p1_2() -> Generator[None, MagicMock, None]: smile.smile_hostname = "smile98765" smile.smile_model = "Gateway" smile.smile_name = "Smile P1" - smile.connect.return_value = True - - smile.notifications = _read_json(chosen_env, "notifications") all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( all_data["gateway"], all_data["devices"] @@ -341,7 +315,6 @@ def mock_stretch() -> Generator[None, MagicMock, None]: smile.smile_hostname = "stretch98765" smile.smile_model = "Gateway" smile.smile_name = "Stretch" - smile.connect.return_value = True all_data = _read_json(chosen_env, "all_data") smile.async_update.return_value = PlugwiseData( From 9b4c567dc690364471c444b144fe01528191646d Mon Sep 17 00:00:00 2001 From: Bouwe Date: Fri, 16 Feb 2024 19:54:06 +0100 Subject: [PATCH 5/6] Update diagnostics-snapshot --- tests/components/plugwise/snapshots/test_diagnostics.ambr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/components/plugwise/snapshots/test_diagnostics.ambr b/tests/components/plugwise/snapshots/test_diagnostics.ambr index c2bbea9418a10f..0fa3df4e660e99 100644 --- a/tests/components/plugwise/snapshots/test_diagnostics.ambr +++ b/tests/components/plugwise/snapshots/test_diagnostics.ambr @@ -30,7 +30,7 @@ 'model': 'Plug', 'name': 'Playstation Smart Plug', 'sensors': dict({ - 'electricity_consumed': 82.6, + 'electricity_consumed': 84.1, 'electricity_consumed_interval': 8.6, 'electricity_produced': 0.0, 'electricity_produced_interval': 0.0, From cc1ce63c52613e7759016bb711a8c1d62350b24e Mon Sep 17 00:00:00 2001 From: Bouwe Date: Sun, 3 Mar 2024 09:37:37 +0100 Subject: [PATCH 6/6] Remove crcmod from loggers --- homeassistant/components/plugwise/manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/plugwise/manifest.json b/homeassistant/components/plugwise/manifest.json index 135c999f8ed7b4..888f813760adab 100644 --- a/homeassistant/components/plugwise/manifest.json +++ b/homeassistant/components/plugwise/manifest.json @@ -6,7 +6,7 @@ "documentation": "https://www.home-assistant.io/integrations/plugwise", "integration_type": "hub", "iot_class": "local_polling", - "loggers": ["crcmod", "plugwise"], + "loggers": ["plugwise"], "requirements": ["plugwise==0.37.1"], "zeroconf": ["_plugwise._tcp.local."] }