local device = {} device.model = "TR-M3Z" device.vendor = "Tuya" device.description = "Thermostatic radiator valve actuator" device.exposes = { { 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 = "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 = "battery_low", property = "battery_low", access = 1, value_on = true, value_off = false, description = "Indicates if the battery of this device is almost empty", 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 = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "manual", "schedule", "eco", "comfort", "frost_protection", "holiday", "off", }, }, { type = "enum", name = "system_mode", property = "system_mode", access = 1, description = "Mode of this device", values = { "off", "heat" }, }, { type = "enum", name = "running_state", property = "running_state", access = 1, description = "The current running state", values = { "idle", "heat" }, }, { type = "numeric", name = "local_temperature_calibration", property = "local_temperature_calibration", access = 3, unit = "°C", min = -9.5, max = 9.5, value_step = 0.5, description = "Offset to add/subtract to the local temperature", }, }, }, { 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 = "eco_temperature", property = "eco_temperature", access = 3, unit = "°C", min = 5, max = 35, value_step = 0.5, description = "Eco temperature", }, { type = "numeric", name = "comfort_temperature", property = "comfort_temperature", access = 3, unit = "°C", min = 5, max = 35, value_step = 0.5, description = "Comfort temperature", }, { type = "numeric", name = "holiday_temperature", property = "holiday_temperature", access = 3, unit = "°C", min = 5, max = 35, value_step = 0.5, description = "Holiday temperature", }, { type = "binary", name = "window_detection", property = "window_detection", access = 3, value_on = "ON", value_off = "OFF", description = "Startup: when room temperature decreases by 3°C within 5 minutes, stop heating. Close: when room temperature rises by 3 degrees / 48 minutes later / manual (three ways). After the window opening mode is turned on, one of these three conditions can trigger to exit the window opening mode.", }, { type = "binary", name = "window_open", property = "window_open", access = 1, value_on = "OPEN", value_off = "CLOSE", description = "Window status CLOSE or OPEN ", }, { type = "binary", name = "scale_protection", property = "scale_protection", access = 3, value_on = "ON", value_off = "OFF", description = "If the heat sink is not fully opened within two weeks or is not used for a long time, the valve will be blocked due to silting up and the heat sink will not be able to be used. To ensure normal use of the heat sink, the controller will automatically open the valve fully every two weeks. It will run for 30 seconds per time with the screen displaying \"Ad\", then return to its normal working state again.", }, { 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 = "numeric", name = "frost_protection_temperature", property = "frost_protection_temperature", access = 3, unit = "°C", min = 5, max = 35, value_step = 0.5, description = "", }, { type = "numeric", name = "temperature_accuracy", property = "temperature_accuracy", access = 3, unit = "°C", min = 0.5, max = 5, value_step = 0.5, description = "The difference required between local temperature and set point to trigger the valve.", }, { type = "numeric", name = "error", property = "error", access = 1, description = "If NTC is damaged, \"Er\" will be on the TRV display.", }, { type = "binary", name = "occupancy", property = "occupancy", access = 1, value_on = true, value_off = false, description = "Indicates whether the device detected occupancy", }, { type = "binary", name = "contact", property = "contact", access = 1, value_on = false, value_off = true, description = "Indicates if the contact is closed or open", }, { type = "binary", name = "tamper", property = "tamper", access = 1, value_on = true, value_off = false, description = "Indicates whether the device is tampered", }, } device.fromZigbee = { "battery", "ias_zone" } device.tuyaDatapoints = { { dp = 2, name = "preset", converter = "lookup", lookup = { manual = 0, schedule = 1, eco = 2, comfort = 3, frost_protection = 4, holiday = 5, off = 6 } }, { 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 = "lockUnlock" }, { dp = 14, name = "window_detection", converter = "onOff" }, { dp = 15, name = "window_open", converter = "lookup", lookup = { CLOSE = 0, OPEN = 1 } }, { dp = 21, name = "holiday_temperature", converter = "divideBy10" }, { dp = 35, name = "fault_alarm", converter = "errorOrBatteryLow" }, { dp = 36, name = "frost_protection", converter = "onOff" }, { dp = 39, name = "scale_protection", converter = "onOff" }, { dp = 47, name = "local_temperature_calibration", converter = "localTempCalibration3" }, { dp = 101, name = "system_mode", converter = "lookup" }, { dp = 102, name = "temperature_accuracy", converter = "divideBy10" }, { dp = 103, name = "eco_temperature", converter = "divideBy10" }, { dp = 104, name = "comfort_temperature", converter = "divideBy10" }, { dp = 105, name = "frost_protection_temperature", converter = "divideBy10" }, } device.configure = { bind = { "genPowerCfg", "ssIasZone" }, 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_eekpf0ft", }, { model = "TS0601", manufacturer = "_TZE284_eekpf0ft", }, } return device