diff --git a/homeassistant/components/tuya/binary_sensor.py b/homeassistant/components/tuya/binary_sensor.py index b992c24d07d..2d6d9b478c8 100644 --- a/homeassistant/components/tuya/binary_sensor.py +++ b/homeassistant/components/tuya/binary_sensor.py @@ -190,6 +190,10 @@ BINARY_SENSORS: dict[str, tuple[TuyaBinarySensorEntityDescription, ...]] = { key=DPCode.DOORCONTACT_STATE, device_class=BinarySensorDeviceClass.DOOR, ), + TuyaBinarySensorEntityDescription( + key=DPCode.SWITCH, # Used by non-standard contact sensor implementations + device_class=BinarySensorDeviceClass.DOOR, + ), TAMPER_BINARY_SENSOR, ), # Access Control diff --git a/homeassistant/components/tuya/const.py b/homeassistant/components/tuya/const.py index a9c53d807bc..d731a93f858 100644 --- a/homeassistant/components/tuya/const.py +++ b/homeassistant/components/tuya/const.py @@ -113,6 +113,7 @@ class DPCode(StrEnum): BASIC_OSD = "basic_osd" BASIC_PRIVATE = "basic_private" BASIC_WDR = "basic_wdr" + BATTERY = "battery" # Used by non-standard contact sensor implementations BATTERY_PERCENTAGE = "battery_percentage" # Battery percentage BATTERY_STATE = "battery_state" # Battery state BATTERY_VALUE = "battery_value" # Battery value diff --git a/homeassistant/components/tuya/sensor.py b/homeassistant/components/tuya/sensor.py index 9382059471d..cd487a31d97 100644 --- a/homeassistant/components/tuya/sensor.py +++ b/homeassistant/components/tuya/sensor.py @@ -55,6 +55,14 @@ BATTERY_SENSORS: tuple[TuyaSensorEntityDescription, ...] = ( state_class=SensorStateClass.MEASUREMENT, entity_category=EntityCategory.DIAGNOSTIC, ), + TuyaSensorEntityDescription( + key=DPCode.BATTERY, # Used by non-standard contact sensor implementations + translation_key="battery", + native_unit_of_measurement=PERCENTAGE, + device_class=SensorDeviceClass.BATTERY, + state_class=SensorStateClass.MEASUREMENT, + entity_category=EntityCategory.DIAGNOSTIC, + ), TuyaSensorEntityDescription( key=DPCode.BATTERY_STATE, translation_key="battery_state",