Skip to content

Commit 3a63542

Browse files
committedJan 17, 2025·
chore(auto_configure): adjust device class / network for qt category
1 parent 363491a commit 3a63542

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed
 

‎custom_components/localtuya/core/ha_entities/selects.py

+6
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,12 @@ def localtuya_selector(options):
487487
{"enabled_energy": "Enable", "forbidden_energy": "Disable"}
488488
),
489489
),
490+
LocalTuyaEntity(
491+
id=DPCode.NETWORK_MODEL,
492+
name="Network",
493+
entity_category=EntityCategory.CONFIG,
494+
custom_configs=localtuya_selector({"LAN": "LAN", "4G": "4G"}),
495+
),
490496
),
491497
# Siren Alarm
492498
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu

‎custom_components/localtuya/core/ha_entities/sensors.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -759,16 +759,16 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict:
759759
LocalTuyaEntity(
760760
id=DPCode.ELECTRICITY_PHASE_A,
761761
name="Electricity Phase A",
762-
device_class=SensorDeviceClass.VOLTAGE,
762+
device_class=SensorDeviceClass.CURRENT,
763763
state_class=SensorStateClass.MEASUREMENT,
764-
custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.01),
764+
custom_configs=localtuya_sensor(UnitOfElectricCurrent.AMPERE, 0.01),
765765
),
766766
LocalTuyaEntity(
767767
id=DPCode.ELECTRICITY_PHASE_B,
768768
name="Electricity Phase B",
769-
device_class=SensorDeviceClass.VOLTAGE,
769+
device_class=SensorDeviceClass.CURRENT,
770770
state_class=SensorStateClass.MEASUREMENT,
771-
custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.01),
771+
custom_configs=localtuya_sensor(UnitOfElectricCurrent.AMPERE, 0.01),
772772
),
773773
LocalTuyaEntity(
774774
id=DPCode.ELECTRICITY_PHASE_C,
@@ -808,11 +808,6 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict:
808808
name="Version",
809809
entity_category=EntityCategory.DIAGNOSTIC,
810810
),
811-
LocalTuyaEntity(
812-
id=DPCode.NETWORK_MODEL,
813-
name="Network",
814-
entity_category=EntityCategory.DIAGNOSTIC,
815-
),
816811
),
817812
# Gas Detector
818813
# https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw

0 commit comments

Comments
 (0)
Please sign in to comment.