Skip to content

Commit

Permalink
chore(auto_configure): adjust device class / network for qt category
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 17, 2025
1 parent 363491a commit 3a63542
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
6 changes: 6 additions & 0 deletions custom_components/localtuya/core/ha_entities/selects.py
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,12 @@ def localtuya_selector(options):
{"enabled_energy": "Enable", "forbidden_energy": "Disable"}
),
),
LocalTuyaEntity(
id=DPCode.NETWORK_MODEL,
name="Network",
entity_category=EntityCategory.CONFIG,
custom_configs=localtuya_selector({"LAN": "LAN", "4G": "4G"}),
),
),
# Siren Alarm
# https://developer.tuya.com/en/docs/iot/categorysgbj?id=Kaiuz37tlpbnu
Expand Down
13 changes: 4 additions & 9 deletions custom_components/localtuya/core/ha_entities/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,16 +759,16 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict:
LocalTuyaEntity(
id=DPCode.ELECTRICITY_PHASE_A,
name="Electricity Phase A",
device_class=SensorDeviceClass.VOLTAGE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.01),
custom_configs=localtuya_sensor(UnitOfElectricCurrent.AMPERE, 0.01),
),
LocalTuyaEntity(
id=DPCode.ELECTRICITY_PHASE_B,
name="Electricity Phase B",
device_class=SensorDeviceClass.VOLTAGE,
device_class=SensorDeviceClass.CURRENT,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(UnitOfElectricPotential.VOLT, 0.01),
custom_configs=localtuya_sensor(UnitOfElectricCurrent.AMPERE, 0.01),
),
LocalTuyaEntity(
id=DPCode.ELECTRICITY_PHASE_C,
Expand Down Expand Up @@ -808,11 +808,6 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = 1) -> dict:
name="Version",
entity_category=EntityCategory.DIAGNOSTIC,
),
LocalTuyaEntity(
id=DPCode.NETWORK_MODEL,
name="Network",
entity_category=EntityCategory.DIAGNOSTIC,
),
),
# Gas Detector
# https://developer.tuya.com/en/docs/iot/categoryrqbj?id=Kaiuz3d162ubw
Expand Down

0 comments on commit 3a63542

Please sign in to comment.