Announcement

Collapse
No announcement yet.

Trying to get function "IsTimeInScheduledTimeRange" to work.

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

  • Trying to get function "IsTimeInScheduledTimeRange" to work.

    Hi all,

    I am guessing that this problem isn't specific to EasyTrigger, but I need to use the function IsTimeInScheduledTimeRange and there must be somebody here who can help me!

    Previously, everything in my HomeSeer box has been done through simple events (and thank you, Spud, for EasyTrigger!!), but today I needed to write something far more complicated... break out the scripting.

    I have everything working exactly as I want it, except... For love nor money, I simply can't get hs.PluginFunction("EasyTrigger","","IsTimeInScheduledTimeRan ge"............. working. I have Googled as far as I can and tried umpteen different variations, but none of the following work:

    BoilerSchedule = nhs.PluginFunction("EasyTrigger", "", "IsTimeInScheduledTimeRange", New Object[] {"Boiler"})
    BoilerSchedule = nhs.PluginFunction("EasyTrigger", "", "IsTimeInScheduledTimeRange", NewObject() {"Boiler"})
    BoilerSchedule = nhs.PluginFunction("EasyTrigger", "", "IsTimeInScheduledTimeRange", NewObject({"Boiler"}))
    BoilerSchedule = nhs.PluginFunction("EasyTrigger", "", "IsTimeInScheduledTimeRange", "Boiler")
    BoilerSchedule = nhs.PluginFunction("EasyTrigger", "", "IsTimeInScheduledTimeRange", {"Boiler"})
    BoilerSchedule = nhs.PluginFunction("EasyTrigger", "", "IsTimeInScheduledTimeRange", ["Boiler"])

    (Googling seems to imply that I need to use 'nhs.PluginFunction' and not 'hs.PluginFunction', but it still doesn't work whichever I use).

    Essentially, when there is a "{" in the line, I get the compilation error "Invalid character" and when there isn't a "{" in the line, I get "Expected ')'".

    I am sure that I am missing something very simple, but I simply can't work out what the correct structure is from the docs and from Googling.

    Please, somebody, can you put me out of my misery and point me in the right direction?

    Nicholas.

    HS3 Pro Edition 3.0.0.318 (Windows)
    EasyTrigger 3.0.0.33

  • #2
    do you use C# or VB .NET for scripting?

    at the end of the user guide there is an example of C# script:

    Code:
    public object Main(object[] Parms)
    {
        bool isInSchedule = (bool) hs.PluginFunction("EasyTrigger", "", "IsTimeInScheduleTimeRange", new object[] { "Test" });
        
        hs.WriteLog("EasyTrigger Script", "IsInSchedule = " + isInSchedule.ToString());
        return 0;
    }

    Comment


    • #3
      Hi,

      Thanks for the speedy reply.

      I'm just using the built-in scripting (create a .txt file in '....\scripts\'). The first thing I tried was the example, but that errors out - then I went on a weird and wonderful Google search and lots of people saying "no, don't do it that way, do it this way" - hence all the different things I tried. Most people who have the same problem seem to resolve it by changing 'hs....' to 'nhs....', but that did nothing for me :-(

      Nicholas.

      Comment


      • #4
        Originally posted by NAB View Post
        Hi,

        Thanks for the speedy reply.

        I'm just using the built-in scripting (create a .txt file in '....\scripts\'). The first thing I tried was the example, but that errors out - then I went on a weird and wonderful Google search and lots of people saying "no, don't do it that way, do it this way" - hence all the different things I tried. Most people who have the same problem seem to resolve it by changing 'hs....' to 'nhs....', but that did nothing for me :-(

        Nicholas.
        if you want to use the example from the user guide you have to put it in a file with .cs extension because it's a C# script (and I thought for VB .NET it had to be in a .vb file, not sure if .txt works)

        Comment


        • #5
          Got it... moved from VBscript to VB.net and the following works:

          BoilerSchedule = hs.PluginFunction("EasyTrigger", "", "IsTimeInScheduleTimeRange", {"Boiler"})

          It seems that it's a problem with VBscript.

          Nicholas.

          Comment

          Working...
          X