diff --git a/custom_components/localtuya/core/tuya_devices/base.py b/custom_components/localtuya/core/tuya_devices/base.py index 9d2813e9c..eef5cd49c 100644 --- a/custom_components/localtuya/core/tuya_devices/base.py +++ b/custom_components/localtuya/core/tuya_devices/base.py @@ -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" diff --git a/custom_components/localtuya/core/tuya_devices/sensors.py b/custom_components/localtuya/core/tuya_devices/sensors.py index b803b2aae..0acf3d84a 100644 --- a/custom_components/localtuya/core/tuya_devices/sensors.py +++ b/custom_components/localtuya/core/tuya_devices/sensors.py @@ -16,6 +16,7 @@ UnitOfPower, UnitOfTime, CONF_UNIT_OF_MEASUREMENT, + UnitOfTemperature, ) from .base import DPCode, LocalTuyaEntity, CONF_DEVICE_CLASS, EntityCategory @@ -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, ),