local device = {} device.model = "TRV602Z" 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 = "numeric", name = "boost_timeset_countdown", property = "boost_timeset_countdown", access = 3, unit = "m", min = 0, max = 120, description = "Setting minimum 0 - maximum 120 minutes boost time. The boost function is activated. The remaining time for the function will be counted down in minutes ( 120 to 0 ).", }, { type = "binary", name = "frost_protection", property = "frost_protection", access = 3, value_on = "ON", value_off = "OFF", description = "Antifreeze function", }, { type = "binary", name = "window", property = "window", access = 1, value_on = "OPEN", value_off = "CLOSE", description = "Window status closed or open ", }, { 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 = -10, max = 10, value_step = 0.1, description = "Offset to add/subtract to the local temperature", }, { type = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "off", "antifrost", "eco", "comfort", "auto", "on" }, }, { type = "enum", name = "running_state", property = "running_state", access = 1, description = "The current running state", values = { "idle", "heat" }, }, { type = "enum", name = "system_mode", property = "system_mode", access = 1, description = "Mode of this device", values = { "auto", "heat", "off" }, }, }, }, { 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 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 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 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 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 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 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 HH:MM/C HH:MM/C\"", }, { type = "numeric", name = "comfort_temperature", property = "comfort_temperature", access = 3, unit = "°C", min = 5, max = 30, description = "Comfort mode temperature", }, { type = "numeric", name = "eco_temperature", property = "eco_temperature", access = 3, unit = "°C", min = 5, max = 30, description = "Eco mode temperature", }, { type = "numeric", name = "holiday_temperature", property = "holiday_temperature", access = 3, unit = "°C", min = 5, max = 30, description = "Antifreeze mode temperature", }, { type = "enum", name = "display_brightness", property = "display_brightness", access = 3, description = "Display brightness", values = { "high", "medium", "low" }, }, { type = "enum", name = "screen_orientation", property = "screen_orientation", access = 3, description = "Screen orientation", values = { "up", "down" }, }, { type = "enum", name = "hysteresis", property = "hysteresis", 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 = "enum", name = "motor_thrust", property = "motor_thrust", access = 3, values = { "strong", "middle", "weak" }, }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 3, name = "running_state", converter = "lookup", lookup = { idle = 0, heat = 1 } }, { dp = 4, name = "current_heating_setpoint", converter = "divideBy10" }, { dp = 5, name = "local_temperature", converter = "divideBy10" }, { dp = 6, name = "battery", converter = "raw" }, { dp = 7, name = "child_lock", converter = "lookup" }, { dp = 9, name = "max_temperature", converter = "divideBy10" }, { dp = 10, name = "min_temperature", converter = "divideBy10" }, { dp = 14, name = "window_detection", converter = "lookup" }, { dp = 15, name = "window", converter = "lookup", lookup = { CLOSE = 0, OPEN = 1 } }, { dp = 47, name = "local_temperature_calibration", converter = "localTempCalibration1" }, { dp = 110, name = "motor_thrust", converter = "lookup", lookup = { strong = 0, middle = 1, weak = 2 } }, { dp = 111, name = "display_brightness", converter = "lookup", lookup = { high = 0, medium = 1, low = 2 } }, { dp = 113, name = "screen_orientation", converter = "lookup", lookup = { up = 0, down = 1 } }, { dp = 114, name = "position", converter = "divideBy10" }, { dp = 118, name = "boost_timeset_countdown", converter = "raw" }, { dp = 119, name = "comfort_temperature", converter = "divideBy10" }, { dp = 120, name = "eco_temperature", converter = "divideBy10" }, { dp = 121, name = "holiday_temperature", converter = "divideBy10" }, { dp = 122, name = "frost_protection", converter = "onOff" }, { dp = 127, name = "hysteresis", converter = "lookup", lookup = { comfort = 0, eco = 1 } }, } 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_qyr2m29i", }, { model = "TS0601", manufacturer = "_TZE204_ltwbm23f", }, { model = "TS0601", manufacturer = "_TZE284_ltwbm23f", }, } return device