local device = {} device.model = "BLE-YL01" device.vendor = "Tuya" device.description = "Smart WiFi Zigbee chlorine meter" device.exposes = { { type = "numeric", name = "tds", property = "tds", access = 1, unit = "ppm", description = "Total Dissolved Solids", }, { type = "numeric", name = "temperature", property = "temperature", access = 1, unit = "°C", description = "Measured temperature value", }, { 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 = "numeric", name = "ph", property = "ph", access = 1, unit = "pH", description = "pH value, if the pH value is lower than 6.5, it means that the water quality is too acidic and has impurities, and it is necessary to add disinfectant water for disinfection", }, { type = "numeric", name = "ec", property = "ec", access = 1, unit = "µS/cm", description = "Electrical conductivity", }, { type = "numeric", name = "orp", property = "orp", access = 1, unit = "mV", description = "Oxidation Reduction Potential value. If the ORP value is above 850mv, it means that the disinfectant has been added too much, and it is necessary to add water or change the water for neutralization. If the ORP value is below 487mv, it means that too little disinfectant has been added and the pool needs to be disinfected again", }, { type = "numeric", name = "free_chlorine", property = "free_chlorine", access = 1, unit = "mg/L", description = "Free chlorine value. The water in the swimming pool should be between 6.5-8ph and ORP should be between 487-840mv, and the chlorine value will be displayed normally. Chlorine will not be displayed if either value is out of range", }, { type = "numeric", name = "ph_max", property = "ph_max", access = 3, unit = "pH", min = 0, max = 140, description = "pH maximal value", }, { type = "numeric", name = "ph_min", property = "ph_min", access = 3, unit = "pH", min = 0, max = 140, description = "pH minimal value", }, { type = "numeric", name = "ec_max", property = "ec_max", access = 3, unit = "µS/cm", min = 0, max = 20000, description = "Electrical Conductivity maximal value", }, { type = "numeric", name = "ec_min", property = "ec_min", access = 3, unit = "µS/cm", min = 0, max = 20000, description = "Electrical Conductivity minimal value", }, { type = "numeric", name = "orp_max", property = "orp_max", access = 3, unit = "mV", min = 0, max = 1200, description = "Oxidation Reduction Potential maximal value", }, { type = "numeric", name = "orp_min", property = "orp_min", access = 3, unit = "mV", min = 0, max = 1200, description = "Oxidation Reduction Potential minimal value", }, { type = "numeric", name = "free_chlorine_max", property = "free_chlorine_max", access = 3, unit = "mg/L", min = 0, max = 40, description = "Free Chlorine maximal value", }, { type = "numeric", name = "free_chlorine_min", property = "free_chlorine_min", access = 3, unit = "mg/L", min = 0, max = 40, description = "Free Chlorine minimal value", }, { type = "numeric", name = "salinity", property = "salinity", access = 1, unit = "ppm", description = "Salt value", }, { type = "numeric", name = "backlightvalue", property = "backlightvalue", access = 3, unit = "gg", min = 0, max = 1, description = "Backlight Value", }, } device.fromZigbee = { "temperature", "battery" } device.tuyaDatapoints = { { dp = 1, name = "tds", converter = "raw" }, { dp = 2, name = "temperature", converter = "divideBy10" }, { dp = 7, name = "battery", converter = "raw" }, { dp = 11, name = "ec", converter = "raw" }, { dp = 101, name = "orp", converter = "raw" }, { dp = 102, name = "free_chlorine", converter = "divideBy10" }, { dp = 105, name = "backlightvalue", converter = "raw" }, { dp = 106, name = "ph_max", converter = "raw" }, { dp = 107, name = "ph_min", converter = "raw" }, { dp = 108, name = "ec_max", converter = "raw" }, { dp = 109, name = "ec_min", converter = "raw" }, { dp = 110, name = "orp_max", converter = "raw" }, { dp = 111, name = "orp_min", converter = "raw" }, { dp = 112, name = "free_chlorine_max", converter = "raw" }, { dp = 113, name = "free_chlorine_min", converter = "raw" }, { dp = 117, name = "salinity", converter = "raw" }, } device.configure = { bind = { "msTemperatureMeasurement", "genPowerCfg" }, reporting = { { cluster = "msTemperatureMeasurement", attribute = "measuredValue", min = 10, max = 3600, change = 100, }, { 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_v1jqz5cy", }, { model = "TS0601", manufacturer = "_TZE200_d9mzkhoq", }, } return device