A better way, I was struck with this useless, but a costly (CPU clicks) idea to make the bedroom lighting ramp down gradually over 30 minutes (or whatever) or so time span. I notice this could be done with events but not easily, so I wrote a script.
Sub Main()
for i = 1 to 100
theDevice = 127
devValue = hs.DeviceValue(theDevice)
newDevValue = devValue - 1
if newDevValue <=5 then
x=hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,tr ue ,"off",false,true))
deviceOne=1
end if
hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, false, CStr(newDevValue), false, true))
theDevice = 100
devValue = hs.DeviceValue(theDevice)
newDevValue = devValue - 1
hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, false, CStr(newDevValue), false, true))
if newDevValue <=5 then
x=hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,tr ue ,"off",false,true))
deviceTwo=1
end if
if deviceOne=1 and deviceTwo=1 then i=100
hs.waitsecs 18
next
End Sub
The question, opposed to my clumsy brute force script approach is there a better way?
Also, the only way I can see to keep the log from filling with a lot of useless drivel is checking the no logging for a device. A bit broad for my purpose is there a way to suppress the log messages. I searched and didn’t see a way aside from now obsolete verb.
-r
Sub Main()
for i = 1 to 100
theDevice = 127
devValue = hs.DeviceValue(theDevice)
newDevValue = devValue - 1
if newDevValue <=5 then
x=hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,tr ue ,"off",false,true))
deviceOne=1
end if
hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, false, CStr(newDevValue), false, true))
theDevice = 100
devValue = hs.DeviceValue(theDevice)
newDevValue = devValue - 1
hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice, false, CStr(newDevValue), false, true))
if newDevValue <=5 then
x=hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,tr ue ,"off",false,true))
deviceTwo=1
end if
if deviceOne=1 and deviceTwo=1 then i=100
hs.waitsecs 18
next
End Sub
The question, opposed to my clumsy brute force script approach is there a better way?
Also, the only way I can see to keep the log from filling with a lot of useless drivel is checking the no logging for a device. A bit broad for my purpose is there a way to suppress the log messages. I searched and didn’t see a way aside from now obsolete verb.
-r
Comment