New earliest/latest channel features not working in Astro2 binding

Hello!
On a new computer, installed Ubuntu.
Installed openhab2.
The paperUI installed an addon - Astro.
In the paperUI, I added a thing Local Sun.
Added the file /etc/openhab2/items/astro.items
Restarted openHab2 several times.
As a result, I got 3 types of log:
1.

2017-03-24 23:03:25.482 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.items'
2017-03-24 23:03:34.062 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-03-24 23:03:34.870 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-03-24 23:03:35.105 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-03-24 23:03:35.297 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-03-24 23:03:38.384 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-03-24 23:03:38.399 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:local
2017-03-24 23:03:38.731 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:sun:local

2017-03-24 22:43:13.680 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.items'
2017-03-24 22:43:22.437 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-03-24 22:43:23.232 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-03-24 22:43:23.429 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-03-24 22:43:23.671 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-03-24 22:43:26.703 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-03-24 22:43:26.716 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:local
2017-03-24 22:43:26.741 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-03-24 22:43:26.746 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:local
2017-03-24 22:43:27.139 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:sun:local
2017-03-24 22:43:27.143 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:sun:local
2017-03-24 22:47:42.889 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.items'
2017-03-24 22:47:51.239 [INFO ] [.dashboard.internal.DashboardService] - Started dashboard at /start
2017-03-24 22:47:51.919 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2017-03-24 22:47:52.018 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2017-03-24 22:47:52.271 [INFO ] [panel.internal.HABPanelDashboardTile] - Started HABPanel at /habpanel
2017-03-24 22:47:55.452 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-03-24 22:47:55.466 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:local
2017-03-24 22:47:55.478 [ERROR] [ding.astro.handler.AstroThingHandler] - Unable to store Job : 'astro:sun:local.job-daily-sun', because one already exists with this identification.
org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'astro:sun:local.job-daily-sun', because one already exists with this identification.
	at org.quartz.simpl.RAMJobStore.storeJob(RAMJobStore.java:279)[105:org.eclipse.smarthome.core.scheduler:0.9.0.201703201701]
	at org.quartz.simpl.RAMJobStore.storeJobAndTrigger(RAMJobStore.java:251)[105:org.eclipse.smarthome.core.scheduler:0.9.0.201703201701]
	at org.quartz.core.QuartzScheduler.scheduleJob(QuartzScheduler.java:886)[105:org.eclipse.smarthome.core.scheduler:0.9.0.201703201701]
	at org.quartz.impl.StdScheduler.scheduleJob(StdScheduler.java:249)[105:org.eclipse.smarthome.core.scheduler:0.9.0.201703201701]
	at org.openhab.binding.astro.handler.AstroThingHandler$1.run(AstroThingHandler.java:204)[182:org.openhab.binding.astro:2.1.0.201703240758]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_121]
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)[:1.8.0_121]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_121]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_121]
	at java.lang.Thread.run(Thread.java:745)[:1.8.0_121]
2017-03-24 22:47:55.755 [INFO ] [.astro.internal.job.AbstractDailyJob] - Scheduled astro event-jobs for thing astro:sun:local

This is a clean OS installation and a clean installation of OpenHAB2,
Except astro addons and astro.items did not add anything.
I do not understand what Iā€™m doing wrong ā€¦

Last idea: are you using Oracle Java? Iā€™ve read several times, that with OpenJDK java there could be some issues ā€¦
Also make sure you are using Oracle Java later than 1.8.0_101.

java version ā€œ1.8.0_121ā€
Javaā„¢ SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpotā„¢ 64-Bit Server VM (build 25.121-b13, mixed mode)

Hello all,

I am swItching to Openhab2, and trying to set up the new Astro binding. And Iā€™m having problems with earliest/latest and offset channel features.

I want to have two DateTime items - Civil_Dawn_End_Offset_Time and Civil_Dusk_Start_Offset_Time, which will store the following:

  • Civil_Dawn_End_Offset_Time - Civil Dawn end time, but moved forward by 180 minutes (offset), and having earliest time limit of 10:00;

  • Civil_Dusk_Start_Offset_Time - Civil Dusk start time, but having latest time limit of 19:00

I didnā€™t find out how to do it via PaperUI, because there is no way to configure earliest/latest for Start/End time, so I switched to text-based configuration. Iā€™ve created an ā€œastro.thingsā€ file in ā€œ/etc/openhab2/thingsā€ directory with the following content (following examples in Documentation):

astro:sun:localoffset [ geolocation="55.677585,37.630706", interval=60 ] {
    Channels:
        Type start : civilDusk#start [
            latest="19:00"
        ]
        Type end : civilDawn#end [
            offset=180,
            earliest="10:00"
        ]
}

and linked my two items in the ā€œhome.itemsā€ file with these channels:

DateTime Civil_Dawn_End_Offset_Time        "Civil Dawn End Offset Time [%1$tH:%1$tM]"                     (Home)                     {channel="astro:sun:localoffset:civilDawn#end"}
DateTime Civil_Dusk_Start_Offset_Time      "Civil Dusk Start Offset Time [%1$tH:%1$tM]"                   (Home)                     {channel="astro:sun:localoffset:civilDusk#start"}

The real Civil Dawn end time and Civil Dusk start time in my location are 04:39 and 20:16 respectively, so Iā€™m expecting my items to have values ā€œ10:00ā€ (as 04:39 + 180 mins = 07:39 is earlier than 10:00), and ā€œ19:00ā€ (as 20:16 is later than 19:00) respectively, but in fact my items are getting values 04:39 and 20:16, so neither offset nor earliest/latest is applied. Moreover, item Civil_Dawn_End_Offset_Time has somehow duplicated, but with another label (ā€œEnd Timeā€), despite I havenā€™t created any items in UI, and donā€™t have such an item in any of my ā€œ.itemsā€ files:

openhab> smarthome:items list *Offset*
Civil_Dawn_End_Offset_Time (Type=DateTimeItem, State=2017-05-05T04:39:00.000+0300, Label=Civil Dawn End Offset Time, Category=null, Groups=[Home])
Civil_Dusk_Start_Offset_Time (Type=DateTimeItem, State=2017-05-05T20:16:00.000+0300, Label=Civil Dusk Start Offset Time, Category=null, Groups=[Home])
Civil_Dawn_End_Offset_Time (Type=DateTimeItem, State=2017-05-05T04:39:00.000+0300, Label=End time, Category=null)

The same is in UI:

What am I doing wrong, and how can I achieve my goal?

From your screenshot it looks like you are not using the latest binding version.
You are missing the option button, it should look like this:

Hmm, Iā€™ve installed this binding by adding ā€œastroā€ to the ā€œbindingā€ string into /etc/openhab2/services/addons.cfg file. Here is the version:

openhab-binding-astro | 2.0.0 | x | Started | addons-2.0.0 | Astro Binding

How can I upgrade it?

It can be tricky to use snapshot bindings in stable runtime releases. Sometimes it is easier to change from stable to snapshot completely.

But if you want to try it:

Remove the entry from your addons.cfg, make sure the binding is uninstalled, download the snapshot binding, put it in your addons folder, you may need to start the binding manually through karaf, make sure the binding is active ā€¦ enjoy the new functionality :slight_smile:

Hi, sorry, canā€™t find where I can download the snapshot Astro binding.

The Astro binding has been moved to Eclipse Smarthome:

Unfortunately I have no idea where to find pre-compiled jarā€™s at that place ā€¦ :sunglasses:

@roher: Did you get it working? Or does anyone else know how to get a DateTime Item that shows the ā€œrealā€ DateTime with offset and/or earliest/latest in a sitemap?

The Range event triggers your rules, the Start time and End time shows the ā€œrealā€ DateTime when linked to a DateTime item. You just need to use the same offset and earliest/latest as in the Range event Channel.

@sihui: Thanks a lot for your answer, do not know I fully got you, mabye you can post a tiny example?

Range event channel:

End time channel:

and that End time channel is linked to a DateTime item on the sitemap:

@sihui: Thanks for your help, I will give it a try as soon as possible!