Remove duplicate sensors on single phase HomeWizard meters (#104493)

Co-authored-by: Duco Sebel <74970928+DCSBL@users.noreply.github.com>
This commit is contained in:
Franck Nijhof 2023-11-26 11:42:47 +01:00 committed by GitHub
parent 4a5b1ab301
commit 32eab2c7ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 488 deletions

View file

@ -114,7 +114,11 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_energy_import_t1_kwh is not None,
has_fn=lambda data: (
# SKT/SDM230/630 provides both total and tariff 1: duplicate.
data.total_energy_import_t1_kwh is not None
and data.total_energy_export_t2_kwh is not None
),
value_fn=lambda data: data.total_energy_import_t1_kwh,
),
HomeWizardSensorEntityDescription(
@ -160,7 +164,11 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_energy_export_t1_kwh is not None,
has_fn=lambda data: (
# SKT/SDM230/630 provides both total and tariff 1: duplicate.
data.total_energy_export_t1_kwh is not None
and data.total_energy_export_t2_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,
),