Announcement

Collapse
No announcement yet.

Writing script for secu16 I/0 input pin change

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

    Writing script for secu16 I/0 input pin change

    Hello Bruce,

    Have been away from homeseer setup for awhile and just getting back into it and in particular using your plugin.

    I have an input connected to an SECU16 I/O Unit input 7 (I/O point 6) that reports if mailbox is opened or closed. Just wondering how I would set up a script to monitor this I/O point? There are examples in your docs on scripting an output but haven't seen anything on inputs. Would like to detect if mailbox is open and speak message. Every 5 minutes after mailbox is open need to see if mailbox is still open and if it is speak an appropriate message every 5 minutes until mailbox is closed. When mailbox is closed script would wait for next opening of mail box. Also have images of mailbox open and mailbox closed to incorporate into script.

    Your help is much appreciated and thanks for the help !!!!!! Rick

    #2
    Hi Rick,
    You would use an event to do want you are asking. The trigger would be your mailbox input and then you could use conditions and actions to do whatever else you need to do. You can use hs.DeviceValue to get status but I don't think that's what you want to do.

    I haven't done a lot with HS3 events but if you read up here I believe you can figure it out

    Comment


      #3
      Hi Bruce,

      There are some applications where I will be doing scripting on the secu16 inputs. This is an old example but wondering if the commands still apply or if there is an updated version:

      Sub Main ()

      dim v
      V=cpuxa.GetPoint (1,0)

      End Sub

      1 = secu16 unit number
      0 = I/O Point 0 - Input #1

      Will the cpuxa.GetPoint () function work with your plugin in HS3? Again your docs show an output example but no input example. Thanks again for all your help !!!!!! Rick

      Comment


        #4
        Rick,
        You can get input status using hs.DeviceValue.
        You can find the input device's reference ID on the Advanced tab of the device's configuration page.

        0 is OFF
        1 is ON


        Code:
        Sub Main(Parm As Object)
        
        Dim x As Integer
        
        x = hs.DeviceValue(dvRef) 'dvRef is the input device's reference ID.
        
        End Sub


        Bruce

        Comment


          #5
          I hate to bring this old thread back to life, but I could really use the Public Method GetAnalogInputValue. In my case, I have an analog thermal sensor connected to input 1. What I need to read is the value from 0 to 255 from the analog input. The state of 1 or 0 will not do to read the temperature. I could move this to my Arduino, however it would mean changing the voltage range which I would prefer not to do.

          I used to do it this way in a script.
          v = hs.PluginFunction("Applied Digital Ocelot", "", "GetAnalogInputValue", array(2,0))
          if v>10 and v<250 then hs.setdevicevaluebyname "AV_Closet Temperature",round(100*v/256,1)​

          I see that I can use v=hs.PluginFunction ("GTS CPUXA", "", "GetPointValue", Array(2,0)), however that will return a 1 or 0, the point status. The start of this thread mentions cpuxa.GetPoint, which was the original way to access a plugin from script. I don't think that has been valid for some time now.

          Please let me know if this is a method you can expose.

          I am still using the Ocelot as it has the IR codes for all of my devices. Your plugin works very well for that and normal on/off devices.

          Thanks!

          Comment

          Working...
          X