Good Morning, Afternoon, and Evening

maybe you can Change var Time="" to var String Time = "" (or even set the string to a " " (SPACE) ).

If used with the (SPACE) don’t Forget to Change your if-clause…

Andreas

Odd.

What time did you check? Was it really 19 minutes after midnight?

I think there might be an edge case when the time switches over midnight.

change the last if statement to

if(now.isAfter(nightStart) || now.isBefore(morningStart)) time = "Good Night"

Alternately, initialize time to vTimeOfDay.state.toString.

var time = vTimeOfDay.state.toString

Either approach will handle the transition over midnight. Keep in mind though that for the latter option, nightStart must be before midnight or else I don’t think it will work.

Well this doesn’t look right… :confused:

image

Is there a trigger on the Rule to cause it to run at 12:00 pm?

If yes, did the Rule actually run?

If yes, what was logged out for the start times and current times?

So there was no trigger at 12:00noon, but at 11:00am

when
    System started or
    Time cron "0 0 6 * * ? *" or
    Time cron "0 0 11 * * ? *" or
    Time cron "0 0 18 * * ? *" or
    Time cron "0 0 23 * * ? *"

Log shows the following at 11am

2018-09-19 11:00:00.004 [INFO ] [.eclipse.smarthome.model.script.time] - Time calculations:
 moringStart = 2018-09-19T06:00:00.000-05:00
 afternoonStart = 2018-09-19T12:00:00.000-05:00
 eveningStart = 2018-09-19T18:00:00.000-05:00
 nightStart = 2018-09-19T23:00:00.000-05:00
 now = 2018-09-19T11:00:00.004-05:00
 time = Good Morning

And at 11am, it should be good morning…and afternoonStart shows to start at 12:00 which is correct…it just doesn’t seem to update.

You need a trigger to occur at the start of each time period. If you have a trigger at 11 but afternoonStart doesn’t start until 12 then when the Rule triggers it is still morning.

The start times and the Rule triggers must match. Since the rule doesn’t trigger at/after 12 it never runs when it is afternoon.

Ok.

Will update the CHRON calls and watch what happens.

Squid