Announcement

Collapse
No announcement yet.

Help with Error Message, Script error in file: CH and HW Control temp.txt 0: in line 0

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

    Help with Error Message, Script error in file: CH and HW Control temp.txt 0: in line 0

    I have written the attached script which appears to function. It is controlling the Central Heating and two hot water tanks in my house in conjunction with Temp05 sensors.
    However, I get the error message above so something must be wrong ?

    There are still some notes in the script as I intend to expand this for my new house which is under construction now, this will have 9 heating zones.


    any ideas ?

    Nigel


    ' 24/02/02 CH and HW Control script
    ' This script is to be used to control my CH Zone Valve and 2 HW Zone valves in conjunction
    ' with a midon Temp05 and Relay05


    Dim water1
    Dim water2
    Dim LivingRoom
    Dim ReqTemp

    ' Temporary script to set thermometer levels

    'hs.SetDeviceValue "H1",46
    'hs.SetDeviceValue "H2",46
    'hs.SetDeviceValue "H3",19
    'hs.SetDeviceValue "H10",21

    ' Collect values from virtual devices

    water1 = hs.DeviceValue("r3")
    water2 = hs.DeviceValue("r7")
    LivingRoom = hs.DeviceValue("r6")
    ReqTemp = hs.DeviceValue("r64")


    If LivingRoom < ReqTemp Then
    ' hs.speak "Heat On"
    hs.SetDeviceStatus "v2",2
    hs.SendToComPort 1,"RLY 6 on"
    hs.waitsecs 1
    Call HW1
    Else
    ' hs.speak "Heat Off"
    hs.SetDeviceStatus "v2",3
    hs.SendToComPort 1,"RLY 6 off"
    hs.waitsecs 1
    Call HW1
    End If


    ' Temporary speech stuff !!!!!!!!!!!

    'hs.speak "Hot Water 1 temperature is"
    'hs.speak water1
    'hs.speak "Hot Water 2 temperature is"
    'hs.speak water2
    'hs.speak "Living Room Temperature is"
    'hs.speak LivingRoom



    '-----------------------------------
    ' Begin Main Subroutine

    ' There can be as much code between here and
    ' the subroutines as you want. CALLing the
    ' subroutine will jump dirrectly to the
    ' beginning line of that Sub.

    ' End of the Main Subroutine

    '------------------------------------
    'Subroutines HW1 and HW2

    Sub HW1
    If water1 < 38 Then
    ' hs.speak "Hot Water 1 On"
    hs.SetDeviceStatus "v10",2
    hs.SendToComPort 1,"RLY 7 on"
    ' hs.speak "Hot Water 2 off"
    hs.waitsecs 1
    hs.SetDeviceStatus "v7",3
    hs.SendToComPort 1,"RLY 8 off"
    hs.waitsecs 1
    Else
    ' hs.speak "Hot water 1 Off"
    hs.SetDeviceStatus "v10",3
    hs.SendToComPort 1,"RLY 7 off"
    hs.waitsecs 1
    Call HW2
    End If
    End Sub


    Sub HW2
    If water2 < 38 Then
    ' hs.speak "Hot Water 2 On"
    hs.SetDeviceStatus "v7",2
    hs.SendToComPort 1,"RLY 8 on"
    hs.waitsecs 1
    Else
    ' hs.speak "Hot water 2 Off"
    hs.SetDeviceStatus "v7",3
    hs.SendToComPort 1,"RLY 8 off"
    hs.waitsecs 1
    End If
    End Sub



    'hs.speak "End of script"

    #2
    If you are calling it from homeseer then there will need to be a main subroutine that can be executed. Unless explicitly stated otherwise in the homeseer event/script then the name of the subroutine will be "main".

    sub main()
    your stuff
    end sub

    Some people have had problems with parameter passing from the event and in that case they just put a dummy parameter in the call. It is not used in the subroutine, but just stuffed there to overcome the error you are seeing above.

    If you are calling it as an application from homeseer then the file should be of filetype ".vbs" and then you do not need the sub main(). If you do call it as an application then dont forget to provide the full path to it.

    Comment

    Working...
    X