Announcement

Collapse
No announcement yet.

hs.ison("q5") vs mv.ison("q5")

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

    hs.ison("q5") vs mv.ison("q5")

    Is there a problem?

    When i use mv.ison() ... i get the correct status..

    When is use hs.ison()... i always get false... regardless of status

    I'll keep looking for something i'm doing wrong... but i'm at a loss at the moment.

    Thanks if anyone can help.

    Andrew

    Edit.. forgot to add

    H.S. 2.1.75
    Movement Plugin 1.9.0.10
    Last edited by ArbWare; June 2, 2006, 05:55 PM.
    Regards,

    Andrew B.

    #2
    Show us how your using the code and maybe we can spot something.
    -Rupp
    sigpic

    Comment


      #3
      Rup Thank for taking a look when you have a chance

      Called as a optimized script on Motion Detector "Basement Motion".

      dim mv
      sub main(sDeviceName)

      if typename(mm) = "hspi" Then
      Set mv = mm
      else
      Set mv = hs.GetPlugins("mcsMovement")
      end if

      'sDeviceName="Basement DeskLamp"

      hs.writelog "Debug", "Entering "& SDeviceName

      'Check using mv.ison

      if mv.ison(sDeviceName) then
      hs.speak("Device "&sDeviceName&" is on")
      else
      hs.speak("Device "&sDeviceName&" is off")
      end if

      ' Check using hs.ison

      if hs.ison(sDeviceName) then
      hs.speak("Device "&sDeviceName&" is on")
      else
      hs.speak("Device "&sDeviceName&" is off")
      end if


      end sub

      I get the following on transition from off to on:

      6/2/2006 8:14:22 PM - Debug - Entering Motion Basement Motion
      6/2/2006 8:14:22 PM - Info - Speak ()evice Motion Basement Motion is on
      6/2/2006 8:14:22 PM - Info - Speak ()evice Motion Basement Motion is off

      I get the following on transition from On To Off
      6/2/2006 8:15:43 PM - Debug - Entering Motion Basement Motion
      6/2/2006 8:15:43 PM - Info - Speak ()evice Motion Basement Motion is off
      6/2/2006 8:15:43 PM - Info - Speak ()evice Motion Basement Motion is off


      I don't know how some folks post code to the scrolling window inside the post... is it something straightforward?



      Thanks for any insights..

      Andrew
      Regards,

      Andrew B.

      Comment


        #4
        IsOn doesn't work with device names only device codes.

        if hs.IsOn("A1") then
        hs.speak "the light is on"
        end if
        -Rupp
        sigpic

        Comment


          #5
          To followup with Rupp's answer, hs also has another method hs.IsOnByName that will do what you want. Within mcsMovement I accept either format witht he IsOn function. If you have a device with a null location and the name is a valid device code then mcsMovement will treat it as a device rather than as a name.

          Comment


            #6
            Thank you both very much...

            Regards,

            Andrew B.

            Comment

            Working...
            X