#if $targetDev.pauseScheduleZoneIndex > 0
#set $showStartButton = True
#set $showPauseButton = False
#set $startButtonDisabled = False
#set $startPauseAction = "activeZone=resume"
#set $stateDesc = "paused, press Play to resume schedule at zone " + str($targetDev.pauseScheduleZoneIndex)
#else if $targetDev.currentScheduleZoneIndex > 0
#set $showStartButton = False
#set $showPauseButton = True
#set $startButtonDisabled = False
#set $startPauseAction = "activeZone=pause"
#set $stateDesc = "schedule running (zone " + str($targetDev.currentScheduleZoneIndex) + " on)"
#else if $targetDev.activeZone > 0
#set $showStartButton = True
#set $showPauseButton = False
#set $startButtonDisabled = True
#set $startPauseAction = ""
#set $stateDesc = "zone " + str($targetDev.activeZone) + " on (no schedule running)"
#else if $targetDev.previousZoneDurations != ""
#set $showStartButton = True
#set $showPauseButton = False
#set $startButtonDisabled = False
#set $startPauseAction = "activeZone=run"
#set $stateDesc = "all off, press Play to run last schedule"
#else
#set $showStartButton = True
#set $showPauseButton = False
#set $startButtonDisabled = True
#set $startPauseAction = ""
#set $stateDesc = "all zones off"
#end if
#if $targetDev.activeZone > 0
#else
#end if
${targetDev.name}
${targetDev.displayLongState}
Schedule:
#if not $targetDev.scheduledZoneDurations
#if not $iphone
-- no schedule running --
#else
--
#end if
#else
#set $count = 1
#set $durationList = $targetDev.scheduledZoneDurations.split(",")
#for $duration in $durationList
#if $targetDev.pauseScheduleZoneIndex > 0
#if $count == $targetDev.currentScheduleZoneIndex
$duration
#elif float($duration) > 0
$duration
#else
--
#end if
#else
#if $count == $targetDev.currentScheduleZoneIndex
$duration
#elif float($duration) > 0
${_restRequestStart("devices", $targetDev.name, "activeZone="+str($count)), entityEncoding='skip'}
$duration
${_restRequestEnd, entityEncoding='skip'}
#else
--
#end if
#end if
#set $count = $count + 1
#end for
#end if
${_restRequestStart("devices", $targetDev.name, "activeZone=prev"), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#if $showStartButton
#if $startButtonDisabled
#else
${_restRequestStart("devices", $targetDev.name, $startPauseAction), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#end if
#else if $showPauseButton
${_restRequestStart("devices", $targetDev.name, $startPauseAction), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#end if
${_restRequestStart("devices", $targetDev.name, "activeZone=stop"), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
${_restRequestStart("devices", $targetDev.name, "activeZone=next"), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
${stateDesc, entityEncoding='skip'}