local device = {} device.model = "AR331" device.vendor = "Tuya" device.description = "Thermostatic radiator valve" device.exposes = { { type = "numeric", name = "battery", property = "battery", access = 1, unit = "%", min = 0, max = 100, description = "Remaining battery in %, can take up to 24 hours before reported", category = "diagnostic", }, { type = "binary", name = "child_lock", property = "child_lock", access = 3, value_on = "LOCK", value_off = "UNLOCK", description = "Enables/disables physical input on the device", }, { type = "climate", features = { { type = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "auto", "manual", "leave" }, }, { type = "numeric", name = "current_heating_setpoint", property = "current_heating_setpoint", access = 3, unit = "°C", min = 5, max = 40, value_step = 0.5, description = "Temperature setpoint", }, { type = "numeric", name = "local_temperature", property = "local_temperature", access = 1, unit = "°C", description = "Current temperature measured on the device", }, { type = "enum", name = "system_mode", property = "system_mode", access = 1, description = "Mode of this device", values = { "heat" }, }, { type = "enum", name = "running_state", property = "running_state", access = 1, description = "The current running state", values = { "idle", "heat" }, }, }, }, { type = "text", name = "schedule_monday", property = "schedule_monday", access = 3, description = "Schedule for monday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, { type = "text", name = "schedule_tuesday", property = "schedule_tuesday", access = 3, description = "Schedule for tuesday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, { type = "text", name = "schedule_wednesday", property = "schedule_wednesday", access = 3, description = "Schedule for wednesday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, { type = "text", name = "schedule_thursday", property = "schedule_thursday", access = 3, description = "Schedule for thursday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, { type = "text", name = "schedule_friday", property = "schedule_friday", access = 3, description = "Schedule for friday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, { type = "text", name = "schedule_saturday", property = "schedule_saturday", access = 3, description = "Schedule for saturday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, { type = "text", name = "schedule_sunday", property = "schedule_sunday", access = 3, description = "Schedule for sunday, example: \"HH:MM/C HH:MM/C HH:MM/C HH:MM/C\"", }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 2, name = "preset", converter = "lookup", lookup = { auto = 0, manual = 1, leave = 2 } }, { dp = 3, name = "running_state", converter = "lookup", lookup = { idle = 0, heat = 1 } }, { dp = 6, name = "battery", converter = "raw" }, { dp = 7, name = "child_lock", converter = "lookup" }, } device.configure = { bind = { "genPowerCfg" }, reporting = { { cluster = "genPowerCfg", attribute = "batteryPercentageRemaining", min = 3600, max = 65000, change = 0, }, { cluster = "genPowerCfg", attribute = "batteryVoltage", min = 3600, max = 65000, change = 0, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE284_noixx2uz", }, } return device