local device = {} device.model = "TS0049" device.vendor = "Tuya" device.description = "Water valve" device.zigbeeModel = { "TS0049" } device.exposes = { { type = "numeric", name = "error_status", property = "error_status", access = 1, description = "Error status", }, { 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 = "battery_state", property = "battery_state", access = 1, description = "State of the battery", values = { "low", "medium", "high" }, }, { type = "numeric", name = "countdown", property = "countdown", access = 3, unit = "minutes", min = 0, max = 255, value_step = 1, description = "Max on time in minutes", }, } device.tuyaDatapoints = { { dp = 26, name = "error_status", converter = "raw" }, { dp = 101, name = "state", converter = "onOff" }, { dp = 111, name = "countdown", converter = "raw" }, { dp = 115, name = "battery_state", converter = "batteryState" }, } return device