local device = {} device.model = "TS0601_GTZ10" device.vendor = "Tuya" device.description = "Thermostat 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 = "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_open", property = "window_open", access = 1, value_on = true, value_off = false, description = "Indicates if window is open", category = "diagnostic", }, { type = "numeric", name = "open_window_temperature", property = "open_window_temperature", access = 3, unit = "°C", min = 5, max = 30, description = "Open window temperature", }, { type = "numeric", name = "max_temperature", property = "max_temperature", access = 3, unit = "°C", min = 15, max = 45, description = "Maximum temperature", }, { type = "numeric", name = "min_temperature", property = "min_temperature", access = 3, unit = "°C", min = 5, max = 15, description = "Minimum temperature", }, { type = "climate", features = { { type = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "manual", "auto", "holiday", "comfort", "eco", "off" }, }, { type = "numeric", name = "current_heating_setpoint", property = "current_heating_setpoint", access = 3, unit = "°C", min = 5, max = 40, 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 = -9, max = 9, value_step = 0.5, description = "Offset to add/subtract to the local temperature", }, { type = "enum", name = "system_mode", property = "system_mode", access = 3, description = "Only for Homeassistant", values = { "off", "heat", "auto" }, }, { 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 = "numeric", name = "error_status", property = "error_status", access = 1, description = "Error status. Possible codes: E1 - builtin sensor error, E2 - external sensor error, E3 - valve not installed, E4 - motor error.", }, { 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 = "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 = "numeric", name = "boost_timeset_countdown", property = "boost_timeset_countdown", access = 3, unit = "m", min = 0, max = 90, description = "Setting minimum 0 - maximum 90 minutes boost time. The boost function is activated. The remaining time for the function will be counted down in minutes ( 90 to 0 ).", }, { type = "binary", name = "switch_type", property = "switch_type", access = 3, value_on = "ON", value_off = "OFF", description = "Enables/disables valve switch", }, { type = "numeric", name = "position", property = "position", access = 3, unit = "%", min = 0, max = 100, description = "Position. To set the value you need to turn on valve switch", }, { type = "enum", name = "screen_orientation", property = "screen_orientation", access = 3, description = "Screen orientation", values = { "up", "right", "down", "left" }, }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { 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 = 9, name = "max_temperature", converter = "divideBy10" }, { dp = 10, name = "min_temperature", converter = "divideBy10" }, { dp = 14, name = "window_detection", converter = "onOff" }, { dp = 15, name = "window_open", converter = "onOff" }, { dp = 16, name = "open_window_temperature", converter = "divideBy10" }, { dp = 35, name = "error_status", converter = "raw" }, { dp = 36, name = "frost_protection", converter = "onOff" }, { dp = 37, name = "boost_heating", converter = "onOff" }, { dp = 38, name = "boost_timeset_countdown", converter = "raw" }, { dp = 47, name = "local_temperature_calibration", converter = "localTempCalibration1" }, { dp = 49, name = "running_state", converter = "lookup", lookup = { idle = 0, heat = 1, closing = 2, opening = 3 } }, { dp = 113, name = "switch_type", converter = "onOff" }, { dp = 115, name = "position", converter = "raw" }, { dp = 119, name = "screen_orientation", converter = "lookup", lookup = { up = 0, down = 1, left = 2, right = 3 } }, { dp = 1, name = "preheat", converter = "raw" }, { dp = 3, name = "working_status", converter = "raw" }, { dp = 8, name = "temperature_scale", converter = "raw" }, { dp = 11, name = "max_temperature_f", converter = "divideBy10" }, { dp = 12, name = "min_temperature_f", converter = "divideBy10" }, { dp = 17, name = "open_window_time", converter = "raw" }, { dp = 18, name = "backlight", converter = "raw" }, { dp = 39, name = "switch_scale", converter = "raw" }, { dp = 40, name = "local_temperature_f", converter = "divideBy10" }, { dp = 41, name = "current_heating_setpoint_f", converter = "divideBy10" }, { dp = 46, name = "open_window_temperature_f", converter = "divideBy10" }, { dp = 48, name = "valve_testing", converter = "raw" }, { dp = 112, name = "local_temperature_calibration_f", converter = "localTempCalibration1" }, { dp = 114, name = "valve_control_type", converter = "lookup", lookup = { PID = 0, ONOFF = 1 } }, { dp = 116, name = "frost_temperature", converter = "raw" }, { dp = 117, name = "frost_temperature_f", converter = "raw" }, { dp = 118, name = "auto_time", converter = "raw" }, { dp = 120, name = "multi_control_link", converter = "raw" }, { dp = 121, name = "holiday_time", 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 = "_TZE200_pbo8cj0z", }, { model = "TS0601", manufacturer = "_TZE200_eo6xhfbo", }, } return device