Skip to content

Commit

Permalink
Add preliminery support for HWE-BAT (#438)
Browse files Browse the repository at this point in the history
  • Loading branch information
DCSBL authored Dec 27, 2024
1 parent e2f1979 commit 0cdc49a
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 6 deletions.
5 changes: 5 additions & 0 deletions homewizard_energy/v2/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ class Measurement:

frequency_hz: float | None

cycles: int | None
state_of_charge_pct: float | None

voltage_sag_l1_count: int | None
voltage_sag_l2_count: int | None
voltage_sag_l3_count: int | None
Expand Down Expand Up @@ -183,6 +186,8 @@ def from_dict(data: dict[str, Any]) -> Measurement:
current_l2_a=data.get("current_l2_a"),
current_l3_a=data.get("current_l3_a"),
frequency_hz=data.get("frequency_hz"),
cycles=data.get("cycles"),
state_of_charge_pct=data.get("state_of_charge_pct"),
voltage_sag_l1_count=data.get("voltage_sag_l1_count"),
voltage_sag_l2_count=data.get("voltage_sag_l2_count"),
voltage_sag_l3_count=data.get("voltage_sag_l3_count"),
Expand Down
4 changes: 2 additions & 2 deletions tests/v2/__snapshots__/test_v2_homewizard_energy.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Device(product=Product(model='HWE-P1', name='Wi-Fi P1 Meter', url='https://www.homewizard.com/p1-meter/', description='The HomeWizard P1 Meter gives you detailed insight in your electricity-, gas consumption and solar surplus.'), product_name='P1 Meter', product_type='HWE-P1', serial='5c2fafaabbcc', api_version='2.0.0', firmware_version='6.00')
# ---
# name: test_measurement_with_valid_authentication[HWE-P1-fixtures0]
Measurement(protocol_version=None, meter_model='ISKRA 2M550T-101', unique_id='Never Gonna Give You Up', tariff=None, energy_import_kwh=None, energy_import_t1_kwh=10830.511, energy_import_t2_kwh=2948.827, energy_import_t3_kwh=None, energy_import_t4_kwh=None, energy_export_kwh=None, energy_export_t1_kwh=1285.951, energy_export_t2_kwh=2876.51, energy_export_t3_kwh=None, energy_export_t4_kwh=None, power_w=-678, power_l1_w=-676, power_l2_w=None, power_l3_w=None, voltage_l1_v=None, voltage_l2_v=None, voltage_l3_v=None, current_a=None, current_l1_a=None, current_l2_a=None, current_l3_a=None, frequency_hz=None, voltage_sag_l1_count=None, voltage_sag_l2_count=None, voltage_sag_l3_count=None, voltage_swell_l1_count=None, voltage_swell_l2_count=None, voltage_swell_l3_count=None, any_power_fail_count=None, long_power_fail_count=None, average_power_15m_w=None, monthly_power_peak_w=None, monthly_power_peak_timestamp=None, external_devices=None)
Measurement(protocol_version=None, meter_model='ISKRA 2M550T-101', unique_id='Never Gonna Give You Up', tariff=None, energy_import_kwh=None, energy_import_t1_kwh=10830.511, energy_import_t2_kwh=2948.827, energy_import_t3_kwh=None, energy_import_t4_kwh=None, energy_export_kwh=None, energy_export_t1_kwh=1285.951, energy_export_t2_kwh=2876.51, energy_export_t3_kwh=None, energy_export_t4_kwh=None, power_w=-678, power_l1_w=-676, power_l2_w=None, power_l3_w=None, voltage_l1_v=None, voltage_l2_v=None, voltage_l3_v=None, current_a=None, current_l1_a=None, current_l2_a=None, current_l3_a=None, frequency_hz=None, cycles=None, state_of_charge_pct=None, voltage_sag_l1_count=None, voltage_sag_l2_count=None, voltage_sag_l3_count=None, voltage_swell_l1_count=None, voltage_swell_l2_count=None, voltage_swell_l3_count=None, any_power_fail_count=None, long_power_fail_count=None, average_power_15m_w=None, monthly_power_peak_w=None, monthly_power_peak_timestamp=None, external_devices=None)
# ---
# name: test_measurement_with_valid_authentication[HWE-P1-fixtures0].1
Measurement(protocol_version=None, meter_model='ISKRA 2M550T-101', unique_id='Never Gonna Let You Down', tariff=None, energy_import_kwh=13779.338, energy_import_t1_kwh=10830.511, energy_import_t2_kwh=2948.827, energy_import_t3_kwh=None, energy_import_t4_kwh=None, energy_export_kwh=0, energy_export_t1_kwh=0, energy_export_t2_kwh=0, energy_export_t3_kwh=None, energy_export_t4_kwh=None, power_w=-543, power_l1_w=-676, power_l2_w=133, power_l3_w=0, voltage_l1_v=None, voltage_l2_v=None, voltage_l3_v=None, current_a=6, current_l1_a=-4, current_l2_a=2, current_l3_a=0, frequency_hz=None, voltage_sag_l1_count=1, voltage_sag_l2_count=1, voltage_sag_l3_count=0, voltage_swell_l1_count=0, voltage_swell_l2_count=0, voltage_swell_l3_count=0, any_power_fail_count=4, long_power_fail_count=5, average_power_15m_w=123.0, monthly_power_peak_w=1111.0, monthly_power_peak_timestamp=datetime.datetime(2024, 6, 4, 10, 11, 22), external_devices={'gas_meter_Never gonna run around': ExternalDevice(unique_id='Never gonna run around', meter_type=<DeviceType.GAS_METER: 3>, value=2569.646, unit='m3', timestamp=datetime.datetime(2024, 6, 28, 14, 0)), 'water_meter_and desert you': ExternalDevice(unique_id='and desert you', meter_type=<DeviceType.WATER_METER: 7>, value=123.456, unit='m3', timestamp=datetime.datetime(2024, 6, 28, 14, 5))})
Measurement(protocol_version=None, meter_model='ISKRA 2M550T-101', unique_id='Never Gonna Let You Down', tariff=None, energy_import_kwh=13779.338, energy_import_t1_kwh=10830.511, energy_import_t2_kwh=2948.827, energy_import_t3_kwh=None, energy_import_t4_kwh=None, energy_export_kwh=0, energy_export_t1_kwh=0, energy_export_t2_kwh=0, energy_export_t3_kwh=None, energy_export_t4_kwh=None, power_w=-543, power_l1_w=-676, power_l2_w=133, power_l3_w=0, voltage_l1_v=None, voltage_l2_v=None, voltage_l3_v=None, current_a=6, current_l1_a=-4, current_l2_a=2, current_l3_a=0, frequency_hz=None, cycles=None, state_of_charge_pct=None, voltage_sag_l1_count=1, voltage_sag_l2_count=1, voltage_sag_l3_count=0, voltage_swell_l1_count=0, voltage_swell_l2_count=0, voltage_swell_l3_count=0, any_power_fail_count=4, long_power_fail_count=5, average_power_15m_w=123.0, monthly_power_peak_w=1111.0, monthly_power_peak_timestamp=datetime.datetime(2024, 6, 4, 10, 11, 22), external_devices={'gas_meter_Never gonna run around': ExternalDevice(unique_id='Never gonna run around', meter_type=<DeviceType.GAS_METER: 3>, value=2569.646, unit='m3', timestamp=datetime.datetime(2024, 6, 28, 14, 0)), 'water_meter_and desert you': ExternalDevice(unique_id='and desert you', meter_type=<DeviceType.WATER_METER: 7>, value=123.456, unit='m3', timestamp=datetime.datetime(2024, 6, 28, 14, 5))})
# ---
# name: test_system_with_valid_authentication[HWE-P1-fixtures0]
System(wifi_ssid='My Wi-Fi', wifi_rssi_db=-77, cloud_enabled=False, uptime_s=356, status_led_brightness_pct=100, api_v1_enabled=True)
Expand Down
Loading

0 comments on commit 0cdc49a

Please sign in to comment.