Announcement

Collapse
No announcement yet.

Examples how to use scripting in C# or vb for GetSchedule(string scheduleName)'

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

  • Examples how to use scripting in C# or vb for GetSchedule(string scheduleName)'

    Hi,

    I want to create a dynamic schedule. I read this is possible with scripting and 'void SetSchedule(string scheduleName, string timeSlots)'
    Is it possible to get some examples how to do this in C# or VB? Mabe also for:
    void SetSchedule(string scheduleName, string timeSlots)
    string GetSchedule(string scheduleName)
    string GetScheduleNextTimeRangeStart(string scheduleName)
    string GetScheduleNextTimeRangeEnd(string scheduleName)
    bool IsTimeInScheduleTimeRange(string scheduleName)

    Thanks!

  • #2
    here is an example of a C# script that update the Test schedule with a schedule that contains 2 time ranges: Saturday from sunrise-30mins to sunset+30mins and Sunday from sunrise-30mins to sunset+30mins.
    If the schedule doesn't exist it is created.

    Code:
    public object Main(object[] Parms)
    {   
        hs.PluginFunction("EasyTrigger", "", "SetSchedule", new object[] { "Test", "[Sat Sunrise-00:30;Sat Sunset+00:30],[Sun Sunrise-00:30;Sun Sunset+00:30]" });
        return 0;
    }

    Comment


    • #3
      Hi,

      Thank you so much. I will give it a try!

      Regards, Walter

      Comment


      • #4
        I try your example and this working well. Now i want to make a schedule for EACH day, so i tryed without the day:

        hs.PluginFunction("EasyTrigger", "", "SetSchedule", new object[] { "Test", "[08:00;08:30]" });

        I get the error:
        ERROR One of the identified items was in an invalid format.
        How can i specify 'everyday'? Or must i create 7 entrys with day specified?
        Thanks in advance.

        Comment


        • #5
          you can't create a day schedule using the SetSchedule scripting function, but you can update an exisitng one.
          so, create a day schedule manually from the config page, then retry your script.

          Comment


          • #6
            That was the solution. Now i can set my schedules dynamically
            I want to program a intelligent preheat at wakeup time. The system will calculate continous the neeeded time to heat my house 1 degree. Then i know how long i have to preheat to have exactly the wanted temperature at wakup.
            thanks again!

            Comment


            • #7
              Hi,

              Is it possible to use a variable timeslot like this?

              String timeslot = ("11:30;12:30");
              hs.PluginFunction("EasyTrigger", "", "SetSchedule", new object[] { "Test", timeslot] });

              I tryed several combinations but keep getting errors.

              Comment


              • #8
                try this:

                Code:
                String timeslot = "[11:30;12:30]";
                hs.PluginFunction("EasyTrigger", "", "SetSchedule", new object[] { "Test", timeslot });

                Comment


                • #9
                  Hi,

                  Thanks for you example. i give it a try! I have to learn C# al little bit more

                  Comment


                  • #10
                    Hi,

                    I just found out how to implement the preheat but im strugling with this.
                    I have this script to read my wakeup time set by Easytrigger:

                    public Object Main(Object[] parms) {
                    string nameis = (string) hs.PluginFunction("EasyTrigger", "", "GetSchedule", new object[] { "Test2" });
                    hs.WriteLog("EasyTrigger Script", "nameis = " + nameis.ToString());
                    return 0;
                    }


                    Result is:
                    nameis = [17:35;17:36]

                    I want to put the first time string (in red) put in a virtual device.
                    Then i can subtrack the preheat time from this virtual device with easytrigger.

                    Can i have a example how to strip this first timestring and put this in a virtual device?

                    Thanks!

                    Walter

                    Comment

                    Working...
                    X