local device = {} device.model = "TS0601_fan_and_light_switch" device.vendor = "Tuya" device.description = "Fan & light switch" device.exposes = { { type = "binary", name = "status_indication", property = "status_indication", access = 3, value_on = "ON", value_off = "OFF", description = "Light switch", }, { type = "switch", features = { { type = "binary", name = "state", property = "state", access = 3, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", }, }, }, { type = "enum", name = "power_on_behavior", property = "power_on_behavior", access = 3, description = "Controls the behavior when the device is powered on after power loss", category = "config", values = { "OFF", "ON" }, }, { type = "enum", name = "fan_speed", property = "fan_speed", access = 3, description = "Speed of the fan", values = { "minimum", "medium", "maximum" }, }, } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "onOff" }, { dp = 101, name = "fan_speed", converter = "lookup", lookup = { minimum = 0, medium = 1, maximum = 2 } }, { dp = 11, name = "power_on_behavior", converter = "lookup", lookup = { OFF = 0, ON = 1 } }, { dp = 5, name = "status_indication", converter = "onOff" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE200_hmqzfqml", }, { model = "TS0601", manufacturer = "_TZE200_qanl25yu", }, } return device