local device = {} device.model = "TS0601_soil" device.vendor = "Tuya" device.description = "Soil sensor" device.exposes = { { type = "numeric", name = "temperature", property = "temperature", access = 1, unit = "°C", description = "Measured temperature value", }, { type = "numeric", name = "soil_moisture", property = "soil_moisture", access = 1, unit = "%", description = "Measured soil moisture value", }, { type = "enum", name = "temperature_unit", property = "temperature_unit", access = 3, description = "Temperature unit", values = { "celsius", "fahrenheit" }, }, { 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 = "enum", name = "battery_state", property = "battery_state", access = 1, description = "State of the battery", values = { "low", "medium", "high" }, }, } device.fromZigbee = { "temperature", "battery" } device.tuyaDatapoints = { { dp = 3, name = "soil_moisture", converter = "raw" }, { dp = 5, name = "temperature", converter = "raw" }, { dp = 9, name = "temperature_unit", converter = "temperatureUnit" }, { dp = 14, name = "battery_state", converter = "batteryState" }, { dp = 15, name = "battery", 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_myd45weu", }, { model = "TS0601", manufacturer = "_TZE200_ga1maeof", }, { model = "TS0601", manufacturer = "_TZE200_2se8efxh", }, { model = "TS0601", manufacturer = "_TZE204_myd45weu", }, { model = "TS0601", manufacturer = "_TZE284_myd45weu", }, { model = "TS0601", manufacturer = "_TZE284_oitavov2", }, { model = "TS0601", manufacturer = "_TZE284_2se8efxh", }, { model = "TS0601", manufacturer = "_TZE200_9cqcpkgb", }, } return device