Astro:sun:night#start channel UNDEF and others too

Hi,

I use astro configuration from here`.

Starting from 2019-05-19 I have problem with astro binding. Some of events on channel are undefined.

majherek@atom:/opt/openhab/userdata/logs$ grep "Rule 'Generate Time of Day Events'" openhab.log|head
2019-05-19 00:00:48.865 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Generate Time of Day Events': Could not cast UNDEF to org.eclipse.smarthome.core.library.types.DateTimeType; line 66, column 27, length 37
2019-05-19 00:01:48.863 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Generate Time of Day Events': Could not cast UNDEF to org.eclipse.smarthome.core.library.types.DateTimeType; line 66, column 27, length 37
2019-05-19 00:02:48.865 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Generate Time of Day Events': Could not cast UNDEF to org.eclipse.smarthome.core.library.types.DateTimeType; line 66, column 27, length 37
2019-05-19 00:03:48.863 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Generate Time of Day Events': Could not cast UNDEF to org.eclipse.smarthome.core.library.types.DateTimeType; line 66, column 27, length 37

Line 66 is night:

rule "Generate Time of Day Events"
when
    Item CurrentDateTime received update
then
    val now = new Date()
    val dawn = new Date((CivilDawnStart_Time.state as DateTimeType).calendar.timeInMillis)
    val day = new Date((DayStart_Time.state as DateTimeType).calendar.timeInMillis)
    val dusk = new Date((CivilDuskStart_Time.state as DateTimeType).calendar.timeInMillis)
    val night = new Date((NightStart_Time.state as DateTimeType).calendar.timeInMillis)
    val sunset = new Date((SunsetStart_Time.state as DateTimeType).calendar.timeInMillis)
    val sunrise = new Date((SunriseStart_Time.state as DateTimeType).calendar.timeInMillis)

I have several items with UNDEF value:

openhab> smarthome:items list |grep -i gAstro|grep UNDEF
EveningNightStart_Time (Type=DateTimeItem, State=UNDEF, Label=Początek wieczornej części nocy, Category=moon, Groups=[gAstro])
NightStop_Time (Type=DateTimeItem, State=UNDEF, Label=Koniec nocy, Category=moon, Groups=[gAstro])
EveningNightStop_Time (Type=DateTimeItem, State=UNDEF, Label=Koniec wieczornej części nocy, Category=moon, Groups=[gAstro])
AstroDawnStart_Time (Type=DateTimeItem, State=UNDEF, Label=Początek świtu astronomicznego, Category=sunrise, Groups=[gAstro])
AstroDuskStop_Time (Type=DateTimeItem, State=UNDEF, Label=Koniec zmierzchu astronomicznego, Category=sunset, Groups=[gAstro])
MorningNightStart_Time (Type=DateTimeItem, State=UNDEF, Label=Początek porannej części nocy, Category=moon, Groups=[gAstro])
NightStart_Time (Type=DateTimeItem, State=UNDEF, Label=Początek nocy, Category=moon, Groups=[gAstro])
MorningNightStop_Time (Type=DateTimeItem, State=UNDEF, Label=Koniec porannej części nocy, Category=moon, Groups=[gAstro])

The problem is with Night, Astro and Dusk:

DateTime MorningNightStart_Time     "Początek porannej części nocy [%1$tH:%1$tM]"  <moon>     (gAstro) { channel="astro:sun:local:morningNight#start" }
DateTime MorningNightStop_Time      "Koniec porannej części nocy [%1$tH:%1$tM]"   <moon>     (gAstro) { channel="astro:sun:local:morningNight#end" }
DateTime NightStop_Time             "Koniec nocy [%1$tH:%1$tM]"        <moon>       (gAstro) { channel="astro:sun:local:night#end" }
DateTime NightStart_Time            "Początek nocy [%1$tH:%1$tM]"      <moon>       (gAstro) { channel="astro:sun:local:night#start" }
DateTime EveningNightStart_Time     "Początek wieczornej części nocy [%1$tH:%1$tM]"  <moon>     (gAstro) { channel="astro:sun:local:eveningNight#start" }
DateTime EveningNightStop_Time      "Koniec wieczornej części nocy [%1$tH:%1$tM]"   <moon>     (gAstro) { channel="astro:sun:local:eveningNight#end" }
DateTime AstroDuskStart_Time        "Początek zmierzchu astronomicznego [%1$tH:%1$tM]" <sunset>             (gAstro) { channel="astro:sun:local:astroDusk#start" }
DateTime AstroDawnStart_Time        "Początek świtu astronomicznego [%1$tH:%1$tM]"   <sunrise>           (gAstro) { channel="astro:sun:local:astroDawn#start" }

Can anybody tell me why the problem start appearing yesterday -> 19th od May?

I use OH 2.4 Release Build.

openhab> bundle:list |grep -i astro
223 │ Active   │  80 │ 0.10.0.oh240           │ Eclipse SmartHome Astro Binding
openhab> feature:list |grep -i astro
openhab-binding-astro1                      │ 1.13.0           │          │ Uninstalled │ openhab-addons-legacy-2.4.0 │ Astro Binding (1.x)
esh-binding-astro                           │ 0.10.0.oh240     │          │ Started     │ openhab-addons-2.4.0        │
openhab-binding-astro                       │ 2.4.0            │ x        │ Started     │ openhab-addons-2.4.0        │ Astro Binding

UNDEF is a special state which bindings will set an Item to when the binding cannot determine the proper state. Often this is when a device or connection to a bridge goes down so it has no information about the device.

A big difference between UNDEF and NULL is that Items get set to NULL by default when they are loaded but something has to explicitly set the Item to UNDEF.

The first step is to restart OH and see if there is just something odd going on that caused the binding to operate incorrectly.

Next, put the Astro binding into trace logging. Look in events.log and determine when these Items are being set to UNDEF. If it’s happening around midnight it’s probably the Astro binding that’s doing it. Check the astro logs in openhab.log around that time to see if there is something revealing.

Astro binding: org.openhab.binding.astro or something else?

I set log:set TRACE org.openhab.binding.astro and restart OH. But I doesn’t find anything else in logs than:

2019-05-20 22:57:15.847 [hingStatusInfoChangedEvent] - 'astro:sun:local' changed from UNINITIALIZED to INITIALIZING
2019-05-20 22:57:15.848 [hingStatusInfoChangedEvent] - 'astro:sun:local' changed from INITIALIZING to ONLINE
2019-05-20 22:57:15.851 [vent.ItemStateChangedEvent] - MoonAzimuth changed from 133.91684256238753 to 133.91726499918474
2019-05-20 22:57:15.852 [vent.ItemStateChangedEvent] - MoonElevation changed from 4.12301886540616 to 4.1232411477941175
2019-05-20 22:57:15.854 [vent.ItemStateChangedEvent] - SunriseStart_Time changed from NULL to 2019-05-20T04:36:00.000+0200
2019-05-20 22:57:15.855 [vent.ItemStateChangedEvent] - SunriseStop_Time changed from NULL to 2019-05-20T04:40:00.000+0200
2019-05-20 22:57:15.856 [vent.ItemStateChangedEvent] - SunsetStart_Time changed from NULL to 2019-05-20T20:29:00.000+0200
2019-05-20 22:57:15.857 [vent.ItemStateChangedEvent] - SunsetStop_Time changed from NULL to 2019-05-20T20:33:00.000+0200
2019-05-20 22:57:15.858 [vent.ItemStateChangedEvent] - NightStart_Time changed from NULL to UNDEF
2019-05-20 22:57:15.859 [vent.ItemStateChangedEvent] - NightStop_Time changed from NULL to UNDEF
2019-05-20 22:57:15.862 [vent.ItemStateChangedEvent] - MorningNightStart_Time changed from NULL to UNDEF
2019-05-20 22:57:15.864 [vent.ItemStateChangedEvent] - MorningNightStop_Time changed from NULL to UNDEF
2019-05-20 22:57:15.865 [vent.ItemStateChangedEvent] - AstroDawnStart_Time changed from NULL to UNDEF
2019-05-20 22:57:15.867 [vent.ItemStateChangedEvent] - AstroDawnStop_Time changed from NULL to 2019-05-20T02:50:00.000+0200
2019-05-20 22:57:15.868 [vent.ItemStateChangedEvent] - NauticDawnStart_Time changed from NULL to 2019-05-20T02:50:00.000+0200
2019-05-20 22:57:15.881 [vent.ItemStateChangedEvent] - NauticDawnStop_Time changed from NULL to 2019-05-20T03:52:00.000+0200
2019-05-20 22:57:15.883 [vent.ItemStateChangedEvent] - CivilDawnStart_Time changed from NULL to 2019-05-20T03:52:00.000+0200
2019-05-20 22:57:15.884 [vent.ItemStateChangedEvent] - CivilDawnStop_Time changed from NULL to 2019-05-20T04:36:00.000+0200
2019-05-20 22:57:15.887 [vent.ItemStateChangedEvent] - AstroDuskStart_Time changed from NULL to 2019-05-20T22:19:00.000+0200
2019-05-20 22:57:15.893 [vent.ItemStateChangedEvent] - AstroDuskStop_Time changed from NULL to UNDEF
2019-05-20 22:57:15.895 [vent.ItemStateChangedEvent] - NauticDuskStart_Time changed from NULL to 2019-05-20T21:17:00.000+0200
2019-05-20 22:57:15.896 [vent.ItemStateChangedEvent] - NauticDuskStop_Time changed from NULL to 2019-05-20T22:19:00.000+0200
2019-05-20 22:57:15.898 [vent.ItemStateChangedEvent] - CivilDuskStart_Time changed from NULL to 2019-05-20T20:33:00.000+0200
2019-05-20 22:57:15.899 [vent.ItemStateChangedEvent] - CivilDuskStop_Time changed from NULL to 2019-05-20T21:17:00.000+0200
2019-05-20 22:57:15.901 [vent.ItemStateChangedEvent] - EveningNightStart_Time changed from NULL to UNDEF
2019-05-20 22:57:15.902 [vent.ItemStateChangedEvent] - EveningNightStop_Time changed from NULL to UNDEF
2019-05-20 22:57:15.904 [vent.ItemStateChangedEvent] - DayStart_Time changed from NULL to 2019-05-20T04:40:00.000+0200
2019-05-20 22:57:15.905 [vent.ItemStateChangedEvent] - DayStop_Time changed from NULL to 2019-05-20T20:29:00.000+0200
2019-05-20 22:57:15.906 [vent.ItemStateChangedEvent] - SunAzimuth changed from NULL to 336.6862745671305
2019-05-20 22:57:15.907 [vent.ItemStateChangedEvent] - SunElevation changed from NULL to -14.702533547802052
2019-05-20 22:57:15.909 [vent.ItemStateChangedEvent] - ZodiacSign changed from NULL to TAURUS
2019-05-20 22:57:15.921 [vent.ItemStateChangedEvent] - Season changed from NULL to SPRING
2019-05-20 22:57:15.932 [vent.ItemStateChangedEvent] - DayPhase changed from NULL to ASTRO_DUSK

I set also org.eclipse.smarthome.binding.astro to TRACE
We will see at midnight.

I don’t think it will show much more at midnight. You can see here in events.log that it is calculating most but not all of the Astro channel pieces of data. You can see clearly that some of them it is failing and generating UNDEF.

What do you see in openhab.log?

Where do you live? At this time of year here in mid Finland nights are so short the sun won’t go “low enough” for the astro binding. I noticed same behavior few days ago when my rule threw errors.

So there is no astronomical night and that’s what UnDeff means. I suggest to handle those UnDeff values in your rule to skip part of it and set your “TimeOfDay” item to what ever suits best. For example a new state “MidsummeNight” if your night lightning depends on it.

Here’s a link to astro bindings doc mentioning UnDef:

1 Like

In openhab:

2019-05-20 22:57:15.355 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:moon:local
2019-05-20 22:57:15.363 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled Positional job astro:moon:local every 60 seconds
2019-05-20 22:57:15.547 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:local
2019-05-20 22:57:15.568 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled Positional job astro:sun:local every 60 seconds
2019-05-20 22:57:16.022 [WARN ] [mon.registry.AbstractManagedProvider] - Could not update element with key astro:sun:local in ManagedThingProvider, because it does not exists.
2019-05-20 22:57:16.023 [WARN ] [mon.registry.AbstractManagedProvider] - Could not update element with key astro:moon:local in ManagedThingProvider, because it does not exists.
[...]
2019-05-20 23:07:15.374 [DEBUG] [ding.astro.handler.AstroThingHandler] - Publishing planet Moon for thing astro:moon:local
2019-05-20 23:07:15.578 [DEBUG] [ding.astro.handler.AstroThingHandler] - Publishing planet Sun for thing astro:sun:local

The last two are repeating ones per minute.
And at midnight (because then astro is recalculating):

2019-05-21 00:00:30.024 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:moon:local
2019-05-21 00:00:30.032 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:moon:local/rise#event/START in 84029976ms (at 2019-05-21T23:21:00)
2019-05-21 00:00:30.032 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:moon:local/set#event/END in 23429968ms (at 2019-05-21T06:31:00)
2019-05-21 00:00:30.038 [DEBUG] [ding.astro.handler.AstroThingHandler] - Publishing planet Sun for thing astro:sun:local
2019-05-21 00:00:30.040 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:local
2019-05-21 00:00:30.041 [TRACE] [ding.astro.handler.AstroThingHandler] - Tidying up done future java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@514e7c3e
2019-05-21 00:00:30.041 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/rise#event/START in 16409959ms (at 2019-05-21T04:34:00)
2019-05-21 00:00:30.042 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/rise#event/END in 16709958ms (at 2019-05-21T04:39:00)
2019-05-21 00:00:30.042 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/set#event/START in 73769958ms (at 2019-05-21T20:30:00)
2019-05-21 00:00:30.042 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/set#event/END in 74009958ms (at 2019-05-21T20:34:00)
2019-05-21 00:00:30.043 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/noon#event/START in 45209958ms (at 2019-05-21T12:34:00)
2019-05-21 00:00:30.043 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/noon#event/END in 45269957ms (at 2019-05-21T12:35:00)
2019-05-21 00:00:30.043 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/nauticDawn#event/START in 9989957ms (at 2019-05-21T02:47:00)
2019-05-21 00:00:30.043 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/nauticDawn#event/END in 13769957ms (at 2019-05-21T03:50:00)
2019-05-21 00:00:30.044 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/civilDawn#event/START in 13769956ms (at 2019-05-21T03:50:00)
2019-05-21 00:00:30.044 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/civilDawn#event/END in 16409956ms (at 2019-05-21T04:34:00)
2019-05-21 00:00:30.044 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/nauticDusk#event/START in 76649956ms (at 2019-05-21T21:18:00)
2019-05-21 00:00:30.044 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/nauticDusk#event/END in 80489956ms (at 2019-05-21T22:22:00)
2019-05-21 00:00:30.045 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/civilDusk#event/START in 74009955ms (at 2019-05-21T20:34:00)
2019-05-21 00:00:30.045 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/civilDusk#event/END in 76649955ms (at 2019-05-21T21:18:00)
2019-05-21 00:00:30.045 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/daylight#event/START in 16709955ms (at 2019-05-21T04:39:00)
2019-05-21 00:00:30.045 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Event job astro:sun:local/daylight#event/END in 73769955ms (at 2019-05-21T20:30:00)
2019-05-21 00:00:30.046 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/SUN_RISE in 16409954ms (at 2019-05-21T04:34:00)
2019-05-21 00:00:30.046 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/SUN_SET in 73769954ms (at 2019-05-21T20:30:00)
2019-05-21 00:00:30.046 [TRACE] [thome.binding.astro.internal.job.Job] - Scheduled Instant is null
2019-05-21 00:00:30.046 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/DAYLIGHT in 16709954ms (at 2019-05-21T04:39:00)
2019-05-21 00:00:30.047 [TRACE] [thome.binding.astro.internal.job.Job] - Scheduled Instant is null
2019-05-21 00:00:30.047 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/NAUTIC_DAWN in 9989953ms (at 2019-05-21T02:47:00)
2019-05-21 00:00:30.047 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/CIVIL_DAWN in 13769953ms (at 2019-05-21T03:50:00)
2019-05-21 00:00:30.047 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/ASTRO_DUSK in 80489953ms (at 2019-05-21T22:22:00)
2019-05-21 00:00:30.047 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/NAUTIC_DUSK in 76649953ms (at 2019-05-21T21:18:00)
2019-05-21 00:00:30.047 [DEBUG] [ding.astro.handler.AstroThingHandler] - Scheduled Sun phase job astro:sun:local/CIVIL_DUSK in 74009953ms (at 2019-05-21T20:34:00)

And there is no astro:sun:local:night.

I live in Poland, so I don’t think it is the problem.

1 Like

Calculate sunrise at 0430 and sunset at 2030 does not suggest problems with high latitude.

Do you have any offset or earliest/latest options in your Thing configuration?

Things:

Thing astro:sun:local "Astro sun data" @ "Astro"  [ geolocation="52.33032,20.90932", interval=60 ]
Thing astro:moon:local "Astro moon data" @ "Astro" [ geolocation="52.33032,20.90932", interval=60 ]

Items:

Group gAstro <sun_clouds>

// Times of Day
String TimePeriodOfDay              "Okres dnia [MAP(astro.map):%s]" <sunmoon> (gAstro)

DateTime MorningNightStart_Time     "Początek porannej części nocy [%1$tH:%1$tM]"  <moon>     (gAstro) { channel="astro:sun:local:morningNight#start" }
DateTime MorningNightStop_Time      "Koniec porannej części nocy [%1$tH:%1$tM]"   <moon>     (gAstro) { channel="astro:sun:local:morningNight#end" }
DateTime NightStop_Time             "Koniec nocy [%1$tH:%1$tM]"        <moon>       (gAstro) { channel="astro:sun:local:night#end" }
DateTime AstroDawnStart_Time        "Początek świtu astronomicznego [%1$tH:%1$tM]"   <sunrise>           (gAstro) { channel="astro:sun:local:astroDawn#start" }
DateTime AstroDawnStop_Time         "Koniec świtu astronomicznego [%1$tH:%1$tM]"   <sunrise>           (gAstro) { channel="astro:sun:local:astroDawn#end" }
DateTime NauticDawnStart_Time       "Początek świtu morskiego [%1$tH:%1$tM]"   <sunrise>           (gAstro) { channel="astro:sun:local:nauticDawn#start" }
DateTime NauticDawnStop_Time        "Koniec świtu morskiego [%1$tH:%1$tM]"   <sunrise>           (gAstro) { channel="astro:sun:local:nauticDawn#end" }
DateTime CivilDawnStart_Time        "Początek świtu cywilnego [%1$tH:%1$tM]"   <sunrise>           (gAstro) { channel="astro:sun:local:civilDawn#start" }
DateTime CivilDawnStop_Time         "Koniec świtu cywilnego [%1$tH:%1$tM]"     <sunrise>          (gAstro) { channel="astro:sun:local:civilDawn#end" }
DateTime SunriseStart_Time          "Początek wschodu słońca [%1$tH:%1$tM]"   <sunrise>    (gAstro) { channel="astro:sun:local:rise#start" }
DateTime SunriseStop_Time           "Koniec wschodu słońca [%1$tH:%1$tM]"   <sunrise>    (gAstro) { channel="astro:sun:local:rise#end" }
DateTime DayStart_Time              "Początek dnia [%1$tH:%1$tM]"    <sun>           (gAstro) { channel="astro:sun:local:daylight#start" }

DateTime DayStop_Time               "Koniec dnia [%1$tH:%1$tM]"        <sun>             (gAstro) { channel="astro:sun:local:daylight#end" }
DateTime SunsetStart_Time           "Początek zachodu słońca [%1$tH:%1$tM]"   <sunset>     (gAstro) { channel="astro:sun:local:set#start" }
DateTime SunsetStop_Time            "Koniec zachodu słońca [%1$tH:%1$tM]"   <sunset>     (gAstro) { channel="astro:sun:local:set#end" }
DateTime CivilDuskStart_Time        "Początek zmierzchu cywilnego [%1$tH:%1$tM]" <sunset>             (gAstro) { channel="astro:sun:local:civilDusk#start" }
DateTime CivilDuskStop_Time         "Koniec zmierzchu cywilnego [%1$tH:%1$tM]"   <sunset>            (gAstro) { channel="astro:sun:local:civilDusk#end" }
DateTime NauticDuskStart_Time       "Początek zmierzchu morskiego [%1$tH:%1$tM]" <sunset>             (gAstro) { channel="astro:sun:local:nauticDusk#start" }
DateTime NauticDuskStop_Time        "Koniec zmierzchu morskiego [%1$tH:%1$tM]"   <sunset>            (gAstro) { channel="astro:sun:local:nauticDusk#end" }
DateTime AstroDuskStart_Time        "Początek zmierzchu astronomicznego [%1$tH:%1$tM]" <sunset>             (gAstro) { channel="astro:sun:local:astroDusk#start" }
DateTime AstroDuskStop_Time         "Koniec zmierzchu astronomicznego [%1$tH:%1$tM]"   <sunset>            (gAstro) { channel="astro:sun:local:astroDusk#end" }
DateTime NightStart_Time            "Początek nocy [%1$tH:%1$tM]"      <moon>       (gAstro) { channel="astro:sun:local:night#start" }
DateTime EveningNightStart_Time     "Początek wieczornej części nocy [%1$tH:%1$tM]"  <moon>     (gAstro) { channel="astro:sun:local:eveningNight#start" }
DateTime EveningNightStop_Time      "Koniec wieczornej części nocy [%1$tH:%1$tM]"   <moon>     (gAstro) { channel="astro:sun:local:eveningNight#end" }


// Events
Switch DawnStart_Event              "Zdarzenie rozpoczęcia świtu" (gAstro)
Switch DayStart_Event               "Zdarzenie rozpoczęcia dnia"                          (gAstro)
Switch DuskStart_Event              "Zdarzenie rozpoczęcia zmierzchu"                             (gAstro)
Switch NightStart_Event             "Zdarzenie rozpoczęcia nocy"                            (gAstro)
Switch SunriseStart_Event           "Zdarzenie rozpoczęcia wschodu słońca" (gAstro)
Switch SunsetStart_Event            "Zdarzenie rozpoczęcia zachodu słońca" (gAstro)

// Items
Switch Dawn                         "Świt [MAP(astro.map):%s]"             (gAstro)                // After Dawn and before Day
Switch Day                          "Dzień [MAP(astro.map):%s]"            (gAstro)                  // After Day and before Dusk
Switch Dusk                         "Zmierzch [MAP(astro.map):%s]"         (gAstro)                    // After Dusk and before Night
Switch Night                        "Noc [MAP(astro.map):%s]"              (gAstro)              // After Night and before Dawn

Number SunAzimuth                   "Azymut słońca [%.0f °]"                <sun>      (gAstro) { channel="astro:sun:local:position#azimuth" }
Number SunElevation                 "Wysokość słońca [%.0f °]"              <sun>     (gAstro) { channel="astro:sun:local:position#elevation" }

String ZodiacSign                       "Znak zodiaku [MAP(astro.map):%s]"           <zodiac>             (gAstro) { channel="astro:sun:local:zodiac#sign" }
String Season                       "Pora roku [MAP(astro.map):%s]"                        (gAstro) { channel="astro:sun:local:season#name" }
String DayPhase                     "Pora dnia [MAP(astro.map):%s]"                        (gAstro) { channel="astro:sun:local:phase#name" }

String MoonPhase                    "Faza księżyca [MAP(astro.map):%s]"        <moon>        (gAstro) { channel="astro:moon:local:phase#name" }

Number      MoonElevation       "Wysokość księżyca [%.0f °]"                         <moon>   (gAstro) {channel="astro:moon:local:position#elevation"}
Number      MoonAzimuth       "Azymut księżyca [%.0f °]"                         <moon>   (gAstro) {channel="astro:moon:local:position#azimuth"}

DateTime    Moon_Next_Full       "Następna pełnia [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]" <moon> (gAstro) {channel="astro:moon:local:phase#full"}
DateTime    Moon_Next_New        "Następny nów [%1$td.%1$tm.%1$tY, %1$tH:%1$tM]"  <moon>   (gAstro) {channel="astro:moon:local:phase#new"}

DateTime MoonriseStart_Time          "Początek wschodu księżyca [%1$tH:%1$tM]"   <moonrise>    (gAstro) { channel="astro:moon:local:rise#start" }
DateTime MoonriseStop_Time          "Koniec wschodu księżyca [%1$tH:%1$tM]"   <moonrise>    (gAstro) { channel="astro:moon:local:rise#end" }
DateTime MoonsetStart_Time           "Początek zachodu księżyca [%1$tH:%1$tM]"   <moonset>     (gAstro) { channel="astro:moon:local:set#start" }
DateTime MoonsetStop_Time           "Koniec zachodu księżyca [%1$tH:%1$tM]"   <moonset>     (gAstro) { channel="astro:moon:local:set#end" }

So I don’t have.

Those two warnings talking about ManagedThingProvider are concerning and might be relevant.

I also don’t see lines in the log at midnight that correspond to the Channels that represent the ones that are UNDEF.

The problem appears to be with the binding or the Thing definition. Let’s eliminate there begin something wrong with the Thing first.

Create a new Thing, this time using PaperUI, and link the UNDEF channels to some test Items. Let’s see if those Items get properly calculated. If that works, delete it and create a new one in the .things file with the same specifications as the one that you defined in PaperUI.

If those fail in the same way as your original Thing then we know that the problem isn’t necessarily with the Thing. Clear the Cache and then uninstall the Astro binding and reinstall.

If it still setting these to UNDEF, it’s time to How to file an Issue.

1 Like

Have a look at your sun/moon Things carefully in PaperUI. Even though you define them in a text .things file, I think discovery might use the :local thing name as well (to fill in from default system location) and there could be a conflict with your .things file.

1 Like

Hi,

I define in PaperUI:

astro:sun:test (Type=Thing, Status=ONLINE, Label=Astro sun data, Bridge=null)

I define item in PaperUI:

testEveningNightStart_Time (Type=DateTimeItem, State=UNDEF, Label=Początek wieczornej części nocy, Category=moon, Groups=[gAstro])

I link it to:

openhab> smarthome:links list |grep testEveningNightStart_Time
testEveningNightStart_Time -> astro:sun:test:eveningNight#start

and the value is UNDEF.

In events.log apper:

2019-05-26 21:49:31.494 [.ItemChannelLinkAddedEvent] - Link 'testEveningNightStart_Time-astro:sun:test:eveningNight#start' has been added.
2019-05-26 21:49:31.494 [vent.ItemStateChangedEvent] - testEveningNightStart_Time changed from NULL to UNDEF

The best I can recommend at this point is to file an issue at openhab2-addons. See How to file an Issue

Hi,
I have the same problem, on OH 2.5M1. I thought it was due to moving from snapshot to 2.5M1. In Paper UI:
astro
Location also Poland

I’m repeating myself but there’s no night time in Warsaw according to this link: https://www.timeanddate.com/sun/poland/warsaw

So dusk starts and dawn ends but won’t switch to night.

1 Like

Hi all,

I got the same Problems:

It’s starts with:

2019-05-23 00:00:30.337 [vent.ItemStateChangedEvent] - Night_Time_End changed from 2019-05-23T01:31:00.000+0200 to UNDEF

and on next day:

2019-05-24 00:00:30.270 [vent.ItemStateChangedEvent] - Night_Time_Start changed from 2019-05-24T01:08:00.000+0200 to UNDEF
2019-05-24 00:00:30.300 [vent.ItemStateChangedEvent] - Astro_Morning changed from 2019-05-23T01:31:00.000+0200 to UNDEF

I do nothing on my system (Openhab 2.4.005 on a synology nas) and Astro binding works fine since last year. Location is middle of Germany

I ran in similar issues. However in my case I obtain UNDEF for NauticDawn_start and NauticDusk_End. Two values which @OPeration seems to receive.
image

The reason for this seems to be for me - as @gitMiguel pointed out - that there is no “real Night” where I live :slight_smile:

There is a related issue concerning the Astro binding on github. https://github.com/openhab/openhab2-addons/issues/5006 , which seems to have a similar reason . Good to find the reason - time is tricky - and now I have to find sth clever form my rule.

BTW: I ran openHAB 2.5.0~S1558-1 (Build #1558) on raspberryPi

It is true that for some locations the (like, ASTRO_DUSK, ASTRO_DOWN, NAUTIC_DUSK, NAUTIC_DAWN, CIVIL_DUSK, CIVIL_DOWN, SUN_RISE, SUN_SET, DAYLIGHT) may be not available; just like @mdnx has mentioned, so for those events the astro library puts UNDEF, because the specific date and time can not be calculated.

@majherek, in the middle of Poland (Łódź city) around 18 May there is this thing that the ASTRO_DUSK is after the midnight of local time, so it takes place on the next dey after the sunset. However it looks to me like a bug in astri binding and the ASTRO_DUSK should be calculated correctly.

Please use https://www.heavens-above.com/sun.aspx to play around and check it by yourself. In June in Poland it gets more “complicated” as the NIGHT is never present.

@mdnx, https://github.com/openhab/openhab2-addons/issues/5006 relatetes more to the issue that sun phase name is not derived correctly, which is a bit different thing discussed in the forum topic.

1 Like

Hi,
here are sun:local:phase from log:

openhab> smarthome:links list |grep astro:sun|grep pha
DayPhase -> astro:sun:local:phase#name

openhab> smarthome:items list DayPhase
DayPhase (Type=StringItem, State=DAYLIGHT, Label=Pora dnia, Category=null, Groups=[gAstro])

And some logs:

majherek@atom:/opt/openhab/userdata/logs$ grep DayPhase  *
events.log.1:2019-06-09 20:52:00.005 [vent.ItemStateChangedEvent] - DayPhase changed from DAYLIGHT to SUN_SET
events.log.1:2019-06-09 20:52:15.588 [vent.ItemStateChangedEvent] - DayPhase changed from SUN_SET to UNDEF
events.log.1:2019-06-09 20:57:00.003 [vent.ItemStateChangedEvent] - DayPhase changed from UNDEF to CIVIL_DUSK
events.log.2:2019-06-09 21:46:00.003 [vent.ItemStateChangedEvent] - DayPhase changed from CIVIL_DUSK to NAUTIC_DUSK
events.log.2:2019-06-09 23:03:00.005 [vent.ItemStateChangedEvent] - DayPhase changed from NAUTIC_DUSK to ASTRO_DUSK
events.log.2:2019-06-10 00:00:15.587 [vent.ItemStateChangedEvent] - DayPhase changed from ASTRO_DUSK to ASTRO_DAWN
events.log.2:2019-06-10 02:10:00.006 [vent.ItemStateChangedEvent] - DayPhase changed from ASTRO_DAWN to NAUTIC_DAWN
events.log.2:2019-06-10 03:28:00.004 [vent.ItemStateChangedEvent] - DayPhase changed from NAUTIC_DAWN to CIVIL_DAWN
events.log.3:2019-06-10 04:17:00.006 [vent.ItemStateChangedEvent] - DayPhase changed from CIVIL_DAWN to SUN_RISE
events.log.3:2019-06-10 04:17:15.585 [vent.ItemStateChangedEvent] - DayPhase changed from SUN_RISE to UNDEF
events.log.3:2019-06-10 04:21:00.005 [vent.ItemStateChangedEvent] - DayPhase changed from UNDEF to DAYLIGHT
events.log.4:2019-06-10 12:37:15.584 [vent.ItemStateChangedEvent] - DayPhase changed from DAYLIGHT to NOON
events.log.4:2019-06-10 12:38:15.581 [vent.ItemStateChangedEvent] - DayPhase changed from NOON to DAYLIGHT
events.log.5:2019-06-10 20:53:00.008 [vent.ItemStateChangedEvent] - DayPhase changed from DAYLIGHT to SUN_SET
events.log.5:2019-06-10 20:53:15.587 [vent.ItemStateChangedEvent] - DayPhase changed from SUN_SET to UNDEF
events.log.5:2019-06-10 20:58:00.004 [vent.ItemStateChangedEvent] - DayPhase changed from UNDEF to CIVIL_DUSK
events.log.5:2019-06-10 21:46:00.005 [vent.ItemStateChangedEvent] - DayPhase changed from CIVIL_DUSK to NAUTIC_DUSK
events.log.5:2019-06-10 23:04:00.008 [vent.ItemStateChangedEvent] - DayPhase changed from NAUTIC_DUSK to ASTRO_DUSK
events.log.5:2019-06-11 00:00:15.588 [vent.ItemStateChangedEvent] - DayPhase changed from ASTRO_DUSK to ASTRO_DAWN
events.log.6:2019-06-11 02:09:00.003 [vent.ItemStateChangedEvent] - DayPhase changed from ASTRO_DAWN to NAUTIC_DAWN
events.log.6:2019-06-11 03:27:00.004 [vent.ItemStateChangedEvent] - DayPhase changed from NAUTIC_DAWN to CIVIL_DAWN
events.log.6:2019-06-11 04:16:00.008 [vent.ItemStateChangedEvent] - DayPhase changed from CIVIL_DAWN to SUN_RISE
events.log.6:2019-06-11 04:16:15.585 [vent.ItemStateChangedEvent] - DayPhase changed from SUN_RISE to UNDEF
events.log.6:2019-06-11 04:21:00.004 [vent.ItemStateChangedEvent] - DayPhase changed from UNDEF to DAYLIGHT
events.log.7:2019-06-11 12:37:15.586 [vent.ItemStateChangedEvent] - DayPhase changed from DAYLIGHT to NOON
events.log.7:2019-06-11 12:38:15.586 [vent.ItemStateChangedEvent] - DayPhase changed from NOON to DAYLIGHT

There are transitions with UNDEF:

SUN_SET -> UNDEF -> CIVIL_DUSK
SUN_RISE -> UNDEF -> DAYLIGHT