Add support for v2 API for HomeWizard kWh Meter (#147214)

This commit is contained in:
Duco Sebel
2025-06-24 10:14:06 +02:00
committed by GitHub
parent b8044f60fc
commit f2944f4d8e
10 changed files with 44 additions and 5 deletions

View File

@ -12,6 +12,6 @@
"iot_class": "local_polling",
"loggers": ["homewizard_energy"],
"quality_scale": "platinum",
"requirements": ["python-homewizard-energy==9.1.1"],
"requirements": ["python-homewizard-energy==9.2.0"],
"zeroconf": ["_hwenergy._tcp.local.", "_homewizard._tcp.local."]
}

View File

@ -24,7 +24,7 @@
},
"authorize": {
"title": "Authorize",
"description": "Press the button on the HomeWizard Energy device, then select the button below."
"description": "Press the button on the HomeWizard Energy device for two seconds, then select the button below."
},
"reconfigure": {
"description": "Update configuration for {title}.",

2
requirements_all.txt generated
View File

@ -2444,7 +2444,7 @@ python-google-drive-api==0.1.0
python-homeassistant-analytics==0.9.0
# homeassistant.components.homewizard
python-homewizard-energy==9.1.1
python-homewizard-energy==9.2.0
# homeassistant.components.hp_ilo
python-hpilo==4.4.3

View File

@ -2020,7 +2020,7 @@ python-google-drive-api==0.1.0
python-homeassistant-analytics==0.9.0
# homeassistant.components.homewizard
python-homewizard-energy==9.1.1
python-homewizard-energy==9.2.0
# homeassistant.components.izone
python-izone==1.2.9

View File

@ -0,0 +1,7 @@
{
"mode": "zero",
"power_w": -404,
"target_power_w": -400,
"max_consumption_w": 1600,
"max_production_w": 800
}

View File

@ -0,0 +1,7 @@
{
"product_type": "HWE-KWH1",
"product_name": "kWh Meter 1-phase",
"serial": "5c2fafabcdef",
"firmware_version": "4.19",
"api_version": "2.0.0"
}

View File

@ -0,0 +1,13 @@
{
"energy_import_kwh": 123.456,
"energy_export_kwh": 78.91,
"power_w": 123,
"voltage_v": 230,
"current_a": 1.5,
"apparent_current_a": 1.6,
"reactive_current_a": 0.5,
"apparent_power_va": 345,
"reactive_power_var": 67,
"power_factor": 0.95,
"frequency_hz": 50
}

View File

@ -0,0 +1,7 @@
{
"wifi_ssid": "My Wi-Fi",
"wifi_rssi_db": -77,
"cloud_enabled": false,
"uptime_s": 356,
"api_v1_enabled": true
}

View File

@ -620,6 +620,7 @@ async def test_reconfigure_cannot_connect(
@pytest.mark.usefixtures("mock_setup_entry")
@pytest.mark.parametrize(("device_fixture"), ["HWE-P1", "HWE-KWH1"])
async def test_manual_flow_works_with_v2_api_support(
hass: HomeAssistant,
mock_homewizardenergy_v2: MagicMock,
@ -659,6 +660,7 @@ async def test_manual_flow_works_with_v2_api_support(
@pytest.mark.usefixtures("mock_setup_entry")
@pytest.mark.parametrize(("device_fixture"), ["HWE-P1", "HWE-KWH1"])
async def test_manual_flow_detects_failed_user_authorization(
hass: HomeAssistant,
mock_homewizardenergy_v2: MagicMock,
@ -704,6 +706,7 @@ async def test_manual_flow_detects_failed_user_authorization(
@pytest.mark.usefixtures("mock_setup_entry")
@pytest.mark.parametrize(("device_fixture"), ["HWE-P1", "HWE-KWH1"])
async def test_reauth_flow_updates_token(
hass: HomeAssistant,
mock_setup_entry: AsyncMock,
@ -739,6 +742,7 @@ async def test_reauth_flow_updates_token(
@pytest.mark.usefixtures("mock_setup_entry")
@pytest.mark.parametrize(("device_fixture"), ["HWE-P1", "HWE-KWH1"])
async def test_reauth_flow_handles_user_not_pressing_button(
hass: HomeAssistant,
mock_setup_entry: AsyncMock,
@ -785,9 +789,9 @@ async def test_reauth_flow_handles_user_not_pressing_button(
@pytest.mark.usefixtures("mock_setup_entry")
@pytest.mark.parametrize(("device_fixture"), ["HWE-P1", "HWE-KWH1"])
async def test_discovery_with_v2_api_ask_authorization(
hass: HomeAssistant,
# mock_setup_entry: AsyncMock,
mock_homewizardenergy_v2: MagicMock,
) -> None:
"""Test discovery detecting missing discovery info."""

View File

@ -38,6 +38,7 @@ async def test_load_unload_v1(
assert weak_ref() is None
@pytest.mark.parametrize(("device_fixture"), ["HWE-P1", "HWE-KWH1"])
async def test_load_unload_v2(
hass: HomeAssistant,
mock_config_entry_v2: MockConfigEntry,