Announcement

Collapse
No announcement yet.

Script Question

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script Question

    Jim,

    Upgraded to your latest version in the Updater, and now can't get this code to execute. Would you help?

    Sub Main
    DIM DStr, dm
    DIM Sensor
    Set dm = hs.plugin("DooMotion")
    For each MS in dm.MotionSensor HERE IS WHERE I GET THE ERROR
    Set Sensor = MS
    Sensor.NormalElapsedTime = 1

    Select Case Left(Sensor.Name,6)
    Case "Living"
    Sensor.OccupancyElapsedTime = 45
    Case "Outsid"
    Sensor.OccupancyElapsedTime = 30
    Sensor.NormalElapsedTime = 1
    Case "DS Hal"
    Sensor.OccupancyElapsedTime = 15
    Case Else
    Sensor.OccupancyElapsedTime = 30
    End Select
    hs.WriteLog "Motion", Sensor.Name & " OET set to " & sensor.OccupancyElapsedTime & " mins"
    Next
    Set Sensor = nothing
    End Sub

    #2
    I will need to test that. Some scripting functionality may have been broken when plug-in was converted to .NET. Specifically, I would expect that For/Each may not be working. While I look into this, how about trying:

    PHP Code:
    For 0 to dm.MotionSensors.Count
      Set MS 
    dm.MotionSensors(i)
      ...
    Next 
    Jim Doolittle

    My Twitter
    My Hardware & Software

    Comment


      #3
      Latest...

      PHP Code:
      '*******************************************
      '
      Set Occupancy Elapsed Time to 30 
      '*******************************************
      '
      Changes Occupancy Elapsed Time for
      'certain sensors. 
      '
      *******************************************
      Sub Main
      DIM DStr
      DIM Sensor
      Dim i
      Dim dm
      Set dm 
      hs.Plugin("DooMotion")
       For 
      0 to dm.MotionSensors.Count
        Set Sensor 
      dm.MotionSensors(i)
        
      Sensor.NormalElapsedTime 1
       
        Select 
      Case Left(Sensor.Name,6)
         Case 
      "Living"
          
      Sensor.OccupancyElapsedTime 45
         
      Case "Outsid"
          
      Sensor.OccupancyElapsedTime 30
          Sensor
      .NormalElapsedTime 1
         
      Case "DS Hal"
          
      Sensor.OccupancyElapsedTime 15
         
      Case Else
          
      Sensor.OccupancyElapsedTime 30
        End Select
        hs
      .WriteLog "Motion"Sensor.Name " OET set to " sensor.OccupancyElapsedTime " mins"
       
      Next
       Set Sensor 
      nothing
      End Sub 
      This is the error:

      PHP Code:
      1/18/2007 3:43:27 PM  Error Running scriptscript run or compile error in file30-SetOccupancyTime.txt438:Object doesn't support this property or method: 'dm.MotionSensors' in line 14 More info: Object doesn't support this property or method'dm.MotionSensors' 

      Comment


        #4
        OK. I have this fixed in 2.2.56 which will be available later tonight. You can continue to use For/Each.

        However, you may want to hold off a day or two before trying 2.2.56 as it has some major changes (to improve performance) so it will truly be a beta version. Running OK on my test machine though.
        Jim Doolittle

        My Twitter
        My Hardware & Software

        Comment


          #5
          Latest version?

          Jim,

          The problem I am having is that the object dm.MotionSensors is, according to my log errors, NOT supported:
          Object doesn't support this property or method: 'dm.MotionSensors'

          I am really confused and would appreciate some help.

          Thanks,

          Michael

          Comment


            #6
            Doesn't support it because the .NET version of DM did not contain it until 2.2.56. Conversion of collections to .NET was not easy and I temporarily removed the ability to access the motion sensors, dusk/dawn sensors, and occupancy sensor collection via scripting. Unfortunately, I forgot to add it back.

            2.2.56 now has scripting access to the collections but I have a couple of issues that still need to be resolved before I release. Let me see where I get with the new build by this evening and I will report back.
            Jim Doolittle

            My Twitter
            My Hardware & Software

            Comment


              #7
              Thank you. I thought I was losing my mind. But then, others have so said.

              Comment

              Working...
              X