Rename power to energy in HomeWizard (#102948)

This commit is contained in:
Duco Sebel 2023-10-30 19:09:23 +01:00 committed by GitHub
parent cb0517d20e
commit 0f72495a7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 904 additions and 104 deletions

View File

@ -7,6 +7,6 @@
"iot_class": "local_polling",
"loggers": ["homewizard_energy"],
"quality_scale": "platinum",
"requirements": ["python-homewizard-energy==2.1.2"],
"requirements": ["python-homewizard-energy==3.0.0"],
"zeroconf": ["_hwenergy._tcp.local."]
}

View File

@ -109,98 +109,98 @@ SENSORS: Final[tuple[HomeWizardSensorEntityDescription, ...]] = (
),
HomeWizardSensorEntityDescription(
key="total_power_import_kwh",
translation_key="total_power_import_kwh",
translation_key="total_energy_import_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_import_kwh is not None,
value_fn=lambda data: data.total_power_import_kwh or None,
has_fn=lambda data: data.total_energy_import_kwh is not None,
value_fn=lambda data: data.total_energy_import_kwh or None,
),
HomeWizardSensorEntityDescription(
key="total_power_import_t1_kwh",
translation_key="total_power_import_t1_kwh",
translation_key="total_energy_import_t1_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_import_t1_kwh is not None,
value_fn=lambda data: data.total_power_import_t1_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_import_t2_kwh",
translation_key="total_power_import_t2_kwh",
translation_key="total_energy_import_t2_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_import_t2_kwh is not None,
value_fn=lambda data: data.total_power_import_t2_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_import_t3_kwh",
translation_key="total_power_import_t3_kwh",
translation_key="total_energy_import_t3_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_import_t3_kwh is not None,
value_fn=lambda data: data.total_power_import_t3_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_import_t4_kwh",
translation_key="total_power_import_t4_kwh",
translation_key="total_energy_import_t4_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_import_t4_kwh is not None,
value_fn=lambda data: data.total_power_import_t4_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_export_kwh",
translation_key="total_power_export_kwh",
translation_key="total_energy_export_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_export_kwh is not None,
enabled_fn=lambda data: data.total_power_export_kwh != 0,
value_fn=lambda data: data.total_power_export_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_export_t1_kwh",
translation_key="total_power_export_t1_kwh",
translation_key="total_energy_export_t1_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_export_t1_kwh is not None,
enabled_fn=lambda data: data.total_power_export_t1_kwh != 0,
value_fn=lambda data: data.total_power_export_t1_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_export_t2_kwh",
translation_key="total_power_export_t2_kwh",
translation_key="total_energy_export_t2_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_export_t2_kwh is not None,
enabled_fn=lambda data: data.total_power_export_t2_kwh != 0,
value_fn=lambda data: data.total_power_export_t2_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_export_t3_kwh",
translation_key="total_power_export_t3_kwh",
translation_key="total_energy_export_t3_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_export_t3_kwh is not None,
enabled_fn=lambda data: data.total_power_export_t3_kwh != 0,
value_fn=lambda data: data.total_power_export_t3_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="total_power_export_t4_kwh",
translation_key="total_power_export_t4_kwh",
translation_key="total_energy_export_t4_kwh",
native_unit_of_measurement=UnitOfEnergy.KILO_WATT_HOUR,
device_class=SensorDeviceClass.ENERGY,
state_class=SensorStateClass.TOTAL_INCREASING,
has_fn=lambda data: data.total_power_export_t4_kwh is not None,
enabled_fn=lambda data: data.total_power_export_t4_kwh != 0,
value_fn=lambda data: data.total_power_export_t4_kwh or None,
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,
),
HomeWizardSensorEntityDescription(
key="active_power_w",

View File

@ -53,35 +53,35 @@
"wifi_strength": {
"name": "Wi-Fi strength"
},
"total_power_import_kwh": {
"name": "Total power import"
"total_energy_import_kwh": {
"name": "Total energy import"
},
"total_power_import_t1_kwh": {
"name": "Total power import tariff 1"
"total_energy_import_t1_kwh": {
"name": "Total energy import tariff 1"
},
"total_power_import_t2_kwh": {
"name": "Total power import tariff 2"
"total_energy_import_t2_kwh": {
"name": "Total energy import tariff 2"
},
"total_power_import_t3_kwh": {
"name": "Total power import tariff 3"
"total_energy_import_t3_kwh": {
"name": "Total energy import tariff 3"
},
"total_power_import_t4_kwh": {
"name": "Total power import tariff 4"
"total_energy_import_t4_kwh": {
"name": "Total energy import tariff 4"
},
"total_power_export_kwh": {
"name": "Total power export"
"total_energy_export_kwh": {
"name": "Total energy export"
},
"total_power_export_t1_kwh": {
"name": "Total power export tariff 1"
"total_energy_export_t1_kwh": {
"name": "Total energy export tariff 1"
},
"total_power_export_t2_kwh": {
"name": "Total power export tariff 2"
"total_energy_export_t2_kwh": {
"name": "Total energy export tariff 2"
},
"total_power_export_t3_kwh": {
"name": "Total power export tariff 3"
"total_energy_export_t3_kwh": {
"name": "Total energy export tariff 3"
},
"total_power_export_t4_kwh": {
"name": "Total power export tariff 4"
"total_energy_export_t4_kwh": {
"name": "Total energy export tariff 4"
},
"active_power_w": {
"name": "Active power"

View File

@ -2126,7 +2126,7 @@ python-gc100==1.0.3a0
python-gitlab==1.6.0
# homeassistant.components.homewizard
python-homewizard-energy==2.1.2
python-homewizard-energy==3.0.0
# homeassistant.components.hp_ilo
python-hpilo==4.3

View File

@ -1588,7 +1588,7 @@ python-ecobee-api==0.2.17
python-fullykiosk==0.0.12
# homeassistant.components.homewizard
python-homewizard-energy==2.1.2
python-homewizard-energy==3.0.0
# homeassistant.components.izone
python-izone==1.2.9

View File

@ -28,16 +28,16 @@
'smr_version': 50,
'total_gas_m3': 1122.333,
'total_liter_m3': 1234.567,
'total_power_export_kwh': 13086.777,
'total_power_export_t1_kwh': 4321.333,
'total_power_export_t2_kwh': 8765.444,
'total_power_export_t3_kwh': None,
'total_power_export_t4_kwh': None,
'total_power_import_kwh': 13779.338,
'total_power_import_t1_kwh': 10830.511,
'total_power_import_t2_kwh': 2948.827,
'total_power_import_t3_kwh': None,
'total_power_import_t4_kwh': None,
'total_energy_export_kwh': 13086.777,
'total_energy_export_t1_kwh': 4321.333,
'total_energy_export_t2_kwh': 8765.444,
'total_energy_export_t3_kwh': None,
'total_energy_export_t4_kwh': None,
'total_energy_import_kwh': 13779.338,
'total_energy_import_t1_kwh': 10830.511,
'total_energy_import_t2_kwh': 2948.827,
'total_energy_import_t3_kwh': None,
'total_energy_import_t4_kwh': None,
'unique_meter_id': '**REDACTED**',
'voltage_sag_l1_count': 1,
'voltage_sag_l2_count': 2,
@ -96,18 +96,18 @@
'monthly_power_peak_timestamp': '2023-01-01T08:00:10',
'monthly_power_peak_w': 1111.0,
'smr_version': 50,
'total_energy_export_kwh': 13086.777,
'total_energy_export_t1_kwh': 4321.333,
'total_energy_export_t2_kwh': 8765.444,
'total_energy_export_t3_kwh': 8765.444,
'total_energy_export_t4_kwh': 8765.444,
'total_energy_import_kwh': 13779.338,
'total_energy_import_t1_kwh': 10830.511,
'total_energy_import_t2_kwh': 2948.827,
'total_energy_import_t3_kwh': 2948.827,
'total_energy_import_t4_kwh': 2948.827,
'total_gas_m3': 1122.333,
'total_liter_m3': 1234.567,
'total_power_export_kwh': 13086.777,
'total_power_export_t1_kwh': 4321.333,
'total_power_export_t2_kwh': 8765.444,
'total_power_export_t3_kwh': 8765.444,
'total_power_export_t4_kwh': 8765.444,
'total_power_import_kwh': 13779.338,
'total_power_import_t1_kwh': 10830.511,
'total_power_import_t2_kwh': 2948.827,
'total_power_import_t3_kwh': 2948.827,
'total_power_import_t4_kwh': 2948.827,
'unique_meter_id': '**REDACTED**',
'voltage_sag_l1_count': 1,
'voltage_sag_l2_count': 2,
@ -165,18 +165,18 @@
'monthly_power_peak_timestamp': '2023-01-01T08:00:10',
'monthly_power_peak_w': 1111.0,
'smr_version': 50,
'total_energy_export_kwh': 13086.777,
'total_energy_export_t1_kwh': 4321.333,
'total_energy_export_t2_kwh': 8765.444,
'total_energy_export_t3_kwh': 8765.444,
'total_energy_export_t4_kwh': 8765.444,
'total_energy_import_kwh': 13779.338,
'total_energy_import_t1_kwh': 10830.511,
'total_energy_import_t2_kwh': 2948.827,
'total_energy_import_t3_kwh': 2948.827,
'total_energy_import_t4_kwh': 2948.827,
'total_gas_m3': 1122.333,
'total_liter_m3': 1234.567,
'total_power_export_kwh': 13086.777,
'total_power_export_t1_kwh': 4321.333,
'total_power_export_t2_kwh': 8765.444,
'total_power_export_t3_kwh': 8765.444,
'total_power_export_t4_kwh': 8765.444,
'total_power_import_kwh': 13779.338,
'total_power_import_t1_kwh': 10830.511,
'total_power_import_t2_kwh': 2948.827,
'total_power_import_t3_kwh': 2948.827,
'total_power_import_t4_kwh': 2948.827,
'unique_meter_id': '**REDACTED**',
'voltage_sag_l1_count': 1,
'voltage_sag_l2_count': 2,

View File

@ -2331,6 +2331,806 @@
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_export',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy export',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_export_kwh',
'unique_id': 'aabbccddeeff_total_power_export_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy export',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_export',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '13086.777',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_1:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_1:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_export_tariff_1',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy export tariff 1',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_export_t1_kwh',
'unique_id': 'aabbccddeeff_total_power_export_t1_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_1:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy export tariff 1',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_export_tariff_1',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '4321.333',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_2:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_2:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_export_tariff_2',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy export tariff 2',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_export_t2_kwh',
'unique_id': 'aabbccddeeff_total_power_export_t2_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_2:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy export tariff 2',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_export_tariff_2',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '8765.444',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_3:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_3:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_export_tariff_3',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy export tariff 3',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_export_t3_kwh',
'unique_id': 'aabbccddeeff_total_power_export_t3_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_3:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy export tariff 3',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_export_tariff_3',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '8765.444',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_4:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_4:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_export_tariff_4',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy export tariff 4',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_export_t4_kwh',
'unique_id': 'aabbccddeeff_total_power_export_t4_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_export_tariff_4:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy export tariff 4',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_export_tariff_4',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '8765.444',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_import',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy import',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_import_kwh',
'unique_id': 'aabbccddeeff_total_power_import_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy import',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_import',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '13779.338',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_1:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_1:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_import_tariff_1',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy import tariff 1',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_import_t1_kwh',
'unique_id': 'aabbccddeeff_total_power_import_t1_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_1:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy import tariff 1',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_import_tariff_1',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '10830.511',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_2:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_2:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_import_tariff_2',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy import tariff 2',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_import_t2_kwh',
'unique_id': 'aabbccddeeff_total_power_import_t2_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_2:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy import tariff 2',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_import_tariff_2',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '2948.827',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_3:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_3:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_import_tariff_3',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy import tariff 3',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_import_t3_kwh',
'unique_id': 'aabbccddeeff_total_power_import_t3_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_3:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy import tariff 3',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_import_tariff_3',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '2948.827',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_4:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,
'config_entries': <ANY>,
'configuration_url': None,
'connections': set({
tuple(
'mac',
'3c:39:e7:aa:bb:cc',
),
}),
'disabled_by': None,
'entry_type': None,
'hw_version': None,
'id': <ANY>,
'identifiers': set({
tuple(
'homewizard',
'3c39e7aabbcc',
),
}),
'is_new': False,
'manufacturer': 'HomeWizard',
'model': 'HWE-P1',
'name': 'Device',
'name_by_user': None,
'serial_number': None,
'suggested_area': None,
'sw_version': '4.19',
'via_device_id': None,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_4:entity-registry]
EntityRegistryEntrySnapshot({
'aliases': set({
}),
'area_id': None,
'capabilities': dict({
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
}),
'config_entry_id': <ANY>,
'device_class': None,
'device_id': <ANY>,
'disabled_by': None,
'domain': 'sensor',
'entity_category': None,
'entity_id': 'sensor.device_total_energy_import_tariff_4',
'has_entity_name': True,
'hidden_by': None,
'icon': None,
'id': <ANY>,
'name': None,
'options': dict({
}),
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
'original_icon': None,
'original_name': 'Total energy import tariff 4',
'platform': 'homewizard',
'previous_unique_id': None,
'supported_features': 0,
'translation_key': 'total_energy_import_t4_kwh',
'unique_id': 'aabbccddeeff_total_power_import_t4_kwh',
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_energy_import_tariff_4:state]
StateSnapshot({
'attributes': ReadOnlyDict({
'device_class': 'energy',
'friendly_name': 'Device Total energy import tariff 4',
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
}),
'context': <ANY>,
'entity_id': 'sensor.device_total_energy_import_tariff_4',
'last_changed': <ANY>,
'last_updated': <ANY>,
'state': '2948.827',
})
# ---
# name: test_sensors_p1_meter[device-HWE-P1.json-data-HWE-P1.json-entity_ids0][sensor.device_total_gas:device-registry]
DeviceRegistryEntrySnapshot({
'area_id': None,

View File

@ -33,16 +33,16 @@ pytestmark = [
"sensor.device_wi_fi_ssid",
"sensor.device_active_tariff",
"sensor.device_wi_fi_strength",
"sensor.device_total_power_import",
"sensor.device_total_power_import_tariff_1",
"sensor.device_total_power_import_tariff_2",
"sensor.device_total_power_import_tariff_3",
"sensor.device_total_power_import_tariff_4",
"sensor.device_total_power_export",
"sensor.device_total_power_export_tariff_1",
"sensor.device_total_power_export_tariff_2",
"sensor.device_total_power_export_tariff_3",
"sensor.device_total_power_export_tariff_4",
"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",
@ -120,11 +120,11 @@ async def test_disabled_by_default_sensors(
@pytest.mark.parametrize(
"entity_id",
[
"sensor.device_total_power_export",
"sensor.device_total_power_export_tariff_1",
"sensor.device_total_power_export_tariff_2",
"sensor.device_total_power_export_tariff_3",
"sensor.device_total_power_export_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",
],
)
async def test_disabled_by_default_sensors_when_unused(
@ -147,7 +147,7 @@ async def test_sensors_unreachable(
exception: Exception,
) -> None:
"""Test sensor handles API unreachable."""
assert (state := hass.states.get("sensor.device_total_power_import_tariff_1"))
assert (state := hass.states.get("sensor.device_total_energy_import_tariff_1"))
assert state.state == "10830.511"
mock_homewizardenergy.data.side_effect = exception