[DEPRECATED Thread: visit community.webcore.co for assistance] webCoRE - Piston Design Help (ask your fellow members for assistance)

I use this DTH to set the time the piston has to run:

/**
 *  On/Off Alarm Tile
 */
metadata {
	definition (name: "On/Off Button Tile", namespace: "Test", author: "Test") {
		capability "Actuator"
		capability "Switch"
		capability "Sensor"
        capability "Image Capture"
        attribute "alarm", "string"
	}

    preferences {
    input name: "timer", type: "time", title: "Alarm Time:", description: "Enter time", required: false
	}
	// simulator metadata
	simulator {
	}

	// UI tile definitions
	tiles {
		standardTile("button", "device.switch", width: 2, height: 2, canChangeIcon: true) {
			state "off", label: 'Off', action: "switch.on", icon: "st.Health & Wellness.health7", backgroundColor: "#ffffff", nextState: "on"
			state "on", label: 'On', action: "switch.off", icon: "st.Health & Wellness.health7", backgroundColor: "#00A0DC", nextState: "off"
		}
        valueTile("alarm", "device.alarm") {
			state "default", label:'Alarm: ${currentValue}'
		}
		main (["button", "alarm"])
		details (["button", "alarm"])
	}
}

def parse(String description) {
}

def updated() {
        def time = timer.substring(11,16)
        def tz = location.timeZone
        def schedTime = timeToday(timer, tz)

    if(timer) {
    		log.debug "Alarm time set to: $timer"
    		sendEvent("name":"image", "value":schedTime)
            sendEvent("name":"alarm", "value":time)
    } else {
    		log.debug "No alarm time is set"
    		}
}
def on() {
	sendEvent(name: "switch", value: "on")
}

def off() {
	sendEvent(name: "switch", value: "off")
}

It’s an adaptation of another forum member’s piston and handler.