Announcement

Collapse
No announcement yet.

Help for simple (!!!) conversion

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

  • Help for simple (!!!) conversion

    My HS2 simple script:

    Code:
    Sub Main
    if hs.ison("A13") then
    hs.execx10 "A13","off",0
    Else
    hs.execx10 "A13","on",0
    end if
    End Sub
    How can I convert it to HS3 script?

    I have read about the CAPI function but I did not understand. Sorry, I'm not a programmer...

  • #2
    Just being in the migration fase and I would like to also see a simple conversion. Did you get it yet?

    Comment


    • #3
      Originally posted by renevk View Post
      Just being in the migration fase and I would like to also see a simple conversion. Did you get it yet?
      Here's one way to do it:

      Code:
      Sub Main(ByVal theDevice As String)
      	''Toggle the Specified Device ON/OFF
      	' DIM is considered ON
      	' Specify the Device ID as the Parameter
      	Dim devValue As Double
      
      	' Get the Device Status
      	devValue = hs.DeviceValue(theDevice)
      	' Toggle it
      	Select Case devValue
      		Case Is > 0
      		' Device ON or DIM, turn it OFF
      		hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,true ,"off",false,true))
      		Case 0
      		' Device OFF, turn it ON
      		hs.CAPIControlHandler(hs.CAPIGetSingleControl(theDevice,true ,"on",false,true))
      	End Select
      End Sub
      Cheers
      Al
      HS 3.0.0.532: 1963 Devices 1141 Events
      Z-Wave 3.0.1.261: 122 Nodes on one Z-Net

      Comment


      • #4
        And what will be the a simple way to do this?

        hs.ExecX10 "D2" , "all units off",0,0

        I tried
        hs.CAPIControlHandler(hs.CAPIGetSingleControl("D2",true ,"all units off",false,true)) but that will turn off only 1 lamp

        Comment


        • #5
          Originally posted by renevk View Post
          And what will be the a simple way to do this?

          hs.ExecX10 "D2" , "all units off",0,0

          I tried
          hs.CAPIControlHandler(hs.CAPIGetSingleControl("D2",true ,"all units off",false,true)) but that will turn off only 1 lamp
          You're welcome.

          That's probably much easier with an event... If you need to access it from a script, call the event from a script.
          HS 3.0.0.532: 1963 Devices 1141 Events
          Z-Wave 3.0.1.261: 122 Nodes on one Z-Net

          Comment


          • #6
            Originally posted by renevk View Post
            And what will be the a simple way to do this?

            hs.ExecX10 "D2" , "all units off",0,0

            I tried
            hs.CAPIControlHandler(hs.CAPIGetSingleControl("D2",true ,"all units off",false,true)) but that will turn off only 1 lamp
            I've not yet messed with HS X10 in practice (just have the plugin enabled but nothing connected), is the all units off command to the house code not a device, as such there is not going to be an 'all units off' command on a device. As Al says this is something you appear to be able to use an event for but for doing it by script I would guess you would need to call into it using hs.pluginfunction if those functions are publicly available however there appears to be no documentation about it that I can see.
            My Plugins:

            Pushover 3P | DoorBird 3P | Current Cost 3P | Velleman K8055 3P | LAMetric 3P | Garadget 3P | Hive 3P |
            Yeelight 3P | Nanoleaf 3P

            Comment


            • #7
              The command works well in HS2. It send a "all units off' command to all devices in the range "D" . And all X10 devices which are programmed to react on this commands will reponse with a "go to off " status. Also " all lights off " is possible, but in the past i've made a decision (to send a "all units off" command. The Marmitek lamp module doesn't react on "all lights off command"

              Comment

              Working...
              X