Announcement

Collapse
No announcement yet.

HS2 VBS Script for PLC Device

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

    HS2 VBS Script for PLC Device

    Hi everybody,
    I'm newbie with homeseer scripts and need your help :-)
    I'de just like to create a toggle script betwezen HS2 and a DIN RAIL PLC MODULE 2268HX2.
    I locally control the "C2" channel of this module from 2 temp switches and by a third temp switch linked to a 2269 PLC scenario micro module that just send a "C2" ON/OFF command.
    I just want that each time I press the 2269 linked switch, if the C2 light is OFF then I switch it on and if the light is ON I switch it OFF, that's it :-)
    This is the script I made :

    Sub Main ()
    hs.PollDevice "C2"
    status = hs.DeviceStatus("C2")
    IF status = 3 THEN
    hs.execx10 "C2", "on"
    Exit Sub
    ELSEIF status = 2 THEN
    hs.execx10 "C2", "off"
    END IF
    End Sub

    Unfortunatly, this script is not correct...
    When the light is on, whane I execute the script I can see the light swithced OFF for 2 secondes and swith ON again... ??? Same thing when the light is OFF... it doesn't work...

    Do you have any idea ? The status feedback is one of the reason I replace my X10 setup by a PLC one...

    Thanks by advance.

    Eric

    #2
    Hi Eric
    Add one more device like D3, and program 2269 to control it.

    Make a event when D3 status change to any, run your script.

    Sub Main ()
    hs.PollDevice "C2"
    status = hs.DeviceStatus("C2")
    IF status = 3 THEN
    hs.execx10 "C2", "on"
    ELSEIF status = 2 THEN
    hs.execx10 "C2", "off"
    END IF
    End Sub

    -Mkoff

    Comment

    Working...
    X