Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove duplicate sensors on single phase HomeWizard meters #104493

Merged
merged 2 commits into from
Nov 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions homeassistant/components/homewizard/sensor.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,11 @@ class HomeWizardSensorEntityDescription(SensorEntityDescription):
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(
Expand Down Expand Up @@ -160,7 +164,11 @@ class HomeWizardSensorEntityDescription(SensorEntityDescription):
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,
),
Expand Down
Loading