local device = {} device.model = "_TZE204_3regm3h6" device.vendor = "Tuya" device.description = "Smart thermostat for electric radiator with pilot wire" device.exposes = { { type = "binary", name = "state", property = "state", access = 3, value_on = "ON", value_off = "OFF", description = "Turn the heater on or off", category = "config", }, { 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 = "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 = -9, max = 9, value_step = 1, description = "Offset to add/subtract to the local temperature", }, { type = "enum", name = "system_mode", property = "system_mode", access = 1, description = "Mode of this device", values = { "off", "heat" }, }, { type = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "comfort", "eco", "antifrost", "off", "comfort_1", "comfort_2", "program", "manual", }, }, }, }, { type = "enum", name = "mode", property = "mode", access = 1, description = "Current running mode", category = "diagnostic", values = { "comfort", "eco", "antifrost", "off", "comfort_1", "comfort_2", "program", "manual", }, }, { type = "binary", name = "radiators_without_integrated_regulation", property = "radiators_without_integrated_regulation", access = 3, value_on = "ON", value_off = "OFF", description = "Enable this for radiator without integrated regulation. OFF if Comfort, Eco and Antifrost temperatures can be defined on the radiator. ON if the radiator has no integrated regulation (i.e define temperatures on the thermostat).", category = "config", }, { type = "numeric", name = "comfort_temperature", property = "comfort_temperature", access = 3, unit = " C", min = 5, max = 35, value_step = 0.5, description = "Set comfort temperature", category = "config", }, { type = "numeric", name = "eco_temperature", property = "eco_temperature", access = 3, unit = " C", min = 5, max = 30, value_step = 0.5, description = "Set ECO temperature", category = "config", }, { type = "numeric", name = "antifrost_temperature", property = "antifrost_temperature", access = 3, unit = " C", min = 5, max = 15, value_step = 0.5, description = "Set antifrost temperature", category = "config", }, { type = "numeric", name = "temperature_sensibility", property = "temperature_sensibility", access = 3, unit = " C", min = 0.5, max = 5, value_step = 0.5, description = "Set thermostat sensitivity", category = "config", }, { type = "binary", name = "antifrost", property = "antifrost", access = 3, value_on = "ON", value_off = "OFF", description = "Enable antifrost protection feature", category = "config", }, { type = "binary", name = "window_detection", property = "window_detection", access = 3, value_on = "ON", value_off = "OFF", description = "Enable / Disable open window detection feature", category = "config", }, { type = "enum", name = "window", property = "window", access = 1, description = "Indicates if window is open", category = "diagnostic", values = { "close", "open" }, }, { type = "numeric", name = "power", property = "power", access = 1, unit = "W", description = "Instantaneous measured power", }, { type = "numeric", name = "voltage", property = "voltage", access = 1, unit = "V", description = "Measured electrical potential value", }, { type = "numeric", name = "current", property = "current", access = 1, unit = "A", description = "Instantaneous measured electrical current", }, { type = "numeric", name = "energy", property = "energy", access = 1, unit = "kWh", description = "Sum of consumed energy", }, { type = "numeric", name = "energy_today", property = "energy_today", access = 1, unit = "kWh", description = "Energy consumed today", }, { type = "numeric", name = "energy_yesterday", property = "energy_yesterday", access = 1, unit = "kWh", description = "Energy consumed yesterday", }, { type = "enum", name = "device_mode_type", property = "device_mode_type", access = 1, description = "Indicates the actual pilot wire mode of the thermostat", category = "diagnostic", values = { "four", "six", "switch" }, }, } device.fromZigbee = { "electrical", "metering" } device.tuyaDatapoints = { { dp = 1, name = "state", converter = "onOff" }, { dp = 1, name = "system_mode", converter = "lookup" }, { dp = 2, name = "mode", converter = "lookup", lookup = { comfort = 0, eco = 1, antifrost = 2, off = 3, comfort_1 = 4, comfort_2 = 5, program = 6, manual = 7 } }, { dp = 2, name = "preset", converter = "lookup", lookup = { comfort = 0, eco = 1, antifrost = 2, off = 3, comfort_1 = 4, comfort_2 = 5, program = 6, manual = 7 } }, { dp = 11, name = "power", converter = "divideBy10" }, { dp = 16, name = "local_temperature", converter = "divideBy10" }, { dp = 17, name = "window", converter = "lookup", lookup = { close = 0, open = 1 } }, { dp = 19, name = "local_temperature_calibration", converter = "localTempCalibration2" }, { dp = 20, name = "fault", converter = "raw" }, { dp = 29, name = "window_detection", converter = "onOff" }, { dp = 39, name = "child_lock", converter = "lockUnlock" }, { dp = 50, name = "current_heating_setpoint", converter = "divideBy10" }, { dp = 101, name = "voltage", converter = "divideBy10" }, { dp = 102, name = "current", converter = "divideBy1000" }, { dp = 103, name = "temperature_sensibility", converter = "divideBy10" }, { dp = 104, name = "energy_today", converter = "divideBy10" }, { dp = 105, name = "energy_yesterday", converter = "divideBy10" }, { dp = 106, name = "device_mode_type", converter = "lookup", lookup = { four = 0, six = 1, switch = 2 } }, { dp = 107, name = "energy", converter = "divideBy10" }, { dp = 108, name = "week_program_1", converter = "raw" }, { dp = 109, name = "week_program_2", converter = "raw" }, { dp = 110, name = "week_program_3", converter = "raw" }, { dp = 111, name = "week_program_4", converter = "raw" }, { dp = 112, name = "week_program_5", converter = "raw" }, { dp = 113, name = "week_program_6", converter = "raw" }, { dp = 114, name = "week_program_7", converter = "raw" }, { dp = 115, name = "set_temp_switch", converter = "onOff" }, { dp = 115, name = "radiators_without_integrated_regulation", converter = "onOff" }, { dp = 116, name = "antifrost", converter = "onOff" }, { dp = 117, name = "eco_temperature", converter = "divideBy10" }, { dp = 118, name = "comfort_temperature", converter = "divideBy10" }, { dp = 119, name = "antifrost_temperature", converter = "divideBy10" }, { dp = 120, name = "light", converter = "raw" }, } device.configure = { bind = { "haElectricalMeasurement", "seMetering" }, reporting = { { cluster = "haElectricalMeasurement", attribute = "activePower", min = 5, max = 3600, change = 1, }, { cluster = "haElectricalMeasurement", attribute = "rmsVoltage", min = 5, max = 3600, change = 5, }, { cluster = "haElectricalMeasurement", attribute = "rmsCurrent", min = 5, max = 3600, change = 100, }, { cluster = "seMetering", attribute = "currentSummDelivered", min = 5, max = 3600, change = 1, }, }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE204_3regm3h6", }, { model = "TS0601", manufacturer = "_TZE204_0hcjew5p", }, { model = "TS0601", manufacturer = "_TZE204_6vwfjkcj", }, { model = "TS0601", manufacturer = "_TZE284_3regm3h6", }, { model = "TS0601", manufacturer = "_TZE204_ouy7vpm1", }, } return device