local device = {} device.model = "TRV603-WZ" 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 = "binary", name = "window_detection", property = "window_detection", access = 7, value_on = true, value_off = false, description = "Enables/disables window detection on the device", category = "config", }, { type = "binary", name = "window_open", property = "window_open", access = 1, value_on = true, value_off = false, description = "Indicates if window is open", category = "diagnostic", }, { type = "climate", features = { { 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", property = "local_temperature", access = 1, unit = "°C", description = "Current temperature measured on the device", }, { type = "numeric", name = "local_temperature_calibration", property = "local_temperature_calibration", access = 3, unit = "°C", min = -7, max = 7, value_step = 0.5, description = "Offset to add/subtract to the local temperature", }, { type = "enum", name = "system_mode", property = "system_mode", access = 3, description = "Mode of this device", values = { "auto", "off" }, }, { type = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "schedule", "manual", "holiday" }, }, }, }, { type = "numeric", name = "comfort_temperature", property = "comfort_temperature", access = 3, unit = "°C", min = 15, max = 35, description = "Comfort temperature", }, { type = "numeric", name = "eco_temperature", property = "eco_temperature", access = 3, unit = "°C", min = 5, max = 22, description = "Eco temperature", }, { type = "numeric", name = "holiday_temperature", property = "holiday_temperature", access = 3, unit = "°C", min = 5, max = 35, description = "Holiday temperature", }, { type = "text", name = "holiday_time", property = "holiday_time", access = 3, description = "Holiday start and end time in format YYYY/MM/DD HH:MM | YYYY/MM/DD HH:MM", }, { type = "binary", name = "boost_heating", property = "boost_heating", access = 3, value_on = "ON", value_off = "OFF", }, { type = "numeric", name = "boost_time", property = "boost_time", access = 3, unit = "min", min = 0, max = 30, description = "Countdown in minutes", }, { type = "binary", name = "frost_protection", property = "frost_protection", access = 3, value_on = "ON", value_off = "OFF", description = "When the room temperature is lower than 5 °C, the valve opens; when the temperature rises to 8 °C, the valve closes.", }, { type = "text", name = "schedule_monday", property = "schedule_monday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "text", name = "schedule_tuesday", property = "schedule_tuesday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "text", name = "schedule_wednesday", property = "schedule_wednesday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "text", name = "schedule_thursday", property = "schedule_thursday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "text", name = "schedule_friday", property = "schedule_friday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "text", name = "schedule_saturday", property = "schedule_saturday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "text", name = "schedule_sunday", property = "schedule_sunday", access = 3, description = "Schedule in 8 segments format: HH:MM/TT.T HH:MM/TT.T ...", }, { type = "enum", name = "screen_orientation", property = "screen_orientation", access = 3, description = "Screen orientation", values = { "up", "right", "down", "left" }, }, { type = "numeric", name = "fault_code", property = "fault_code", access = 1, description = "Raw fault code", }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 2, name = "preset", converter = "lookup", lookup = { schedule = 0, holiday = 1, manual = 2 } }, { dp = 5, name = "local_temperature", converter = "divideBy10" }, { dp = 6, name = "battery", converter = "raw" }, { dp = 7, name = "child_lock", converter = "lookup" }, { dp = 14, name = "window_detection", converter = "raw" }, { dp = 15, name = "window_open", converter = "trueFalseEnum1" }, { dp = 21, name = "holiday_temperature", converter = "divideBy10" }, { dp = 36, name = "frost_protection", converter = "onOff" }, { dp = 39, name = "anti_scale", converter = "raw" }, { dp = 47, name = "local_temperature_calibration", converter = "localTempCalibration1" }, { dp = 49, name = "valve_status", converter = "raw" }, { dp = 101, name = "boost_heating", converter = "onOff" }, { dp = 102, name = "boost_time", converter = "countdown" }, { dp = 103, name = "schedule_monday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 104, name = "schedule_tuesday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 105, name = "schedule_wednesday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 106, name = "schedule_thursday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 107, name = "schedule_friday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 108, name = "schedule_saturday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 109, name = "schedule_sunday", converter = "thermostatScheduleDayMultiDP_TRV603WZ" }, { dp = 110, name = "holiday_time", converter = "thermostatHolidayStartStopUnixTS" }, { dp = 111, name = "screen_orientation", converter = "lookup", lookup = { up = 0, right = 1, down = 2, left = 3 } }, { dp = 112, name = "antifrost_temperature", converter = "divideBy10" }, { dp = 113, name = "system_mode", converter = "lookup" }, { dp = 114, name = "local_temperature_calibration", converter = "localTempCalibration1" }, { dp = 115, name = "programming_mode", converter = "raw" }, { dp = 116, name = "eco_temperature", converter = "divideBy10" }, { dp = 117, name = "comfort_temperature", converter = "divideBy10" }, { dp = 118, name = "fault_code", converter = "raw" }, } 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_ymldrmzx", }, } return device