Announcement

Collapse
No announcement yet.

Fade to dark

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Fade to dark

    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
    Last edited by rmorton27; February 24, 2017, 11:55 AM.
    -Rick

    #2
    Turn off logging for event and device--then do a "writelog" instruction right before "END" in script; then it will log once per cycle of the entire script.
    BobSpen

    Comment


      #3
      You can turn off logging for the device at the beginning of the script and back on at the end:

      Code:
      	Dim dv As Scheduler.Classes.DeviceClass = hs.GetDeviceByRef(1234)
      	dv.MISC_Set(hs, Enums.dvMISC.NO_LOG)
      
      'other code here
      
      	dv.MISC_Clear(hs, Enums.dvMISC.NO_LOG)
      Replace 1234 with your reference id.

      Cheers
      Al
      HS 4.2.8.0: 2134 Devices 1252 Events
      Z-Wave 3.0.10.0: 133 Nodes on one Z-Net

      Comment

      Working...
      X