I am having some really strange results when I try and switch inputs on/off on my Ocelot from the web and scripting interface.
I am using the hs.devicevalue command reading '1' as on and '0' as off. I then use the set command to toggle these. It seems that if I do that the hs.ison and hs.isoff commands do not follow... it is like they conflict... Also after the set command the values do not always reflect the correct on/off states.
(I am running the latest ADIOcelot plug-in)
Here is my web code:
<pre class="ip-ubbcode-code-pre">
Function SpeakerControl(pDeviceName)
Dim strStatusImage, strStatusText, strControl, iValue, strLabel, v
'If hs.IsOff(pDeviceName) then
If hs.devicevalue(pDeviceName) = 0 then
strControl = 1
strLabel = "Turn On"
strStatusImage = hs.IsOn(pDeviceName) & pDeviceName & hs.devicevalue(pDeviceName) & "<input src='icons/devices/soundoff.gif' type='image' align='absmiddle' title='" & strLabel & "'>"
Else
strControl = 0
strLabel = "Turn Off"
strStatusImage = hs.IsOn(pDeviceName) & pDeviceName & hs.devicevalue(pDeviceName) & "<input src='icons/devices/soundon.gif' type='image' align='absmiddle' title='" & strLabel & "'>"
end if
SpeakerControl = "<form method='POST' style='margin:0'>" & strStatusImage & "<input type='hidden' value='Image' name='Action'><input type='hidden' value='hs.setdevicevalue """ & pDeviceName & """,""" & strControl &""" ' name='CommandImage'></form>"
End Function
</pre>
I have it print the output of both hs.ison and the devicevalue and they are not always the same.
Here is a sample output from the above code.
<pre class="ip-ubbcode-code-pre">
DeviceCode hs.IsOn hsDeviceValue
$9 True 0
$10 True 1
</pre>
I am loosing my mind over this as I cannot figure out what is going on..
I am using the hs.devicevalue command reading '1' as on and '0' as off. I then use the set command to toggle these. It seems that if I do that the hs.ison and hs.isoff commands do not follow... it is like they conflict... Also after the set command the values do not always reflect the correct on/off states.
(I am running the latest ADIOcelot plug-in)
Here is my web code:
<pre class="ip-ubbcode-code-pre">
Function SpeakerControl(pDeviceName)
Dim strStatusImage, strStatusText, strControl, iValue, strLabel, v
'If hs.IsOff(pDeviceName) then
If hs.devicevalue(pDeviceName) = 0 then
strControl = 1
strLabel = "Turn On"
strStatusImage = hs.IsOn(pDeviceName) & pDeviceName & hs.devicevalue(pDeviceName) & "<input src='icons/devices/soundoff.gif' type='image' align='absmiddle' title='" & strLabel & "'>"
Else
strControl = 0
strLabel = "Turn Off"
strStatusImage = hs.IsOn(pDeviceName) & pDeviceName & hs.devicevalue(pDeviceName) & "<input src='icons/devices/soundon.gif' type='image' align='absmiddle' title='" & strLabel & "'>"
end if
SpeakerControl = "<form method='POST' style='margin:0'>" & strStatusImage & "<input type='hidden' value='Image' name='Action'><input type='hidden' value='hs.setdevicevalue """ & pDeviceName & """,""" & strControl &""" ' name='CommandImage'></form>"
End Function
</pre>
I have it print the output of both hs.ison and the devicevalue and they are not always the same.
Here is a sample output from the above code.
<pre class="ip-ubbcode-code-pre">
DeviceCode hs.IsOn hsDeviceValue
$9 True 0
$10 True 1
</pre>
I am loosing my mind over this as I cannot figure out what is going on..
Comment