mirror of
https://github.com/home-assistant/core.git
synced 2025-07-23 13:17:32 +00:00
Add support for Kogan smart blinds to Tuya (#60552)
This commit is contained in:
parent
ae9320b616
commit
56899d61fe
@ -10,6 +10,7 @@ from tuya_iot import TuyaDevice, TuyaDeviceManager
|
|||||||
from homeassistant.components.cover import (
|
from homeassistant.components.cover import (
|
||||||
ATTR_POSITION,
|
ATTR_POSITION,
|
||||||
ATTR_TILT_POSITION,
|
ATTR_TILT_POSITION,
|
||||||
|
DEVICE_CLASS_BLIND,
|
||||||
DEVICE_CLASS_CURTAIN,
|
DEVICE_CLASS_CURTAIN,
|
||||||
DEVICE_CLASS_GARAGE,
|
DEVICE_CLASS_GARAGE,
|
||||||
SUPPORT_CLOSE,
|
SUPPORT_CLOSE,
|
||||||
@ -68,6 +69,15 @@ COVERS: dict[str, tuple[TuyaCoverEntityDescription, ...]] = {
|
|||||||
set_position=DPCode.PERCENT_CONTROL_3,
|
set_position=DPCode.PERCENT_CONTROL_3,
|
||||||
device_class=DEVICE_CLASS_CURTAIN,
|
device_class=DEVICE_CLASS_CURTAIN,
|
||||||
),
|
),
|
||||||
|
# switch_1 is an undocumented code that behaves identically to control
|
||||||
|
# It is used by the Kogan Smart Blinds Driver
|
||||||
|
TuyaCoverEntityDescription(
|
||||||
|
key=DPCode.SWITCH_1,
|
||||||
|
name="Blind",
|
||||||
|
current_position=DPCode.PERCENT_CONTROL,
|
||||||
|
set_position=DPCode.PERCENT_CONTROL,
|
||||||
|
device_class=DEVICE_CLASS_BLIND,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
# Garage Door Opener
|
# Garage Door Opener
|
||||||
# https://developer.tuya.com/en/docs/iot/categoryckmkzq?id=Kaiuz0ipcboee
|
# https://developer.tuya.com/en/docs/iot/categoryckmkzq?id=Kaiuz0ipcboee
|
||||||
@ -183,9 +193,7 @@ class TuyaCoverEntity(TuyaEntity, CoverEntity):
|
|||||||
if device.function[description.key].type == "Boolean":
|
if device.function[description.key].type == "Boolean":
|
||||||
self._attr_supported_features |= SUPPORT_OPEN | SUPPORT_CLOSE
|
self._attr_supported_features |= SUPPORT_OPEN | SUPPORT_CLOSE
|
||||||
elif device.function[description.key].type == "Enum":
|
elif device.function[description.key].type == "Enum":
|
||||||
data_type = EnumTypeData.from_json(
|
data_type = EnumTypeData.from_json(device.function[description.key].values)
|
||||||
device.status_range[description.key].values
|
|
||||||
)
|
|
||||||
if "open" in data_type.range:
|
if "open" in data_type.range:
|
||||||
self._attr_supported_features |= SUPPORT_OPEN
|
self._attr_supported_features |= SUPPORT_OPEN
|
||||||
if "close" in data_type.range:
|
if "close" in data_type.range:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user