local device = {} device.model = "TRV601" 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 = "numeric", name = "max_temperature", property = "max_temperature", access = 3, unit = "°C", min = 15, max = 35, description = "Maximum temperature", }, { type = "numeric", name = "min_temperature", property = "min_temperature", access = 3, unit = "°C", min = 1, max = 15, description = "Minimum temperature", }, { type = "numeric", name = "position", property = "position", access = 1, unit = "%", description = "Position", }, { type = "switch", features = { { type = "binary", name = "state", property = "window_detection", access = 3, value_on = "ON", value_off = "OFF", description = "Enables/disables window detection on the device", }, }, }, { type = "binary", name = "window", property = "window", access = 1, value_on = "OPEN", value_off = "CLOSE", description = "Window status closed or open ", }, { type = "binary", name = "alarm_switch", property = "alarm_switch", access = 1, value_on = "ON", value_off = "OFF", description = "Thermostat in error state", }, { type = "climate", features = { { type = "numeric", name = "local_temperature", property = "local_temperature", access = 1, unit = "°C", description = "Current temperature measured on the device", }, { type = "numeric", name = "current_heating_setpoint", property = "current_heating_setpoint", access = 3, unit = "°C", min = 5, max = 35, value_step = 0.5, description = "Temperature setpoint", }, { type = "numeric", name = "local_temperature_calibration", property = "local_temperature_calibration", access = 3, unit = "°C", min = -30, max = 30, value_step = 0.1, description = "Offset to add/subtract to the local temperature", }, { type = "enum", name = "preset", property = "preset", access = 3, description = "MANUAL MODE ☝ - In this mode, the device executes manual temperature setting. When the set temperature is lower than the \"minimum temperature\", the valve is closed (forced closed). AUTO MODE ⏱ - In this mode, the device executes a preset week programming temperature time and temperature. ON - In this mode, the thermostat stays open OFF - In this mode, the thermostat stays closed", values = { "auto", "manual", "off", "on" }, }, { type = "enum", name = "system_mode", property = "system_mode", access = 1, description = "Mode of this device", values = { "auto", "heat", "off" }, }, { 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\"", }, { type = "enum", name = "screen_orientation", property = "screen_orientation", access = 3, description = "How do you look at the display (up and down supported only)", values = { "up", "down" }, }, { type = "enum", name = "display_brightness", property = "display_brightness", access = 3, description = "How strong the LED diplay is light up (high is default)", values = { "high", "middle", "low" }, }, { type = "enum", name = "mode", property = "mode", access = 3, description = "Hysteresis - comfort > switches off/on exactly at reached temperature with valve smooth from 0 to 100%, eco > 0.5 degrees above or below, valve either 0 or 100%", values = { "comfort", "eco" }, }, { type = "numeric", name = "switch_deviation_eco", property = "switch_deviation_eco", access = 3, unit = "°C", min = 0.5, max = 5, value_step = 0.1, description = "Switch deviation (energy-saving mode only)", }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 2, name = "current_heating_setpoint", converter = "divideBy10" }, { dp = 3, name = "local_temperature", converter = "divideBy10" }, { dp = 6, name = "running_state", converter = "lookup", lookup = { idle = 0, heat = 1 } }, { dp = 7, name = "window", converter = "lookup", lookup = { CLOSE = 0, OPEN = 1 } }, { dp = 8, name = "window_detection", converter = "onOff" }, { dp = 12, name = "child_lock", converter = "lockUnlock" }, { dp = 13, name = "battery", converter = "raw" }, { dp = 14, name = "alarm_switch", converter = "onOff" }, { dp = 15, name = "min_temperature", converter = "divideBy10" }, { dp = 16, name = "max_temperature", converter = "divideBy10" }, { dp = 101, name = "local_temperature_calibration", converter = "localTempCalibration1" }, { dp = 108, name = "position", converter = "divideBy10" }, { dp = 111, name = "display_brightness", converter = "lookup", lookup = { high = 0, middle = 1, low = 2 } }, { dp = 113, name = "screen_orientation", converter = "lookup", lookup = { up = 0, down = 2 } }, { dp = 114, name = "mode", converter = "lookup", lookup = { comfort = 0, eco = 1 } }, { dp = 115, name = "switch_deviation_eco", converter = "divideBy10" }, } 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 = "_TZE204_rtrmfadk", }, { model = "TS0601", manufacturer = "_TZE204_cvcu2p6e", }, } return device