local device = {} device.model = "ME201WZ" device.vendor = "Tuya" device.description = "Water level sensor" device.exposes = { { type = "numeric", name = "liquid_level_percent", property = "liquid_level_percent", access = 1, unit = "%", description = "Liquid level ratio", }, { type = "numeric", name = "liquid_depth", property = "liquid_depth", access = 1, unit = "m", description = "Liquid Depth", }, { type = "enum", name = "liquid_state", property = "liquid_state", access = 1, description = "Liquid level status", values = { "low", "normal", "high" }, }, { type = "numeric", name = "max_set", property = "max_set", access = 3, unit = "%", min = 0, max = 100, value_step = 1, description = "Liquid max percentage", }, { type = "numeric", name = "mini_set", property = "mini_set", access = 3, unit = "%", min = 0, max = 100, value_step = 1, description = "Liquid minimal percentage", }, { type = "numeric", name = "installation_height", property = "installation_height", access = 3, unit = "m", min = 0.1, max = 4, value_step = 0.01, description = "Height from sensor to tank bottom", }, { type = "numeric", name = "liquid_depth_max", property = "liquid_depth_max", access = 3, unit = "m", min = 0.1, max = 4, value_step = 0.01, description = "Height from sensor to liquid level", }, } device.tuyaDatapoints = { { dp = 1, name = "liquid_state", converter = "lookup", lookup = { normal = 0, low = 1, high = 2 } }, { dp = 2, name = "liquid_depth", converter = "divideBy100" }, { dp = 22, name = "liquid_level_percent", converter = "raw" }, { dp = 7, name = "max_set", converter = "raw" }, { dp = 8, name = "mini_set", converter = "raw" }, { dp = 19, name = "installation_height", converter = "divideBy100" }, { dp = 21, name = "liquid_depth_max", converter = "divideBy100" }, } device.fingerprint = { { model = "TS0601", manufacturer = "_TZE284_kyyu8rbj", }, { model = "TS0601", manufacturer = "_TZE204_7yyuo8sr", }, } return device