I have a central heating system witch the controller send the user info (switch on /off set times etc.) over http. I can read this and interrater it using a c++ program but:
- Is there a way to set the scheduler from the c++?
- Is there a way to read the scheduler using the c++?
Please can anyone help with programmatically controlling the scheduler?
Can any one help?
Will “(Scheduler.IsScheduling(“15 19 * * 1-7”)” work to program the scheduler or is it a separate system?
from testing the above code dose not work. Any ideas?
What do you want to achieve? According to documentation
Scheduler.IsScheduling(“15 19 * * 1-7”) will check if this very moment is 19:15 of any day of week.
I am trying to communicate with a central heating system it has its own web interface but I can use HG to communicate, in the same way as you communicate with a widget using http (eg like an arduino).
But I need to Read, Modify and Set the scheduler from this (from the c# program), so I can set, adjust and view the central heating times both on the contrail unit and on the schedule page. My understanding of “Scheduler.IsScheduling(“15 19 * * 1-7”)” may not be correct but,
- I don’t believe it sets the time in the schedule so it would not be visible on the schedule page.
- As did not think it set the time to schedule (on the schedule page) if the power was lost eg pc off then the schedule would be as well as it would be a dynamic variable.
so I am looking for some code to:
add the schedule item,
activate the schedule item,
de-activate the schedule item
update/modify the schedule item.
Well, it seems that there is no API for that
You can create scheduler item, but there is no way to bind modules to it.
The best you can do is to create scheduler item by hand, assign modules to it and script and then dynamically change its cron expression using
SetSchedule() method (docs).
It will look like this
Scheduler.WithName("scheduleItemName").SetSchedule("15 19 * * *");
Also take a look at this post from the old forum.
Thanks that really did help but I am having problems with a time range. I am using:
Scheduler.WithName(“scheduleItemName”).SetSchedule((“15 19 * * *) >(18 10 * * *”));
It seams to be updating the corn info in the edit event but not the visual time line.
What am I don’t incorrect?
Hm, just tried this on my own instance.
Created scheduling item with single occurrence at 19:54, then wrote program with one command:
Scheduler.WithName("testEvent1").SetSchedule("(15 19 * * *) > (18 10 * * *)");
After compiling and running the program visual appearance changes:
But in edit dialog I still see 19:54:
Looks like a bug in HG.
And on “Edit events” page it looks like following:
Thank you for the help.
I have changed my code to match yours but I still don’t get the bar in the events display after the program has run. But like you It dose change the events Edit as you display. May be it is an error in HG.
What version of HG are you using. An update to the latest version https://github.com/genielabs/HomeGenie/releases/tag/v1.3-stable.5 might help if you haven’t already done so.
Currently using v1.3stable.4 so will have a look at updating.
Tried updating to latest version v1.3stable.5 (on pi) but the same happens after programmatically changing the schedule times the schedule will not display as a bar.
Sounds like it might be a bug. Report it over on the HG GitHub.
I see there is a .get() in the helper (docs)
Could this be used to get the current corn job values out of a current scheduler.
Variable = Scheduler.WithName(“scheduleItemName”).Get();
Any help would be appreciated as I am not understanding the docs well. without examples.
To activate and deactivate the schedule item I use:
Is there a way to get out of the schedule the set times / date (even if its is in corn) of a scheduled item?
List data for Singol Item:
Entire scheduled Items:
Thank you so much.
I can start building my web interface to my contrail heating system now.
Just in time for winter.
I spoke too soon.
1)The output seams to be a JSON file is this correct?
2) I am having problems opening it, how do you open it I am trying to get the name and Corn info out.
I can display it in a browser ok but not in code.
Found a good working example for JSON here: