New earliest/latest channel features not working in Astro2 binding

I did so, information is very much, I do not understand what is happening there, my knowledge is not enough to understand this :frowning:
I deleted openHAB2 completely (http://docs.openhab.org/installation/linux.html#uninstall).
I installed it again - Build #850 (http://docs.openhab.org/installation/linux.html#installation).

The paperUI installed an addon - Astro.
In the paperUI, I added a thing Local Sun.
Added the file /etc/openhab2/items/astro.items
Restarted openHAB - no errors.
I restarted again - errors.
Here are the statistics of ten restarts:
No errors: 1,4,8,9
Errors: 2,3,5,6,7,10

From what you have done so far the problem can only be in your items file.
For testing, set up everything through PaperUI, don’t use any manually created items files and see if you still get that error (I guess not, because otherwise I would have that error too).

Group gAstro

Number		sun_elevation	"elevation [%.2f °]"						<sun>		(gAstro)	{ channel="astro:sun:local:position#elevation" }
DateTime	sun_astrodawn	"astrodawn[%1$tH:%1$tM]"					<sunrise>	(gAstro)	{ channel="astro:sun:local:astroDawn#start" }
DateTime	sun_rise		"rise[%1$tH:%1$tM]"							<sunrise>	(gAstro)	{ channel="astro:sun:local:rise#start" }
DateTime	sun_noon		"noon[%1$tH:%1$tM]"							<sun>		(gAstro)	{ channel="astro:sun:local:noon#start" }
DateTime	sun_set			"set[%1$tH:%1$tM]"							<sunset>	(gAstro)	{ channel="astro:sun:local:set#start" }
DateTime	sun_night		"night[%1$tH:%1$tM]"						<moon>		(gAstro)	{ channel="astro:sun:local:night#start" }

String		season_name		"season_name [MAP(season.map):%s]"						(gAstro)	{ channel="astro:sun:local:season#name" }
DateTime	season_spring	"spring [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"	<rain>		(gAstro)	{ channel="astro:sun:local:season#spring" }
DateTime	season_summer	"summer [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"	<garden>	(gAstro)	{ channel="astro:sun:local:season#summer" }
DateTime	season_autumn	"autumn [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"	<wind>		(gAstro)	{ channel="astro:sun:local:season#autumn" }
DateTime	season_winter	"winter [%1$td.%1$tm.%1$tY %1$tH:%1$tM]"	<climate-on>(gAstro)	{ channel="astro:sun:local:season#winter" }

Thank you! I’ll try, I’ll tell you the result.

… and do an upload of that file somewhere so we can take a look at it, e.g. pastebin or whatever service you prefer.

I cannot see any wrong syntax in your items file, the only problem is the missing space between <climate-on>(gAstro), but I guess that is a copy/paste problem …

Yes it is!

[quote=“Olymp, post:19, topic:24981, full:true”]
https://mega.nz/#!9ZkGAQ5L!LRqSCNTEggOfNUg3dgs7-vEocRY0gSPb1MX0Yl4_ii4[/quote]

Sorry, no idea why the jobs are loading twice. I extracted the relevant astro lines, maybe another user is able to find the solution for an Ubuntu system.

2017-03-26 08:58:16.078 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'sun_elevation (Type=NumberItem, State=NULL, Label=Elevation, Category=sun)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.084 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'sun_astrodawn (Type=DateTimeItem, State=NULL, Label=AstroDawn, Category=sunrise)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.086 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'sun_rise (Type=DateTimeItem, State=NULL, Label=SunRise, Category=sunrise)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.089 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'sun_noon (Type=DateTimeItem, State=NULL, Label=Noon, Category=sun)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.091 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'sun_set (Type=DateTimeItem, State=NULL, Label=SunSet, Category=sunset)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.094 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'sun_night (Type=DateTimeItem, State=NULL, Label=Night, Category=moon)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.097 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'season_name (Type=StringItem, State=NULL, Label=Season name, Category=null)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.100 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'season_spring (Type=DateTimeItem, State=NULL, Label=Spring, Category=rain)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.102 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'season_summer (Type=DateTimeItem, State=NULL, Label=Summer, Category=garden)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.106 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'season_autumn (Type=DateTimeItem, State=NULL, Label=Autumn, Category=wind)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:16.109 [DEBUG] [el.item.internal.GenericItemProvider] - Start processing binding configuration of Item 'season_winter (Type=DateTimeItem, State=NULL, Label=Winter, Category=climate-on)' with 'GenericItemChannelLinkProvider' reader.
2017-03-26 08:58:17.127 [DEBUG] [ome.core.thing.internal.ThingManager] - Thing 'astro:sun:local' is tracked by ThingManager.
2017-03-26 08:58:17.128 [DEBUG] [ome.core.thing.internal.ThingManager] - Not registering a handler at this point since no handler factory for thing 'astro:sun:local' found.
2017-03-26 08:58:20.964 [DEBUG] [ome.core.thing.internal.ThingManager] - Thing handler factory 'AstroHandlerFactory' added
2017-03-26 08:58:20.966 [DEBUG] [nfig.core.BundleProcessorVetoManager] - Meta-data of bundle 'org.openhab.binding.astro' is not fully loaded ([org.eclipse.smarthome.config.xml.osgi.XmlDocumentBundleTracker$1@5eccced9(/ESH-INF/thing/)]), deferring action for 'org.eclipse.smarthome.core.thing.internal.ThingImpl@dc6e3bbb'
2017-03-26 08:58:21.345 [DEBUG] [nfig.core.BundleProcessorVetoManager] - Finished loading meta-data of bundle 'org.openhab.binding.astro'.
2017-03-26 08:58:21.348 [DEBUG] [ome.core.thing.internal.ThingManager] - Calling 'AstroHandlerFactory.registerHandler()' for thing 'astro:sun:local'.
2017-03-26 08:58:21.350 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created scheduled thread pool 'thingHandler' of size 3
2017-03-26 08:58:21.499 [DEBUG] [nfig.core.BundleProcessorVetoManager] - Finished loading meta-data of bundle 'org.openhab.binding.astro'.
2017-03-26 08:58:21.500 [DEBUG] [ome.core.thing.internal.ThingManager] - Calling initialize handler for thing 'astro:sun:local' at 'org.openhab.binding.astro.handler.SunHandler@5fa053ce'.
2017-03-26 08:58:21.533 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (String) xxxxxxx,yyyyyyy to field 'geolocation' in configuration class org.openhab.binding.astro.internal.config.AstroThingConfig
2017-03-26 08:58:21.609 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 300 to field 'interval' in configuration class org.openhab.binding.astro.internal.config.AstroThingConfig
2017-03-26 08:58:23.777 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-03-26 08:58:23.795 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:local
2017-03-26 08:58:23.818 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-daily-sun at midnight for thing astro:sun:local
2017-03-26 08:58:23.821 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled astro job-positional with interval of 300 seconds for thing astro:sun:local
2017-03-26 08:58:24.043 [DEBUG] [rthome.core.common.ThreadPoolManager] - Created thread pool 'items' with size 5
2017-03-26 08:58:24.222 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 0 to field 'offset' in configuration class org.openhab.binding.astro.internal.config.AstroChannelConfig
2017-03-26 08:58:24.225 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 0 to field 'offset' in configuration class org.openhab.binding.astro.internal.config.AstroChannelConfig
2017-03-26 08:58:24.227 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 0 to field 'offset' in configuration class org.openhab.binding.astro.internal.config.AstroChannelConfig
2017-03-26 08:58:24.230 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 0 to field 'offset' in configuration class org.openhab.binding.astro.internal.config.AstroChannelConfig
2017-03-26 08:58:24.233 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 0 to field 'offset' in configuration class org.openhab.binding.astro.internal.config.AstroChannelConfig
2017-03-26 08:58:24.241 [DEBUG] [.smarthome.config.core.Configuration] - Setting value (Integer) 0 to field 'offset' in configuration class org.openhab.binding.astro.internal.config.AstroChannelConfig
2017-03-26 08:58:24.247 [ERROR] [.astro.internal.job.AbstractDailyJob] - Unable to store Job : 'astro:sun:local.job-event-start-set#event', because one already exists with this identification.
org.quartz.ObjectAlreadyExistsException: Unable to store Job : 'astro:sun:local.job-event-start-set#event', 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.internal.job.AbstractDailyJob.schedule(AbstractDailyJob.java:105)[179:org.openhab.binding.astro:2.1.0.201703251201]
	at org.openhab.binding.astro.internal.job.AbstractDailyJob.scheduleEvent(AbstractDailyJob.java:72)[179:org.openhab.binding.astro:2.1.0.201703251201]
	at org.openhab.binding.astro.internal.job.AbstractDailyJob.scheduleRange(AbstractDailyJob.java:58)[179:org.openhab.binding.astro:2.1.0.201703251201]
	at org.openhab.binding.astro.internal.job.DailyJobSun.schedulePlanetEvents(DailyJobSun.java:33)[179:org.openhab.binding.astro:2.1.0.201703251201]
	at org.openhab.binding.astro.internal.job.AbstractDailyJob.executeJob(AbstractDailyJob.java:47)[179:org.openhab.binding.astro:2.1.0.201703251201]
	at org.openhab.binding.astro.internal.job.AbstractBaseJob.execute(AbstractBaseJob.java:40)[179:org.openhab.binding.astro:2.1.0.201703251201]
	at org.quartz.core.JobRunShell.run(JobRunShell.java:202)[105:org.eclipse.smarthome.core.scheduler:0.9.0.201703201701]
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573)[105:org.eclipse.smarthome.core.scheduler:0.9.0.201703201701]

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!