Announcement

Collapse
No announcement yet.

Script conversion from HS2 to HS3

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

    Script conversion from HS2 to HS3

    G'day everyone

    I have decided to finally make the switch to HS3... I have a couple things that work exceptionally well with HS2 that were and still are pretty much custom scripts. I am not a coder writer and don't understand most of what happens with the things required to make events/scripts work. Thanks to the many people around here, I have been able to get my custom setup working. They are currently text based scripts. I am wondering if you all could help me to convert my window blind automation scripts to work with HS3? I don't have the first idea where to start but am willing to try to understand.

    Basically what happens is I have 10 adaptations of the original script. 3 for morning openings, 3 for timed by sunset closings, and then a few that open and close window blinds based on the sun position. It has been exceptionally effective over the years in keeping my home somewhat cooler during the summer months.

    Here is the morning opening and closing for one level. They are pretty basic I think. Check for the state of the blind positions, then power up the controller, open or close the blinds and set the state of an icon for display on the webpage. Truthfully, I don't understand why it does not work with HS3. I removed everything except what opens and closes 1 window for simplicity.

    Can you all help get me going in the right direction please?

    Thanks


    morning opening :


    Sub main()

    'set some initial values(assume blinds open)


    if hs.devicevalue("K1")="" then hs.setdevicevalue "K1",1:hs.setdeviceString "K1", " Blinds Open", 0


    'Evening Power on -- Turns on the 16 channel x10 relay board.

    hs.ExecX10 "K1","on"

    hs.writelog "Info","Power On"

    'Wait XX seconds


    hs.waitsecs 3


    ' POwer supply power up


    hs.ExecX10 "L15","on"

    hs.waitsecs 1


    'Set Time of Day State

    'K15 on is closed direction
    'k15 off is open direction



    'K15 is off --- This relay sets the state of DC motor control reversing square. On = close off = open.... this is a system wide change. Reverses the polarity of the power supply to supply forward or reverse configuration..(reverse positive and negative)

    ' hs.execX10 "k15","on"



    'WINDOW 1 Relay 1 Device 25


    If hs.devicevalue("K25")=0 then

    hs.ExecX10 "L1","on",,, true

    hs.waitsecs 2.0

    hs.ExecX10 "L1","off",,, true

    hs.setdeviceString "K25", "<img src ='/images/blindsOPEN.gif'>" & " Master Bedroom Open", true

    hs.setdevicevalue "K25",1

    hs.writelog "Info","Window 1 Blinds are now Open"

    Else

    hs.writelog "Info","Window 1 Blinds were Open"

    end if

    hs.waitsecs 1
    hs.waitsecs 1
    hs.waitsecs 1




    'POwer supply power down

    hs.ExecX10 "L15","off"

    hs.waitsecs 1


    'Evening Power Off


    hs.ExecX10 "K1","off"

    hs.writelog "Info","Power Off"
    end sub



    Afternoon Closing (reverse of morning operations)




    Sub main()


    'Evening Power on
    hs.ExecX10 "K1","on"

    hs.writelog "Info","Power On"

    'Wait XX seconds


    hs.waitsecs 3

    ' power supply power up

    hs.ExecX10 "L15","on"

    hs.waitsecs 1


    'Set Time of Day State

    'K15 on is closed direction
    'k15 off is open direction



    'K15 is ON

    hs.execX10 "L16","on"

    hs.waitsecs 1

    'WINDOW 1 Relay 1 (Relay 16 on) Device 25


    If hs.devicevalue("K25")=1 then

    hs.ExecX10 "L1","on",,, true

    hs.waitsecs 2.0

    hs.ExecX10 "L1","off",,, true

    hs.setdeviceString "K25", "<img src ='/images/blindsclosed.gif'>" & " Master Bedroom Blinds Closed", true

    hs.setdevicevalue "K25",0

    Else

    hs.writelog "Info","Window 1 Blinds were Closed"

    end if

    hs.waitsecs 1
    hs.waitsecs 1
    hs.waitsecs 1


    'K15 is OFF

    hs.execX10 "L16","off"

    hs.waitsecs 2


    ' power down power supplies

    hs.ExecX10 "L15","off"



    hs.waitsecs 1

    'Evening Power Off


    hs.ExecX10 "K1","off"

    hs.writelog "Info","Power Off"
    end sub
Working...
X