##
##
#set $inputBinCount = 0
#if $targetDev.inputBinaryStates
#set $inputBinList = $targetDev.inputBinaryStates.split(",")
#set $inputBinCount = len($inputBinList)
#if $inputBinCount > 0
#if $inputBinList[0].strip == "0"
#set $firstInputIsOn = False
#else
#set $firstInputIsOn = True
#end if
#end if
#end if
##
#set $outputCount = 0
#if $targetDev.outputBinaryStates
#set $outputList = $targetDev.outputBinaryStates.split(",")
#set $outputCount = len($outputList)
#if $outputCount > 0
#if $outputList[0].strip == "0"
#set $firstOutputIsOn = False
#else
#set $firstOutputIsOn = True
#end if
#end if
#end if
##
##
#if $outputCount == 1
#if $firstOutputIsOn
${_restRequestStart("devices", $targetDev.name, "outputBinaryStates=clear1"), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#else
${_restRequestStart("devices", $targetDev.name, "outputBinaryStates=set1"), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#end if
#else
#end if
${targetDev.name}
#if $outputCount == 1
Binary Output:
#if $firstOutputIsOn
#if $targetDev.labelOutputBinaryOn
$targetDev.labelOutputBinaryOn
#else
on
#end if
#else
#if $targetDev.labelOutputBinaryOff
$targetDev.labelOutputBinaryOff
#else
off
#end if
#end if
${_restRequestStart("devices", $targetDev.name, "outputBinaryStates=clear1"), entityEncoding='skip'}
Turn Off
${_restRequestEnd, entityEncoding='skip'}
${_restRequestStart("devices", $targetDev.name, "outputBinaryStates=set1"), entityEncoding='skip'}
Turn On
${_restRequestEnd, entityEncoding='skip'}
#end if
#if $inputBinCount == 1
Binary Input:
#if $firstInputIsOn
#if $targetDev.labelInputBinaryOn
$targetDev.labelInputBinaryOn
#else
on
#end if
#else
#if $targetDev.labelInputBinaryOff
$targetDev.labelInputBinaryOff
#else
off
#end if
#end if
#else if $inputBinCount > 1
Binary Inputs: ${targetDev.inputBinaryStates}
#end if
#if $targetDev.inputAnalogStates
Analog Inputs: ${targetDev.inputAnalogStates}
#end if
#if $targetDev.inputSensorStates
Sensor Inputs: ${targetDev.inputSensorStates}
#end if
#if $outputCount > 1
Binary Outputs:
#set $outputIndex = 1
#for $output in $outputList
#if $outputIndex < 10
#set $outputIndexStr = "0" + str($outputIndex)
#else
#set $outputIndexStr = str($outputIndex)
#end if
#set $buttonOnImageName = "Button" + $outputIndexStr + "On.png"
#set $buttonOffImageName = "Button" + $outputIndexStr + "Off.png"
#set $restSetArg = "set" + str($outputIndex)
#set $restClearArg = "clear" + str($outputIndex)
#set $output = $output.strip
#if $output == "1"
${_restRequestStart("devices", $targetDev.name, "outputBinaryStates="+$restClearArg), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#else if $output == "0"
${_restRequestStart("devices", $targetDev.name, "outputBinaryStates="+$restSetArg), entityEncoding='skip'}
${_restRequestEnd, entityEncoding='skip'}
#end if
#set $outputIndex = $outputIndex + 1
#end for
#end if