Evohome actions scheduling

This is mostrly a UI ‘problem’ with Evohome (or any other thing that could need a schedule)
As most of ‘modern’ thermostat Evohome got Presets (Normal, away, off, and so on) that set custom or predefined programs. For example Normal will follow the schedule saved in the system, away will set all the rooms to 15° and so on.
the main Evohome controller allow to set the preset in 2 ways: permanent or for a certain amount of time; but the amount of time can be set only in days. For example if the weekend i leave the house i set it as away but i can only choose until sunday (that means saturday at midnight) or monday (that means sunday at midnight) to revert to normal. This way on sunday on my way home i have to manually revert. Also using ifttt is not flexible in date, only allowing me to choose for how many days without specifying hours.
in ifttt i made some buttons (away from friday, away from satuday and so on) and i can easily replicate them in OH2, and make them even better (a button to set away long weekend that reverts at 5pm on sunday); this is my first part, a list of button to set fast action.
Since OH2 can handle timer, cron, scheduling i wanted to set an interface that allow me to choose Mode and then Weekday, Hour and Minute to revert, but i can’t come up with a usable one.
Any suggestion? would you add a button to confirm? or just the fact that day+hour+minute are undefined would suffice?

I think it should certainly be do-able using a timer. What exactly is the issue you are having? You could trigger a rule which (a) cancels any existing timers and then (b) creates a new timer, on selection of a given mode. That way, no button to confirm is required.

1 Like

Search the forum for “alarm clock” and you should find postings that will contain everything you need to get this to work.

1 Like

@smar im not having any issue, im just looking fo some UI suggestion to make a compact a usable date selector

@rlkoshak i saw that post (and i got inspired by it on making an alarm clock too) but the UI its really clumsy, it is a pity that OH do not have a built in date/time selector for sitemap

Yes it is

1 Like

I can’t really get out of if; i mean, in theory it’s possible to make a date/time picker in UI, for example usign “Selction” for day of the week, day, month and maybe a setpoint for hour and minute; it can be also possibile to preset these date (if not in use by a scheduler) to match the current date and time.
The pain become when changing some value and keep the rest sinchronized; there are lots of rules in a calendar, for example if i change day or month i have to calculate the new day of week; if i choose february i can’t choose day 29/30/30, but if it is a leap year 29 is allowed; if i am on jan 31 and i change month to april day should move to 30. (anyway, can i add and remove values from selection at runtimes?)
it seems a lot of intricate work to me, especially for a basic thing that should be included (im not complaining, just thinking and trying to find a path)
so… any suggestion o usable way to select a date/time with the minimun number of click and no incoherence, will be really appreciated!

You are absolutely right. A DateTime Selector is in fact REALLY complicated which is why no one has yet to step up to implement one. It is even more complex than the problems you list. How does one schedule something to repeat (e.g. first Friday of every month?) What about something that only repeates for a short period of time?

Because it is so complicated, I highly recommend using something that already implements all the complexities. Use a Calendar for scheduling things and use the CalDav binding to trigger OH events based on calendar entries. I believe there is also a GCal binding for Google Calendar but I don’t think much is being done with it in favor of the CalDav binding.

Uness and until someone takes it upon themselves to implement all the server side and client side work (to include the Android and iPhone apps) necessary to implement a full calendaring system (because that is what it would take) we won’t have have this feature.

If it were easy someone would have implemented it already.

thank you @rlkoshak
another problem is that if i need more scheduler (light, heating and so on) i have to duplicate the code or make it a way it can read variable; if it was a builtin item or sitemap object adding it would be a matter of writing

DateTime mydate include=[DayOfWeek, Day, Month, Year, Hour, Minutes]

I thought about caldav with gcalendar or any other calendar, but if i have to use and extarnal app to set the schedule, i can continue to use the honeywell official app (or the propretary wall panel, or the ifttt button i made)
i am trying to code a basic date time selector, with just the date and time pick up, no scheduling rules or else (and for sure i will share here when ready) but i am already facing problem (im a totally beginner in java based language): for example

now.dayOfWeek

return the current day of week, but what if instead of now i want the DayOfWeek of a arbitrary date?
Since my schedule would start the event immediately (if the date and event is set) and stop it at date, ho can a calculate difference between the dates?
it looks i make a lot of questions, but in next days i can make more, im waiting fot a knx/ip gateway so i can connect the rest of the house to OH :slight_smile:

Honestly, that will probably be a more satisfactory solution in the end.

Here is a piece I don’t think you realize. Date Times in computers are absolute. Under all the covers, the date time is represented as the number of milliseconds since midnight January 1, 1970 (called epoch). There is no way to represent “10:08 am” in a Date Time (be it a DateTimeType or a DateTime). You can only represent “10:08:23.123 June 6, 2018”.

So you HAVE to deal with scheduling and rescheuling and such or else you will have to manually go to your sitemap every day and change the DateTime to the new time for TODAY.

now.plusDays(arbitraryNumberOfDays).dayOfWeek
new DateTime("2007-03-01T13:00:00Z") // ISO 8601 date time format

Convert them to epoch, subtract the milliseconds from each other, then use divide and modulo arithmatic to convert the milliseconds back into days, hours, minutes, seconds, milliseconds. Note that you can’t do this with the DateTime Objects themselves because they represent an absolutely point in time, not a quantity of time.

Like I said, this is complicated stuff.

My use case is far more simple
this is how it works in the app (and appliance wall mounted system)
the heating system have a program that follow (and this is already programmed and i dont usually change it, at least i did not change it in the last two years after some minor adjustment at the beginning), also it has other pretermined program (like OFF or ECO) that (still via app or system) can be set permanently or until a date (actually the app and system dont allow to set a time too).
One of the real scenarios that happen is that often i leave on friday and saturday and i get back on sunday (sometimes monday); so before leaving i set the system to mode AWAY (all the temperatures set to 15°) and i choose as revert date the nex monday (so that sunday at midnight it revert to NORMAL), if i get back home before midnight i have to revert to normal manually.

My idea is to have 6 selectors (day of week, day and so on) to choose a date time, and a switch to choose the mode; once i choose the date and the mode, the heating is set to the corresponding mode, a timer is started for the miutes from now and the choosen date; when the timer end a command i sent to to heating to get back to normal, the timer is set to null. Every day at midnight, if the timer is null, the date selector is updated to the current day (so that when i open the app in that view, it will show today)

So im not making a scheduler to be honest, im just giving an expiration date to a sendCommad.
In any case even a basic datetime picker need lot of conding

Still in the subject but slightly unrelated.
One of the reasons it is so complicated is because dates don’t make sense.
Time is OK. You can count it in clock ticks or seconds. The minutes, hours days are just complicated multiples.
But dates are just silly. They depend on arbitrary rules made from a rock orbiting a star. And not very regularly at that. To compound the problem, several civilizations had a go at it and we have ended up with a mismatch of lunar periods intersected with a solar year but not aligned. As a result we have months of different length and even irregular years.

Go figure

So why not use presence detection to drive this and avoid manual intervention entirely?

That is the essence of the alarm clock UIs and Rules.

Almsot the alarm clock, but here i also need to set non only day of week and time but also month and month number, i can stay away for more than a week, so its not enough to set only sunday, i need to specify month and day
so i have to write some more rules on changing the various date to keep the coherent

At the moment presence is not valid option, there are too many variables that are not pattern (not every friday i leave for the weekend, but i can leave for the night, so i dont go AWAY)

i will work on it next days

i already prototyped it in PHP, but the rules coding it’s still a it obscure (and i dont know every and all functions!)

But it is all just more of the same.

It depends. There are lots of pieces of evidence that can be used to control this.

  • been away from home for more than 8 hours
  • location is beyond a certain distance from home

It may not be possible but I always like to push users to think beyond just remote controlling into fully automated.

So would it work to just set the number of days instead of the end date?

You are against using a third party app yet are coding your own third party app?

Set up VSCode with the openHAB extension, start to type something and it will pop up a list of all the valid ways to complete the statement. For example:

image

i am trying to define patterns of my presence, also being in italy we have weird rules on how and wehn we can keep heating on

this could also be a simplified solution, another suggestion i got is also using Astro, to revert heating on sunday at sunset; i can probaly go for a mixin, choosing number of days and le t Astro choose the hour (i have a centralized heating and consider that in my region italy you cant switch on only 6 huours per day on predefined window, so if i switch my heating on outside these window it wont heat!)

im just laying down rules for keeping days and day of week in sync with a language i know

im working on it! Thank you

Still fighting with dates;
i simplified all my workflow to set the schedule ovveride, now i just set the status, for how many days and the revert time; for example a talking rule can be “set away for two days until 6pm”
and now i have:
the timestamp of now
the iso date of now
a number with days to add
a number with hour
a number with minutes

how can i transform the target date (today+Xday at YY:ZZ) and then to millisecond so i can calculate the difference in minutes to start a timer?

i can’t really get out of it using the rules code :frowning:

Timers do not work with amounts of time. A Timer is scheduled to run at a specific DateTime. So you don’t even need to do this.

Just:

timer = createTimer(now.plusDays(days).plusHours(hours).plusMinutes(mins), [ |
    // code to execute days, hours, minutes from now)
])
1 Like

Found it
i had to add
withTimeAtStartOfDay
before adding day, hours and so… i was totally unaware of this until i opened my rules file in designer

Thank you again!

Don’t use ESH Designer. It is woefully out of date and end of life. Use VSCode for accurate and up to date syntax checking.

1 Like