mirror of
https://github.com/home-assistant/core.git
synced 2025-04-24 01:08:12 +00:00
Fix HomeWizard sensors unavailable when value is '0' (#104302)
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
parent
94995f560f
commit
d4458cbac4
@ -106,7 +106,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_import_kwh is not None,
|
||||
value_fn=lambda data: data.total_energy_import_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_import_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t1_kwh",
|
||||
@ -115,7 +115,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_import_t1_kwh is not None,
|
||||
value_fn=lambda data: data.total_energy_import_t1_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_import_t1_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t2_kwh",
|
||||
@ -124,7 +124,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_import_t2_kwh is not None,
|
||||
value_fn=lambda data: data.total_energy_import_t2_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_import_t2_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t3_kwh",
|
||||
@ -133,7 +133,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_import_t3_kwh is not None,
|
||||
value_fn=lambda data: data.total_energy_import_t3_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_import_t3_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_import_t4_kwh",
|
||||
@ -142,7 +142,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_import_t4_kwh is not None,
|
||||
value_fn=lambda data: data.total_energy_import_t4_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_import_t4_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_kwh",
|
||||
@ -152,7 +152,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_export_kwh is not None,
|
||||
enabled_fn=lambda data: data.total_energy_export_kwh != 0,
|
||||
value_fn=lambda data: data.total_energy_export_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_export_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t1_kwh",
|
||||
@ -162,7 +162,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_export_t1_kwh is not None,
|
||||
enabled_fn=lambda data: data.total_energy_export_t1_kwh != 0,
|
||||
value_fn=lambda data: data.total_energy_export_t1_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_export_t1_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t2_kwh",
|
||||
@ -172,7 +172,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_export_t2_kwh is not None,
|
||||
enabled_fn=lambda data: data.total_energy_export_t2_kwh != 0,
|
||||
value_fn=lambda data: data.total_energy_export_t2_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_export_t2_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t3_kwh",
|
||||
@ -182,7 +182,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_export_t3_kwh is not None,
|
||||
enabled_fn=lambda data: data.total_energy_export_t3_kwh != 0,
|
||||
value_fn=lambda data: data.total_energy_export_t3_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_export_t3_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="total_power_export_t4_kwh",
|
||||
@ -192,7 +192,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_energy_export_t4_kwh is not None,
|
||||
enabled_fn=lambda data: data.total_energy_export_t4_kwh != 0,
|
||||
value_fn=lambda data: data.total_energy_export_t4_kwh or None,
|
||||
value_fn=lambda data: data.total_energy_export_t4_kwh,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="active_power_w",
|
||||
@ -391,7 +391,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.GAS,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_gas_m3 is not None,
|
||||
value_fn=lambda data: data.total_gas_m3 or None,
|
||||
value_fn=lambda data: data.total_gas_m3,
|
||||
),
|
||||
HomeWizardSensorEntityDescription(
|
||||
key="gas_unique_id",
|
||||
@ -418,7 +418,7 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
|
||||
device_class=SensorDeviceClass.WATER,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
has_fn=lambda data: data.total_liter_m3 is not None,
|
||||
value_fn=lambda data: data.total_liter_m3 or None,
|
||||
value_fn=lambda data: data.total_liter_m3,
|
||||
),
|
||||
)
|
||||
|
||||
|
@ -0,0 +1,45 @@
|
||||
{
|
||||
"wifi_ssid": "My Wi-Fi",
|
||||
"wifi_strength": 100,
|
||||
"smr_version": 50,
|
||||
"meter_model": "ISKRA 2M550T-101",
|
||||
"unique_id": "00112233445566778899AABBCCDDEEFF",
|
||||
"active_tariff": 2,
|
||||
"total_power_import_kwh": 0.0,
|
||||
"total_power_import_t1_kwh": 0.0,
|
||||
"total_power_import_t2_kwh": 0.0,
|
||||
"total_power_import_t3_kwh": 0.0,
|
||||
"total_power_import_t4_kwh": 0.0,
|
||||
"total_power_export_kwh": 0.0,
|
||||
"total_power_export_t1_kwh": 0.0,
|
||||
"total_power_export_t2_kwh": 0.0,
|
||||
"total_power_export_t3_kwh": 0.0,
|
||||
"total_power_export_t4_kwh": 0.0,
|
||||
"active_power_w": 0.0,
|
||||
"active_power_l1_w": 0.0,
|
||||
"active_power_l2_w": 0.0,
|
||||
"active_power_l3_w": 0.0,
|
||||
"active_voltage_l1_v": 0.0,
|
||||
"active_voltage_l2_v": 0.0,
|
||||
"active_voltage_l3_v": 0.0,
|
||||
"active_current_l1_a": 0,
|
||||
"active_current_l2_a": 0,
|
||||
"active_current_l3_a": 0,
|
||||
"active_frequency_hz": 0,
|
||||
"voltage_sag_l1_count": 0,
|
||||
"voltage_sag_l2_count": 0,
|
||||
"voltage_sag_l3_count": 0,
|
||||
"voltage_swell_l1_count": 0,
|
||||
"voltage_swell_l2_count": 0,
|
||||
"voltage_swell_l3_count": 0,
|
||||
"any_power_fail_count": 0,
|
||||
"long_power_fail_count": 0,
|
||||
"total_gas_m3": 0.0,
|
||||
"gas_timestamp": 210314112233,
|
||||
"gas_unique_id": "01FFEEDDCCBBAA99887766554433221100",
|
||||
"active_power_average_w": 0,
|
||||
"montly_power_peak_w": 0.0,
|
||||
"montly_power_peak_timestamp": 230101080010,
|
||||
"active_liter_lpm": 0.0,
|
||||
"total_liter_m3": 0.0
|
||||
}
|
@ -0,0 +1,7 @@
|
||||
{
|
||||
"product_type": "HWE-P1",
|
||||
"product_name": "P1 meter",
|
||||
"serial": "3c39e7aabbcc",
|
||||
"firmware_version": "4.19",
|
||||
"api_version": "v1"
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"cloud_enabled": true
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -69,6 +69,45 @@ pytestmark = [
|
||||
"sensor.device_total_water_usage",
|
||||
],
|
||||
),
|
||||
(
|
||||
"HWE-P1-zero-values",
|
||||
[
|
||||
"sensor.device_total_energy_import",
|
||||
"sensor.device_total_energy_import_tariff_1",
|
||||
"sensor.device_total_energy_import_tariff_2",
|
||||
"sensor.device_total_energy_import_tariff_3",
|
||||
"sensor.device_total_energy_import_tariff_4",
|
||||
"sensor.device_total_energy_export",
|
||||
"sensor.device_total_energy_export_tariff_1",
|
||||
"sensor.device_total_energy_export_tariff_2",
|
||||
"sensor.device_total_energy_export_tariff_3",
|
||||
"sensor.device_total_energy_export_tariff_4",
|
||||
"sensor.device_active_power",
|
||||
"sensor.device_active_power_phase_1",
|
||||
"sensor.device_active_power_phase_2",
|
||||
"sensor.device_active_power_phase_3",
|
||||
"sensor.device_active_voltage_phase_1",
|
||||
"sensor.device_active_voltage_phase_2",
|
||||
"sensor.device_active_voltage_phase_3",
|
||||
"sensor.device_active_current_phase_1",
|
||||
"sensor.device_active_current_phase_2",
|
||||
"sensor.device_active_current_phase_3",
|
||||
"sensor.device_active_frequency",
|
||||
"sensor.device_voltage_sags_detected_phase_1",
|
||||
"sensor.device_voltage_sags_detected_phase_2",
|
||||
"sensor.device_voltage_sags_detected_phase_3",
|
||||
"sensor.device_voltage_swells_detected_phase_1",
|
||||
"sensor.device_voltage_swells_detected_phase_2",
|
||||
"sensor.device_voltage_swells_detected_phase_3",
|
||||
"sensor.device_power_failures_detected",
|
||||
"sensor.device_long_power_failures_detected",
|
||||
"sensor.device_active_average_demand",
|
||||
"sensor.device_peak_demand_current_month",
|
||||
"sensor.device_total_gas",
|
||||
"sensor.device_active_water_usage",
|
||||
"sensor.device_total_water_usage",
|
||||
],
|
||||
),
|
||||
(
|
||||
"HWE-WTR",
|
||||
[
|
||||
|
Loading…
x
Reference in New Issue
Block a user