local device = {} device.model = "TS0601_smart_temperature_switch" device.vendor = "Tuya" device.description = "Smart temperature switch with manual and automatic modes: heating & cooling" device.exposes = { { type = "numeric", name = "temperature_c", property = "temperature_c", access = 1, unit = "℃", description = "Measured temperature in ℃. Device reports it only when it set ℃ unit.", category = "diagnostic", }, { type = "numeric", name = "temperature_f", property = "temperature_f", access = 1, unit = "℉", description = "Measured temperature in ℉", category = "diagnostic", }, { type = "switch", description = "Turn on/off device connected to output", features = { { type = "binary", name = "state", property = "state", access = 7, value_on = "ON", value_off = "OFF", description = "On/off state of the switch", }, }, }, { type = "binary", name = "autowork", property = "autowork", access = 7, value_on = "ON", value_off = "OFF", description = "Turn on automatic mode to control constant temperature", category = "config", }, { type = "enum", name = "work_mode", property = "work_mode", access = 7, description = "\n Heating: switch is turned ON until temperature will increase to setpoint (then will turn OFF). When temperature will go down below set temperature range, switch will turn ON again.\n Cooling: switch is turned ON until temperature will decrease to setpoint (then will turn OFF). When temperature will go up above set temperature range, switch will turn ON again.\n ", category = "config", values = { "heating", "cooling" }, }, { type = "enum", name = "temperature_unit", property = "temperature_unit", access = 7, description = "Temperature unit", category = "config", values = { "celsius", "fahrenheit" }, }, { type = "numeric", name = "temperature_c_setpoint", property = "temperature_c_setpoint", access = 7, unit = "℃", min = -20, max = 102, value_step = 0.5, description = "Temperature ℃ set point", category = "config", }, { type = "numeric", name = "temperature_f_setpoint", property = "temperature_f_setpoint", access = 7, unit = "℉", min = -4, max = 221, value_step = 0.5, description = "Temperature ℉ set point", category = "config", }, { type = "numeric", name = "temperature_range", property = "temperature_range", access = 7, min = 1, max = 9, value_step = 0.5, description = "The delta between temperature setpoint and measured temperature to trigger heating or cooling", category = "config", }, { type = "numeric", name = "temperature_calibration", property = "temperature_calibration", access = 3, unit = "℉", min = -9, max = 9, value_step = 1, description = "Temperature calibration always in ℉", category = "config", }, { type = "binary", name = "cooling_delay_switch", property = "cooling_delay_switch", access = 7, value_on = "ON", value_off = "OFF", description = "Turn on cooling mode delay", category = "config", }, { type = "numeric", name = "cooling_delay", property = "cooling_delay", access = 7, unit = "m", min = 0, max = 10, value_step = 1, description = "Delay to turn on - only for cooling mode", category = "config", }, { type = "numeric", name = "countdown", property = "countdown", access = 7, unit = "s", min = 0, max = 86400, value_step = 1, description = "Countdown to turn device on/off after a certain time", category = "config", }, { type = "list", name = "schedules", property = "schedules", access = 2, description = "Schedules for automatic mode work at certain week day and time", category = "config", }, } device.tuyaDatapoints = { { dp = 2, name = "state", converter = "onOffNotStrict" }, { dp = 4, name = "countdown", converter = "countdown" }, { dp = 7, name = "schedules", converter = "thermostatSchedule" }, { dp = 8, name = "work_mode", converter = "lookup", lookup = { heating = 0, cooling = 2 } }, { dp = 9, name = "autowork", converter = "onOffNotStrict" }, { dp = 20, name = "temperature_unit", converter = "temperatureUnitEnum" }, { dp = 21, name = "temperature_f_setpoint", converter = "divideBy10" }, { dp = 22, name = "temperature_c_setpoint", converter = "divideBy10" }, { dp = 27, name = "temperature_c", converter = "divideBy10" }, { dp = 28, name = "temperature_f", converter = "divideBy10" }, { dp = 29, name = "temperature_range", converter = "divideBy10" }, { dp = 30, name = "temperature_calibration", converter = "raw" }, { dp = 55, name = "cooling_delay", converter = "raw" }, { dp = 56, name = "cooling_delay_switch", converter = "onOffNotStrict" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE284_roujjevx", }, } return device