local device = {} device.model = "TS0601_thermostat_4" device.vendor = "Tuya" device.description = "Thermostatic radiator valve" 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 = 45, 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 = { "schedule", "holiday", "manual", "comfort", "eco" }, }, { type = "enum", name = "system_mode", property = "system_mode", access = 1, description = "Mode of this device", values = { "off", "heat" }, }, { type = "numeric", name = "local_temperature_calibration", property = "local_temperature_calibration", access = 3, unit = "°C", min = -12, max = 12, value_step = 1, 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 = "holiday_temperature", property = "holiday_temperature", access = 3, unit = "°C", min = 5, max = 45, description = "Holiday temperature", }, { type = "numeric", name = "comfort_temperature", property = "comfort_temperature", access = 3, unit = "°C", min = 5, max = 45, description = "Comfort temperature", }, { type = "numeric", name = "eco_temperature", property = "eco_temperature", access = 3, unit = "°C", min = 5, max = 45, description = "Eco temperature", }, { 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 = "error", property = "error", access = 1, description = "If NTC is damaged, \"Er\" will be on the TRV display.", }, { type = "binary", name = "boost_heating", property = "boost_heating", access = 3, value_on = "ON", value_off = "OFF", description = "Boost Heating: the device will enter the boost heating mode.", }, { 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 = { schedule = 0, holiday = 1, manual = 2, comfort = 3, eco = 4 } }, { 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 = 21, name = "holiday_temperature", converter = "divideBy10" }, { dp = 24, name = "comfort_temperature", converter = "divideBy10" }, { dp = 25, name = "eco_temperature", converter = "divideBy10" }, { dp = 35, name = "fault_alarm", converter = "errorOrBatteryLow" }, { dp = 36, name = "frost_protection", converter = "onOff" }, { dp = 37, name = "boost_heating", converter = "onOff" }, { dp = 39, name = "scale_protection", converter = "onOff" }, { dp = 47, name = "local_temperature_calibration", converter = "localTempCalibration2" }, { dp = 49, name = "system_mode", converter = "lookup", lookup = { off = 0, heat = 1 } }, } 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_pcdmj88b", }, { model = "TS0601", manufacturer = "_TZE284_pcdmj88b", }, } return device