Skip to content

Commit

Permalink
Add sensors for code wsdcg
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Oct 16, 2023
1 parent 6170b69 commit c1c382c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 2 additions & 0 deletions custom_components/localtuya/core/tuya_devices/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,8 @@ class DPCode(StrEnum):
PRESENCE_STATE = "presence_state"
PRESSURE_STATE = "pressure_state"
PRESSURE_VALUE = "pressure_value"
PRM_CONTENT = "prm_content"
PRM_TEMPERATURE = "prm_temperature"
PTZ_CONTROL = "ptz_control"
PUMP_RESET = "pump_reset" # Water pump reset
RECORD_MODE = "record_mode"
Expand Down
18 changes: 11 additions & 7 deletions custom_components/localtuya/core/tuya_devices/sensors.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
UnitOfPower,
UnitOfTime,
CONF_UNIT_OF_MEASUREMENT,
UnitOfTemperature,
)

from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory
Expand Down Expand Up @@ -610,31 +611,34 @@ def localtuya_sensor(unit_of_measurement=None, scale_factor: float = None) -> di
"wsdcg": (
LocalTuyaEntity(
id=DPCode.VA_TEMPERATURE,
# translation_id="temperature",
name="Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
),
LocalTuyaEntity(
id=DPCode.TEMP_CURRENT,
# translation_id="temperature",
id=(DPCode.TEMP_CURRENT, DPCode.PRM_CONTENT),
name="Temperature",
device_class=SensorDeviceClass.TEMPERATURE,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(UnitOfTemperature.CELSIUS, 0.01),
),
LocalTuyaEntity(
id=DPCode.VA_HUMIDITY,
# translation_id="humidity",
name="Humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(PERCENTAGE, 0.01),
),
LocalTuyaEntity(
id=DPCode.HUMIDITY_VALUE,
# translation_id="humidity",
id=(DPCode.HUMIDITY_VALUE, DPCode.PRM_CONTENT),
name="Humidity",
device_class=SensorDeviceClass.HUMIDITY,
state_class=SensorStateClass.MEASUREMENT,
custom_configs=localtuya_sensor(PERCENTAGE, 0.01),
),
LocalTuyaEntity(
id=DPCode.BRIGHT_VALUE,
# translation_id="illuminance",
translation_id="Illuminance",
device_class=SensorDeviceClass.ILLUMINANCE,
state_class=SensorStateClass.MEASUREMENT,
),
Expand Down

0 comments on commit c1c382c

Please sign in to comment.