Announcement

Collapse
No announcement yet.

Need some help with code

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

    Need some help with code

    finally migrating from HS2 and need some help with my motion codes turning on and off lights when in a room.

    here ie the code that I used with HS2...

    Under the On section of UDMC

    If DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then
    hs.ExecX10ByName ("Theater Stairway Rope", "On")
    hs.ExecX10ByName ("Theater Snack Bar", "On")

    End If
    blradar.NewDelayedEventForNoEcho("Theater Stairway Rope Off", "Theater Stairway Ropeim To Off",10)
    blradar.NewDelayedEventForNoEcho("Theater Snack Bar Off", "Theater Snack Bar:Off",30)


    How do I rewrite for HS3?

    Many thanks and Happy New Year to all.

    #2
    Try this:

    Code:
    If DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then
        blradar.PluginFunction("ControlDevice", new Object(){"Theater Stairway Rope", "on", 0})
        blradar.PluginFunction("ControlDevice", new Object(){"Theater Snack Bar", "on", 0})
    End If
    blradar.PluginFunction("NewDelayedEventForNoEcho", new Object(){"Theater Stairway Rope Off", "Theater Stairway Rope:Dim To Off", 10, ""})
    blradar.PluginFunction("NewDelayedEventForNoEcho", new Object(){"Theater Snack Bar Off", "Theater Snack Bar:Off", 30, ""})
    Cheers,
    Bob
    Web site | Help Desk | Feature Requests | Message Board

    Comment


      #3
      Yes Sir!

      THANKS

      Comment


        #4
        Trying to up my game a little..

        How would I change this code to trigger only if the light was off and it was nighttime only?

        Thanks and I really appreciate the help and the plugin.


        If DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then blradar.PluginFunction("ControlDevice", new Object(){"Theater Stairway Rope", "on", 0}) blradar.PluginFunction("ControlDevice", new Object(){"Theater Snack Bar", "on", 0}) End If blradar.PluginFunction("NewDelayedEventForNoEcho", new Object(){"Theater Stairway Rope Off", "Theater Stairway Ropeim To Off", 10, ""}) blradar.PluginFunction("NewDelayedEventForNoEcho", new Object(){"Theater Snack Bar Off", "Theater Snack Bar:Off", 30, ""})

        Comment


          #5
          Try this

          Code:
          If DateDiff(DateInterval.Minute, Sensor.LastOn, DateTime.Now) > Sensor.NoEchoTime Then
              If hs.IsOn(Sensor.Ref) AndAlso hs.PluginFunction("BLRadar", "", "NightTime", Nothing) Then
                  blradar.PluginFunction("ControlDevice", new Object(){"Theater Stairway Rope", "on", 0})
                  blradar.PluginFunction("ControlDevice", new Object(){"Theater Snack Bar", "on", 0})
              End If
          End If
          blradar.PluginFunction("NewDelayedEventForNoEcho", new Object(){"Theater Stairway Rope Off", "Theater Stairway Rope:Dim To Off", 10, ""})
          blradar.PluginFunction("NewDelayedEventForNoEcho", new Object(){"Theater Snack Bar Off", "Theater Snack Bar:Off", 30, ""})
          Cheers,
          Bob
          Web site | Help Desk | Feature Requests | Message Board

          Comment


            #6
            Big THANKS!

            Comment

            Working...
            X