local device = {} device.model = "_TZE284_z5jz7wpo" device.vendor = "Tuya" device.description = "Ceiling fan control module" device.exposes = { { type = "fan", features = { { type = "binary", name = "state", property = "state", access = 7, value_on = "ON", value_off = "OFF", description = "On/off state of this fan", }, { type = "numeric", name = "speed", property = "speed", access = 7, min = 1, max = 254, description = "Speed of this fan", }, }, }, { 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", "restore" }, }, { type = "numeric", name = "countdown_hours", property = "countdown_hours", access = 3, unit = "h", min = 0.25, max = 12, value_step = 0.25, description = "Fan ON time in hours (15 min increments)", }, { type = "enum", name = "light_mode", property = "light_mode", access = 3, values = { "none", "relay", "pos" }, }, } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "onOff" }, { dp = 11, name = "power_on_behavior", converter = "lookup", lookup = { off = 0, on = 1, restore = 2 } }, { dp = 12, name = "light_mode", converter = "lookup", lookup = { none = 0, relay = 1, pos = 2 } }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE284_z5jz7wpo", }, } return device