local device = {} device.model = "BAB-1413_Pro" 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 = "numeric", name = "max_temperature_limit", property = "max_temperature_limit", access = 3, unit = "°C", min = 15, max = 45, value_step = 0.5, description = "Max temperature limit", }, { type = "numeric", name = "min_temperature_limit", property = "min_temperature_limit", access = 3, unit = "°C", min = 5, max = 15, value_step = 0.5, description = "Min temperature limit", }, { 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 = "numeric", name = "open_window_temperature", property = "open_window_temperature", access = 3, unit = "°C", min = 5, max = 30, value_step = 0.5, description = "Open window temperature", }, { type = "numeric", name = "comfort_temperature", property = "comfort_temperature", access = 3, unit = "°C", min = 5, max = 35, description = "Comfort temperature", }, { 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 = "holiday_temperature", property = "holiday_temperature", access = 3, unit = "°C", min = 5, max = 35, value_step = 0.5, description = "Holiday temperature", }, { type = "climate", features = { { type = "enum", name = "preset", property = "preset", access = 3, description = "Mode of this device (similar to system_mode)", values = { "auto", "manual", "holiday", "comfort" }, }, { 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 = "numeric", name = "local_temperature", property = "local_temperature", access = 1, unit = "°C", description = "Current temperature measured on the device", }, { 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 = "enum", name = "system_mode", property = "system_mode", access = 3, description = "Only for Homeassistant", values = { "off", "heat" }, }, { type = "enum", name = "running_state", property = "running_state", access = 3, description = "The current running state", values = { "idle", "heat" }, }, }, }, { type = "binary", name = "frost_protection", property = "frost_protection", access = 3, value_on = "ON", value_off = "OFF", description = "When Anti-Freezing function is activated, the temperature in the house is kept at 8 °C.When Anti-Freezing function is activated, the temperature in the house is kept at 8 °C, the device display \"AF\".press the pair button to cancel.", }, { type = "numeric", name = "boost_time", property = "boost_time", access = 3, unit = "min", min = 0, max = 1440, value_step = 15, description = "Boost running time. Minimum 0 - maximum 24 hours", category = "config", }, { type = "numeric", name = "boost_timeset_countdown", property = "boost_timeset_countdown", access = 1, unit = "min", description = "Boost time remaining", }, { type = "text", name = "schedule_monday", property = "schedule_monday", access = 3, description = "Schedule for monday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "text", name = "schedule_tuesday", property = "schedule_tuesday", access = 3, description = "Schedule for tuesday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "text", name = "schedule_wednesday", property = "schedule_wednesday", access = 3, description = "Schedule for wednesday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "text", name = "schedule_thursday", property = "schedule_thursday", access = 3, description = "Schedule for thursday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "text", name = "schedule_friday", property = "schedule_friday", access = 3, description = "Schedule for friday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "text", name = "schedule_saturday", property = "schedule_saturday", access = 3, description = "Schedule for saturday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "text", name = "schedule_sunday", property = "schedule_sunday", access = 3, description = "Schedule for sunday, example: \"06:00/21.5 17:20/26 20:00/21 24:00/18\"", category = "config", }, { type = "binary", name = "valve", property = "valve", access = 1, value_on = "CLOSED", value_off = "OPEN", }, { type = "binary", name = "factory_reset", property = "factory_reset", access = 3, value_on = "ON", value_off = "OFF", description = "Back to factory settings, USE WITH CAUTION", }, { type = "numeric", name = "error_status", property = "error_status", access = 1, description = "Error status", }, } device.fromZigbee = { "battery" } device.tuyaDatapoints = { { dp = 49, name = "running_state", converter = "lookup", lookup = { idle = 0, heat = 1 } }, { dp = 49, name = "system_mode", converter = "lookup", lookup = { off = 0, heat = 1 } }, { dp = 2, name = "preset", converter = "lookup", lookup = { auto = 0, holiday = 1, manual = 2, comfort = 3 } }, { 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_limit", converter = "divideBy10" }, { dp = 10, name = "min_temperature_limit", converter = "divideBy10" }, { dp = 14, name = "window_detection", converter = "onOff" }, { dp = 16, name = "open_window_temperature", converter = "divideBy10" }, { dp = 17, name = "open_window_time", converter = "raw" }, { dp = 19, name = "factory_reset", converter = "onOff" }, { dp = 21, name = "holiday_temperature", converter = "raw" }, { dp = 24, name = "comfort_temperature", converter = "divideBy10" }, { dp = 25, name = "eco_temperature", converter = "divideBy10" }, { dp = 36, name = "frost_protection", converter = "onOff" }, { dp = 49, name = "valve", converter = "trueFalseEnum0" }, } 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 = "_TZE204_g2ki0ejr", }, } return device