Quantcast
Channel: HomeSeer Message Board
Viewing all articles
Browse latest Browse all 4847

HS2 to HS3 Scripting Question

$
0
0
I'm trying to move a very simple script that I used in HS2 to HS3. Unfortunately I'm having some difficulty with it. I've read some various threads on what I might need to change, but so far nothing has worked. The script is very simple, it is designed to progressively increase brightness of a light in small increments over a period of time. The script, as written for HS2 looks like this:

Code:

Sub Main()
 
        dim time
        dim sunrise
        dim threshold
       
        threshold = TimeValue("6:45:00 AM")
        sunrise = TimeValue(hs.Sunrise)
       
        if (sunrise > threshold) then
                hs.execx10 "C3", "extended", 1,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 3,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 6,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 9,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 13,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 18,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 24,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 30,49
                hs.WaitSecs 300
                hs.execx10 "C3", "extended", 35,49
                hs.WaitSecs 600
                hs.execx10 "C3", "extended", 40,49
        end if
 
end sub

I know that I can't use "hs.execx10" any more and I need to make some changes. Based on some information gleaned from this forum, I changed the file from 'wakeup.txt' to 'wakeup.vb' and the code to look like this:

Code:

Sub Main()

        Dim X10plugin As HomeSeerAPI.PluginAccess = New HomeSeerAPI.PluginAccess(hs, "X10", "")
 
        Dim sunrise as Date
        Dim threshold as Date
       
        threshold = TimeValue("6:45:00 AM")
        sunrise = TimeValue(hs.Sunrise)
       
        if (sunrise > threshold) then
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 1, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 3, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 6, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 9, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 13, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 18, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 24, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 30, 49, False})
                hs.WaitSecs 300
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 35, 49, False})
                hs.WaitSecs 600
                X10plugin.PluginFunction("ExecX10", {"C3", "extended", 40, 49, False})
        end if
 
end sub

When I try to run the event now, in the log I see things like this:

Code:

"Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\wakeup.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases."
and a bunch of these:

Code:

"Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\wakeup.vb: Method arguments must be enclosed in parentheses."
Clearly I don't quite have a handle on the syntax and I don't understand the 'System.Core' message. Since I'm not trying to do anything really complicated, just sending an 'extended' command to an X10 device (I'm using the X10 plugin), I'm hoping that someone can point out my obvious mistakes and help me to get this script to work.

My environment configuration is this:

Code:

Current Date/Time: 11/30/2016 5:09:58 PM
HomeSeer Version: HS3 Standard Edition 3.0.0.297
Operating System: Microsoft Windows 10 Pro - Work Station
System Uptime: 0 Days 4 Hours 15 Minutes 58 Seconds
IP Address: 192.168.0.186
Number of Devices: 16
Number of Events: 7
Available Threads: 200

Enabled Plug-Ins
3.0.0.68: HSTouch Server
3.0.0.36: X10

Thanks in advance!

Jim

Viewing all articles
Browse latest Browse all 4847

Trending Articles