mirror of
https://github.com/home-assistant/core.git
synced 2026-09-07 18:25:01 -05:00
Tuya add missing sensors for Metering_3PN_ZB (dlq) device (#151601)
This commit is contained in:
@@ -385,6 +385,18 @@ SENSORS: dict[str, tuple[TuyaSensorEntityDescription, ...]] = {
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
),
|
||||
TuyaSensorEntityDescription(
|
||||
key=DPCode.FORWARD_ENERGY_TOTAL,
|
||||
translation_key="total_energy",
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
),
|
||||
TuyaSensorEntityDescription(
|
||||
key=DPCode.REVERSE_ENERGY_TOTAL,
|
||||
translation_key="total_production",
|
||||
device_class=SensorDeviceClass.ENERGY,
|
||||
state_class=SensorStateClass.TOTAL_INCREASING,
|
||||
),
|
||||
TuyaSensorEntityDescription(
|
||||
key=DPCode.SUPPLY_FREQUENCY,
|
||||
translation_key="supply_frequency",
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
{
|
||||
"endpoint": "https://apigw.tuyaus.com",
|
||||
"terminal_id": "1747852059900mCJdQO",
|
||||
"mqtt_connected": true,
|
||||
"disabled_by": null,
|
||||
"disabled_polling": false,
|
||||
"id": "eb40f2a309edea3892f0o2",
|
||||
"name": "Medidor de Energia",
|
||||
"category": "dlq",
|
||||
"product_id": "dikb3dp6",
|
||||
"product_name": "Metering_3PN_ZB",
|
||||
"online": true,
|
||||
"sub": true,
|
||||
"time_zone": "-03:00",
|
||||
"active_time": "2025-09-01T18:39:27+00:00",
|
||||
"create_time": "2025-09-01T18:39:27+00:00",
|
||||
"update_time": "2025-09-01T18:39:27+00:00",
|
||||
"function": {
|
||||
"clear_energy": {
|
||||
"type": "Boolean",
|
||||
"value": {}
|
||||
},
|
||||
"alarm_set_1": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"alarm_set_2": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"online_state": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["online", "offline"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"status_range": {
|
||||
"forward_energy_total": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "kW.h",
|
||||
"min": 0,
|
||||
"max": 999999999,
|
||||
"scale": 2,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"phase_a": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"phase_b": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"phase_c": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"fault": {
|
||||
"type": "Bitmap",
|
||||
"value": {
|
||||
"label": [
|
||||
"short_circuit_alarm",
|
||||
"surge_alarm",
|
||||
"overload_alarm",
|
||||
"leakagecurr_alarm",
|
||||
"temp_dif_fault",
|
||||
"fire_alarm",
|
||||
"high_power_alarm",
|
||||
"self_test_alarm",
|
||||
"ov_cr",
|
||||
"unbalance_alarm",
|
||||
"ov_vol",
|
||||
"undervoltage_alarm",
|
||||
"miss_phase_alarm",
|
||||
"outage_alarm",
|
||||
"magnetism_alarm",
|
||||
"credit_alarm",
|
||||
"no_balance_alarm"
|
||||
]
|
||||
}
|
||||
},
|
||||
"energy_reset": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["empty"]
|
||||
}
|
||||
},
|
||||
"alarm_set_1": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"alarm_set_2": {
|
||||
"type": "Raw",
|
||||
"value": {}
|
||||
},
|
||||
"breaker_number": {
|
||||
"type": "String",
|
||||
"value": {
|
||||
"maxlen": 255
|
||||
}
|
||||
},
|
||||
"reverse_energy_total": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "kW.h",
|
||||
"min": 0,
|
||||
"max": 999999999,
|
||||
"scale": 2,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"supply_frequency": {
|
||||
"type": "Integer",
|
||||
"value": {
|
||||
"unit": "Hz",
|
||||
"min": 0,
|
||||
"max": 9999,
|
||||
"scale": 2,
|
||||
"step": 1
|
||||
}
|
||||
},
|
||||
"online_state": {
|
||||
"type": "Enum",
|
||||
"value": {
|
||||
"range": ["online", "offline"]
|
||||
}
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"forward_energy_total": 13540,
|
||||
"phase_a": "CREANUkADG8=",
|
||||
"phase_b": "CTIAVfcAFGw=",
|
||||
"phase_c": "CPQAI58ACBA=",
|
||||
"fault": 16896,
|
||||
"energy_reset": "empty",
|
||||
"alarm_set_1": "BwAAGQ==",
|
||||
"alarm_set_2": "AQAAPwIBAA8DAQD9BAAAtAUAAAAHAQAA",
|
||||
"breaker_number": "dik24350001",
|
||||
"reverse_energy_total": 12552,
|
||||
"supply_frequency": 6002,
|
||||
"online_state": "online"
|
||||
},
|
||||
"set_up": true,
|
||||
"support_local": true
|
||||
}
|
||||
@@ -3431,6 +3431,62 @@
|
||||
'state': '0.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sensor.duan_lu_qi_ha_total_energy-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.duan_lu_qi_ha_total_energy',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Total energy',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'total_energy',
|
||||
'unique_id': 'tuya.qi94v9dmdx4fkpncqldforward_energy_total',
|
||||
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sensor.duan_lu_qi_ha_total_energy-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'energy',
|
||||
'friendly_name': '断路器HA Total energy',
|
||||
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.duan_lu_qi_ha_total_energy',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '0.12',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sensor.eau_chaude_current-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
@@ -8516,6 +8572,62 @@
|
||||
'state': '50.0',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sensor.metering_3pn_wifi_stable_total_energy-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
}),
|
||||
'area_id': None,
|
||||
'capabilities': dict({
|
||||
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
}),
|
||||
'config_entry_id': <ANY>,
|
||||
'config_subentry_id': <ANY>,
|
||||
'device_class': None,
|
||||
'device_id': <ANY>,
|
||||
'disabled_by': None,
|
||||
'domain': 'sensor',
|
||||
'entity_category': None,
|
||||
'entity_id': 'sensor.metering_3pn_wifi_stable_total_energy',
|
||||
'has_entity_name': True,
|
||||
'hidden_by': None,
|
||||
'icon': None,
|
||||
'id': <ANY>,
|
||||
'labels': set({
|
||||
}),
|
||||
'name': None,
|
||||
'options': dict({
|
||||
'sensor': dict({
|
||||
'suggested_display_precision': 2,
|
||||
}),
|
||||
}),
|
||||
'original_device_class': <SensorDeviceClass.ENERGY: 'energy'>,
|
||||
'original_icon': None,
|
||||
'original_name': 'Total energy',
|
||||
'platform': 'tuya',
|
||||
'previous_unique_id': None,
|
||||
'suggested_object_id': None,
|
||||
'supported_features': 0,
|
||||
'translation_key': 'total_energy',
|
||||
'unique_id': 'tuya.obb7p55c0us6rdxkqldforward_energy_total',
|
||||
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sensor.metering_3pn_wifi_stable_total_energy-state]
|
||||
StateSnapshot({
|
||||
'attributes': ReadOnlyDict({
|
||||
'device_class': 'energy',
|
||||
'friendly_name': 'Metering_3PN_WiFi_stable Total energy',
|
||||
'state_class': <SensorStateClass.TOTAL_INCREASING: 'total_increasing'>,
|
||||
'unit_of_measurement': <UnitOfEnergy.KILO_WATT_HOUR: 'kWh'>,
|
||||
}),
|
||||
'context': <ANY>,
|
||||
'entity_id': 'sensor.metering_3pn_wifi_stable_total_energy',
|
||||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '24354.16',
|
||||
})
|
||||
# ---
|
||||
# name: test_platform_setup_and_discovery[sensor.motion_sensor_lidl_zigbee_battery-entry]
|
||||
EntityRegistryEntrySnapshot({
|
||||
'aliases': set({
|
||||
|
||||
Reference in New Issue
Block a user