Rollershutter rule with astro-binding not working every day

Hi, i´m on oh 2.4 snapshot #1336, but this problem is since a long time:

My rollershutter/blinds should open in the morning, when astro binding sends a command:

// Rollos morgens Astro hoch
rule "Rollos Astro hoch"
when
    Channel 'astro:sun:home-offset:rise#event' triggered START
then
   Rollos_is_day.sendCommand(ON)
...

This works most of the time. But maybe 1 or 2 days in the week, this doesn´t work. So i implemented this into a rule:

...
else if (Rollos_is_day.state != ON) {
			if (now.isAfter((Rollos_up_time.state as DateTimeType).zonedDateTime.toInstant.toEpochMilli)) {
            		logInfo("Rollosteuerung", "--- 2 --- Achtung !!! - Fehler --- Rollos hätten jetzt hochfahren müssen --- Rollos Auffahrzeit bereits erreicht: " + Rollos_up_time.state)
			Rollos_is_day.sendCommand(ON)
...

So when the first rule is not working, i get an information to the logfile and the second rule opens the blinds. This is working without problems.

But it would be better, when i don´t have to use a helper rule to eliminate an error of openhab/astro-binding. So in my case, astro binding is not usable standalone, when i can´t be sure this will fire a rule.

Sometimes it works a day, then the next days it doesn´t work and the day after that it works again - even without service restart.

Sometimes i make a openhab serive restart, then it will work the next day again, but sometimes this doen´t help and it will not work again on the next day.

Hello @halloween

could you please elaborate a bit more about which roller shutters you are using, how you are communicating with them (Z-Wave, RFX, …) so we can figure out where the root cause of your problem is. I have similar rules to yours and I never have problems, except for some rollershutter that is just at the edge of the range of my RFX controller so the radio signal does not arrive there always.

I have wired rollershutters with knx actuators. This works 100%.

The problem is not triggering or not seeing the trigger “sunrise start”.

I have a proxy switch between, and this switch is not switched to on --> so i can totally exclude the wiring side of my shutters.

Switch Rollos_is_day is my proxy item. When this switch changes to on, another rule sends the driving commands to the shutters. When i manually switch it to on, then it works. And in the cases, the astro-rule isn´t working, the switch is still off, when it is day outside already.

You should not look for errors in the astro binding: I am using the same trigger and it works every day without any problems.

But where should i look? The wiring side of my shutters is not the problems, because the proxy item isn´t switched to on.

So my openhab sometimes doesn´t see the trigger START at sunrise.

EDIT:
This is giving me the correct time, even if the trigger START was not received from my rule:

DateTime	Rollos_up_time			"Rollos Astro hoch [%1$tH:%1$tM]"	<sunrise>		(gAstro)		{ channel="astro:sun:home-offset:rise#start" }

Put two logInfos around the ON command so you can see if the astro is not triggering or the switch is not commanded to ON.

See my edit in the posting above also.

I already have a logInfo “after” the proxy-item-sendCommand and today this logInfo is not in my openhab.log.

Yes, but surrounded by an IF. Just add a plain logInfo …

No, this is the complete rule:

// Rollos morgens Astro hoch - wenn nach xx Uhr
rule "Rollos Astro hoch"
when
    Channel 'astro:sun:home-offset:rise#event' triggered START
then
	Rollos_is_day.sendCommand(ON)
	Thread::sleep(500) // give persistence time to catch up
	logInfo("Rollosteuerung", "morgens vor oder nach 6:45 SunriseLimit: " + SunriseLimit.state + " Rollos is day: " + Rollos_is_day.state)
        if (SunriseLimit.state == ON) {
        	Rollos_Nachtstellung.sendCommand(OFF)
        }
end

Every day i get a logInfo at the time of the sunrise.

But today there was no such logInfo. Today i got the error again. Yesterday i got the logInfo at about 6 a.m. and the rollershutters opened like they should do.

I can add another logInfo as first command in the rule, but i think, this wouldn´t tell us anything new…

(I have added a thread:sleep. Without this, i get the old switch state of Rollo_is_day in my logInfo. With this Thread::sleep, i get the new state (ON) in the logInfo.)

Around midnight (for me about 30 seconds after) in your Rules do you see log statements that say “Scheduled Astro event-jobs for thing astro:sun:home-offset”? Particularly do you see these on the nights before the Rule doesn’t trigger?

Did this start recently or has it been a problem for a long time?

Do you have any DateTime Item’s linked to this Thing? Do you see in events.log that these Items are updated around midnight on the days where the Rule fails to trigger?

I’m trying to narrow the problem down to:

  • is Astro failing to schedule the event?
  • is Astro failing to generate the event?
  • is the Rule failing to trigger on the event?

I have a datetime item with the same event, see my post above.

When the trigger at sunrise fails, then my helper-rule will do the job with comparing now to this datetime. This works everytime, when the first rule failed.

This happens every now and then since a long time. Sometimes 1 time in a month, sometimes 2 times a week.

You are right:

Today the rule failed, i only got this at midnight:

2018-08-23 00:00:30.016 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:moon:home
2018-08-23 00:00:30.018 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:home

Yesterday the rule fired correctly, i got this at midnight:

2018-08-22 00:00:30.033 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:home
2018-08-22 00:00:30.057 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:moon:home
2018-08-22 00:00:30.112 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:home-offset

OK, this does point to a problem with the Astro binding. Please file an issue. Astro lives over on the Eclipse Smarthome project so file the issue here. Search first to make sure someone hasn’t already filed an issue.

The specific issue is that sometimes the event doesn’t get scheduled for all your Astro Things.

Do you happen to have any old logs around you could use to maybe figure out when it started to become a problem, or is this a relatively new Thing and you are just noticing this problem now?

It will help the devs figure out what may have changed to know when the problem started.

I can think of several work arounds but you already have a good one so I wouldn’t worry too much about alternatives.

Here it is:

2 Likes

The last few days i got the error again.

Is there a way to do a rescheduling with a openhab rule, like it is at 00:00:30 (30 seconds after midnight)?

I can check on some times before sunset, if all 3 astro things are working. If no, then make a reschedule.

You could try restarting the binding:

But I would look for the actual cause of your problem. My three astro things are working without any issues on 2.4 snapshot release.

I already opened an issue at github.

The 3rd astro thing is exactly like the other two, only another name and a location with 2 degrees difference to my place.

Working most of the time. It worked the last 2 weeks very good. But today i got a entry in my log (i have some logging to check this), that it has not worked.

You can write a Rule to touch the .items file and I think that will cause Astro to reschedule the events. If not you could define your Astro Things in a .things file and touch that which I know will cause the events to be rescheduled.

You can create your own Timers based on the Astro Action and use a System started/cron triggered Rule to create your own Timers instead of relying on Astro.

Those are the only ideas I have beyond restarting the binding.