/**
* Candeo CSF1TZ Zigbee Smart Irrigation Timer
* Supports open / close (valve capability)
* Supports on / off (switch capability)
* Reports valve events
* Reports switch events
* Reports battery level percentage
* Reports events for custom attributes
* Has Command to set automatic close timer time
* Has Setting For Explicit State After Hub Startup
*/
metadata {
definition(name: 'Candeo CSF1TZ Zigbee Smart Irrigation Timer', namespace: 'Candeo', author: 'Candeo', importUrl: 'https://raw.githubusercontent.com/candeosmart/hubitat-zigbee/main/Candeo%20CSF1TZ%20Zigbee%20Smart%20Irrigation%20Timer.groovy', singleThreaded: true) {
capability 'Valve'
capability 'Switch'
capability 'Battery'
capability 'Actuator'
capability 'Sensor'
capability 'Initialize'
capability 'Configuration'
attribute 'timerState', 'enum', ['disabled', 'active', 'enabled']
attribute 'timerRemaining', 'number'
attribute 'automaticCloseTime', 'number'
attribute 'lastValveOpenDuration', 'number'
attribute 'weatherDelay', 'enum', ['disabled', '24h', '48h', '72h']
attribute 'waterConsumed', 'number'
command 'automaticCloseTimerTime', [[name:'Automatic Close Timer Time (s)*', type: 'NUMBER', description: 'Time (seconds) after which to automatically close the valve (minimum 30s, maximum 36000s).']]
fingerprint profileId: '0104', endpointId: '01', inClusters: '0000,0004,0005,EF00', outClusters: '0019,000A', manufacturer: '_TZE200_81isopgh', model: 'TS0601', deviceJoinName: 'Candeo CSF1TZ Zigbee Smart Irrigation Timer'
fingerprint profileId: '0104', endpointId: '01', inClusters: '0000,0004,0005,EF00', outClusters: '0019,000A', manufacturer: 'Candeo', model: 'CSF1TZ', deviceJoinName: 'Candeo CSF1TZ Zigbee Smart Irrigation Timer'
}
preferences {
input name: 'deviceDriverOptions', type: 'hidden', title: 'Device Driver Options', description: 'The following options change the behaviour of the device driver, they take effect after hitting "Save Preferences below."'
input name: 'hubStartupDefaultCommand', type: 'enum', title: 'Explicit Command After Hub Has Restarted', description: 'After the hub restarts, carry out this command on the device.
', options: PREFHUBRESTART, defaultValue: 'refresh'
input name: 'loggingOption', type: 'enum', title: 'Logging Option', description: 'Sets the logging level cumulatively, for example "Driver Trace Logging" will include all logging levels below it.
', options: PREFLOGGING, defaultValue: '5'
input name: 'platformOptions', type: 'hidden', title: 'Platform Options', description: 'The following options are relevant to the Hubitat platform and UI itself.'
}
}
import groovy.transform.Field
private @Field final String CANDEO = 'Candeo CSF1TZ Device Driver'
private @Field final Boolean DEBUG = false
private @Field final Integer LOGSOFF = 1800
private @Field final Integer MAXAUTOCLOSETIME = 36000
private @Field final Integer MINAUTOCLOSETIME = 30
private @Field final Integer DEFAULTAUTOCLOSETIME = 600
private @Field final String TUYACLUSTER = 'EF00'
private @Field final List