Rule produces "ERROR" on startup (only the first use)

Platform information:
Hardware: Raspberry Pi 3 Model B Rev 1.2
Fritz-Box 7490 as Router, Fritz-Box 7390 as Repeater, Fritz/Comet Thermostates, Fritz-Poweroutlests, several Sonoff-Tasmota-Switches (basic, pow, th16, S20,Touch, T1)
OS: _ Raspbian GNU/Linux 8 (jessie)_
openHAB version: openHAB 2.3.0-1 (Release Build)
*Bindings:Astro, AVM, EXEC, MQTT, Network, NTP, Samsung, Sonos, Weather (binding-weather1 - 1.12.0), MapDB-Persitence
*Transformations: exec, Javascript, JSONPATH, Map, RegEx, Scale

Hi all,
I have a little problem with two Rules which should concatinate two items into one.

The error messages are:

2018-08-30 00:42:24.880 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_Kilometer_actual' cannot be resolved to an item or type; line 134, column 5, length 21
2018-09-01 00:15:49.409 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_Kilometer_actual' cannot be resolved to an item or type; line 173, column 5, length 21
2018-09-02 16:14:42.491 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_Kilometer_actual' cannot be resolved to an item or type; line 173, column 5, length 21
2018-09-03 15:34:45.361 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_Kilometer_actual' cannot be resolved to an item or type; line 173, column 5, length 21
2018-09-04 14:20:07.229 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Date_MinMax7' cannot be resolved to an item or type; line 12, column 25, length 12
2018-09-05 13:24:45.900 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_distance' cannot be resolved to an item or type; line 173, column 38, length 13
2018-09-05 18:16:37.448 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Temp_MinMax4' cannot be resolved to an item or type; line 9, column 96, length 12
2018-09-08 23:39:34.286 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Kilometer_distance' cannot be resolved to an item or type; line 165, column 99, length 18
2018-09-09 00:49:37.691 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_Kilometer_perigee' cannot be resolved to an item or type; line 166, column 5, length 22
2018-09-09 12:10:21.148 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Kilometer_distance' cannot be resolved to an item or type; line 165, column 99, length 18
2018-09-10 02:58:42.402 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Forecast_1' cannot be resolved to an item or type; line 6, column 3, length 10
2018-09-16 11:43:57.029 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Forecast_7' cannot be resolved to an item or type; line 12, column 3, length 10
2018-09-16 23:06:45.104 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Date_MinMax2' cannot be resolved to an item or type; line 7, column 25, length 12
2018-09-18 13:02:45.647 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'moondistances': The name 'Date_distance' cannot be resolved to an item or type; line 134, column 38, length 13

The Rules are:

rule "moondistances"
	when
		//Item Dummy2 changed to ON
		Item LastUpdate changed		// item defined in yahoo.items
			then
				Date_Kilometer_actual.postUpdate(Date_distance.state.format("%1$ta, %1$td.%1$tb. ") + " / " + Kilometer_distance.state.toString)
				Date_Kilometer_perigee.postUpdate(Date_perigee.state.format("%1$ta, %1$td.%1$tb. ") + " / " + Kilometer_perigee.state.toString)
				Date_Kilometer_apogee.postUpdate(Date_apogee.state.format("%1$ta, %1$td.%1$tb. ") + " / " + Kilometer_apogee.state.toString)
				logInfo(filename + "_99"," " + Date_Kilometer_actual.state + Date_Kilometer_perigee.state + Date_Kilometer_apogee.state)
end

and

rule "weather forecast formatting"
	when
		//Item Dummy2 changed to ON
		Item LastUpdate changed
	then
		Forecast_1.postUpdate(Date_MinMax1.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax1.state.toString)
		Forecast_2.postUpdate(Date_MinMax2.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax2.state.toString)
		Forecast_3.postUpdate(Date_MinMax3.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax3.state.toString)
		Forecast_4.postUpdate(Date_MinMax4.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax4.state.toString)
		Forecast_5.postUpdate(Date_MinMax5.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax5.state.toString)
		Forecast_6.postUpdate(Date_MinMax6.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax6.state.toString)
		Forecast_7.postUpdate(Date_MinMax7.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax7.state.toString)
	end

The associated Item-file looks like:

//	Weather - Binding - Provider - Yahoo
Group 			gWeather									"Wetter"																							<sun_clouds>								(home)
Number			Temperature								"Temperatur [%.1f °C]"																<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, property=current"}
Number			Temp_Feel									"GefĂŒhlte Temperatur [%.1f °C]"												<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, property=feel"}
Number			Humidity									"Luftfeuchtigkeit [%d %%]"														<humidity>									(gWeather)				{weather="locationId=home-yh, type=atmosphere, property=humidity"}
String			CommonId									"Himmel [MAP(weather_de.map):%s]"											<sun_clouds>								(gWeather)				{weather="locationId=home-yh, type=condition, property=commonId"}
Number			Clouds										"Bewölkung [%.0f %%]"																															(gWeather)				{weather="locationId=home-yh, type=clouds, property=percent"}
Number			Sight											"Sichtweite [%.1f km]"																<binoculars1>								(gWeather)				{weather="locationId=home-yh, type=atmosphere, property=visibility"}
Number			Ozone											"Ozon [%d ppm]"																																		(gWeather)				{weather="locationId=home-yh, type=atmosphere, property=ozone"}
Number			UV_Index									"UV Index"																																				(gWeather)				{weather="locationId=home-yh, type=atmosphere, property=uvIndex, scale=0"}
Number			Rain											"Niederschlagsmenge [%.2f mm/h]"											<rain>											(gWeather)				{weather="locationId=home-yh, type=precipitation, property=rain"}
Number			Snow											"Schneefall [%.2f mm/h]"															<snow>											(gWeather)				{weather="locationId=home-yh, type=precipitation, property=snow"}
Number			Precip_Probability				"Niederschlagswahrscheinlichkeit [%d %%]"																					(gWeather)				{weather="locationId=home-yh, type=precipitation, property=probability"}
Number			Temp_Dewpoint							"Taupunkt [%.1f °C]"																															(gWeather)				{weather="locationId=home-yh, type=temperature, property=dewpoint"}
Number			Wind_Speed								"Windgeschwindigkeit km/h [%.2f km/h]"								<wind>											(gWeather)				{weather="locationId=home-yh, type=wind, property=speed"}
Number			Wind_Speed_Mps						"Windgeschwindigkeit m/s [%.2f m/s]"									<wind>											(gWeather)				{weather="locationId=home-yh, type=wind, property=speed, unit=mps"}
String			Wind_Direction						"Windrichtung [MAP(weather_de.map):%s]"								<compass>										(gWeather)				{weather="locationId=home-yh, type=wind, property=direction"}
Number			Wind_Degree								"Windrichtung in Grad [%.0f °]"												<compass1>									(gWeather)				{weather="locationId=home-yh, type=wind, property=degree"}
Number			Wind_Gust									"Windböen [%.2f km/h]"																<wind>											(gWeather)				{weather="locationId=home-yh, type=wind, property=gust"}
Number			Wind_Chill								"Wind-Frösteln [%.1f °C]"															<windchill1>								(gWeather)				{weather="locationId=home-yh, type=wind, property=chill, unit=inches"}

// min and max values only available in forecasts	
String			Temp_MinMax								"Temp Min/Max heute [%s °C]"													<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=0, property=minMax, scale=1"}
DateTime		Date_MinMax1							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=1, property=observationTime"}
String			Temp_MinMax1							"Temp Min/Max morgen[%s °C]"													<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=1, property=minMax, scale=1"}
DateTime		Date_MinMax2							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=2, property=observationTime"}
String			Temp_MinMax2							"Temp Min/Max ĂŒbermorgen[%s °C]"											<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=2, property=minMax, scale=1"}
DateTime		Date_MinMax3							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=3, property=observationTime"}
String			Temp_MinMax3							"Temp Min/Max in 3 Tagen[%s °C]"											<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=3, property=minMax, scale=1"}
DateTime		Date_MinMax4							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=4, property=observationTime"}
String			Temp_MinMax4							"Temp Min/Max in 4 Tagen[%s °C]"											<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=4, property=minMax, scale=1"}
DateTime		Date_MinMax5							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=5, property=observationTime"}
String			Temp_MinMax5							"Temp Min/Max in 5 Tagen[%s °C]"											<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=5, property=minMax, scale=1"}
DateTime		Date_MinMax6							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=6, property=observationTime"}
String			Temp_MinMax6							"Temp Min/Max in 6 Tagen[%s °C]"											<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=6, property=minMax, scale=1"}
DateTime		Date_MinMax7							"Vorhersage fĂŒr [%1$ta, den %1$td.%1$tm.%1$ty]"				<calendar>									(gWeather)				{weather="locationId=home-yh, type=condition, forecast=7, property=observationTime"}
String			Temp_MinMax7							"Temp Min/Max in 7 Tagen[%s °C]"											<thermometer_red_earth>			(gWeather)				{weather="locationId=home-yh, type=temperature, forecast=7, property=minMax, scale=1"}
//					Strings fĂŒr formatierte Ausgabe. Die Aufbereitung und Formatierung erfolg ĂŒber eine Regel
String			Forecast_1								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		
String			Forecast_2								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		
String			Forecast_3								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		
String			Forecast_4								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		
String			Forecast_5								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		
String			Forecast_6								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		
String			Forecast_7								"Vorhersage fĂŒr  [%s °C]"																<thermometer_red_earth>		(gWeather)		

DateTime		LastUpdate								"Letzte Vorhersage[%1$td.%1$tm.%1$tY %1$tH:%1$tM]"		<time>											(gWeather)				{weather="locationId=home-yh, type=condition, property=lastUpdate"}
Number			Pressure									"Luftdruck [%.1f mbar]"																<pressure>									(gWeather)				{weather="locationId=home-yh, type=atmosphere, property=pressure, unit=inches"}
String			Pressure_Trend						"Luftdrucktrend [%s]"																	<pressure>									(gWeather)				{weather="locationId=home-yh, type=atmosphere, property=pressureTrend"}
// condition		
//String			Condition									"Bedingungen ll [%s]"																	<wind>											(gWeather)				{weather="locationId=home-yh, type=condition, forecast=0, property=text"}
String			Condition_ID							"Bedingungen [MAP(weather_de.map):%s]"									<sun_clouds>							(gWeather)				{weather="locationId=home-yh, type=condition, forecast=0, property=commonId"}
	

Extract of my sitemap:

		Text label="Astro - Wetter" 				icon="sun_clouds" 
		{
			Frame
			{
				Default item=Current_DateTime	
				Default item=Day_Phase					icon="sun"
																				visibility=[Day_Phase=="DAYLIGHT",Day_Phase=="SUN_RISE",Day_Phase=="SUN_SET",Day_Phase=="UNDEF"]
				Default item=Day_Phase					icon="fullmoon"
																				visibility=[Day_Phase=="CIVIL_DUSK",Day_Phase=="NAUTIC_DUSK",Day_Phase=="ASTRO_DUSK",Day_Phase=="NIGHT",
																										Day_Phase=="ASTRO_DAWN", Day_Phase=="NAUTIC_DAWN",Day_Phase=="UNDEF"]
				Default item=Sunset_Time				visibility=[Day_Phase=="DAYLIGHT",Day_Phase=="SUN_RISE",Day_Phase=="SUN_SET",Day_Phase=="UNDEF"]
				Default item=Sunrise_Time				visibility=[Day_Phase=="CIVIL_DUSK",Day_Phase=="NAUTIC_DUSK",Day_Phase=="ASTRO_DUSK",Day_Phase=="NIGHT",
																										Day_Phase=="ASTRO_DAWN", Day_Phase=="NAUTIC_DAWN",Day_Phase=="UNDEF"]
				Default item=Season_Name
				Default item=Zodiac_Sign
				Default item=Sun_Elevation
				Default item=Sun_Azimuth
				Default item=Moon_Elevation
				Default item=Moon_Phase
				Default item=Moon_Next_Full
				Default item=Moon_Next_New
				Default item=Date_Kilometer_actual
				Default item=Date_Kilometer_perigee
				Default item=Date_Kilometer_apogee
				Default item=Radiation_Direct
				Default item=Radiation_Diffuse
				Default item=Radiation_Total
			}
			Frame label="Yahoo-Wetter Daten (weather-binding)" icon="rain"
			{
				Text item=Temperature						valuecolor=[>=90="fuchsia",>=25="red",>=18="orange",>=12="blue",>=8="green",>=4="teal",<4="silver"]
																				labelcolor=[>=90="fuchsia",>=25="red",>=18="orange",>=12="blue",>=8="green",>=4="teal",<4="silver"]
				Text item=Temp_Feel							valuecolor=[>=90="fuchsia",>=25="red",>=18="orange",>=12="blue",>=8="green",>=4="teal",<4="silver"]
																				labelcolor=[>=90="fuchsia",>=25="red",>=18="orange",>=12="blue",>=8="green",>=4="teal",<4="silver"]
				Text item=Humidity
				Default item=Leiste_01_Hum				
				Default item=Pressure						visibility=[Pressure<2000]		//Da steht eigentlich nur Schrott drin, hab's in yahoo.items mit unit=inches probiert.Scheint zu klappen
				Default item=Pressure_Trend			visibility=[Pressure_Trend>0]
				Default item=Condition_ID
				Default item=CommonId			
				Default item=Clouds							//visibility=[Clouds>0]
				Default item=Sight							visibility=[Sight>0]
				Default item=Ozone							visibility=[Ozone>0]
				Default item=UV_Index						visibility=[UV_Index>0]
				Default item=Rain								visibility=[Rain>0]
				Default item=Snow								visibility=[Snow>0]
				Default item=Precip_Probability	visibility=[Precip_Probability>0]
				Default item=Temp_Dewpoint			visibility=[Temp_Dewpoint>0]
				Default item=Wind_Speed					visibility=[Wind_Speed>0]
				Default item=Wind_Speed_Mps			visibility=[Wind_Speed_Mps>0]
				Default item=Wind_Direction		
				Default item=Wind_Degree				visibility=[Wind_Degree>0]
				Default item=Wind_Gust					visibility=[Wind_Gust>0]
				Default item=Wind_Chill					visibility=[Temperature<=10]
				Default item=Temp_MinMax				visibility=[Temp_MinMax>0]
				Default item=Forecast_1
				Default item=Forecast_2
				Default item=Forecast_3
				Default item=Forecast_4
				Default item=Forecast_5
				Default item=Forecast_6
				Default item=Forecast_7
				Default item=LastUpdate					visibility=[LastUpdate>0]
			}
			Frame	
			{
				Text label="Wettervorhersage - Web-Dienst"	icon="sun_clouds"
				{
					Webview item=Wetter label="Wetterdienst" url="https://www.wetterdienst.de/Deutschlandwetter/Schwaebisch_Gmuend/" height=22
				}
			}
		}	//	Ende "Astro - Wetter"

But the result seems to be correct when the rules are fired a second time as one can see in the snapshot below

As one can see in the error messages, it’s not always the same item which is reported.

Is it my Rule-Syntax ?

Has anyone an idea ?

Regards
Peter

The error occurs when the rule file loads after a restart? Sometimes (usually?), OH will start running rules before items or persistence is available. You can live with it (there is an ESH PR to hopefully resolve this), try one of the solutions posted in the forum to delay the loading of rules, or check for the existence of the items or that their state is not NULL before using them in the rule.

Hi Scott, thanks for your reply.
As you wrote it happens after a restart (sudo systemctl stop openhab2 and sudo shutdown now) now I changed my mapDP like this:

Strategies {
	default = everyChange
}
Items {
	gPlugSwitch*								: strategy = everyChange, restoreOnStartup
	gLight*											: strategy = everyChange, restoreOnStartup
	gPower*											: strategy = everyChange, restoreOnStartup
	gWindow*										: strategy = everyChange, restoreOnStartup
	gDoor*											: strategy = everyChange, restoreOnStartup
	gShutter*										: strategy = everyChange, restoreOnStartup
	gGaragentor*								: strategy = everyChange, restoreOnStartup
	gHaustur*										: strategy = everyChange, restoreOnStartup
	gInnentur*									: strategy = everyChange, restoreOnStartup
	gHeating*										: strategy = everyChange, restoreOnStartup
	gWeather*										: strategy = everyChange, restoreOnStartup
	/*
	Forecast_*									: strategy = everyChange, restoreOnStartup
	Date_Kilometer_*						:	strategy = everyChange, restoreOnStartup
	Date_MinMax*								:	strategy = everyChange, restoreOnStartup
	Temp_MinMax*								:	strategy = everyChange, restoreOnStartup
	
	Forecast_1									:	strategy = everyChange, restoreOnStartup
	Forecast_2									:	strategy = everyChange, restoreOnStartup
	Forecast_3									:	strategy = everyChange, restoreOnStartup
	Forecast_4									:	strategy = everyChange, restoreOnStartup
	Forecast_5									:	strategy = everyChange, restoreOnStartup
	Forecast_6									:	strategy = everyChange, restoreOnStartup
	Forecast_7									:	strategy = everyChange, restoreOnStartup
	*/
	Date_Kilometer_actual				:	strategy = everyChange, restoreOnStartup
	Date_Kilometer_perigee			:	strategy = everyChange, restoreOnStartup
	Date_Kilometer_apogee				:	strategy = everyChange, restoreOnStartup
	
	
	
	
	

	//gRSSI*						:	strategy = everyChange, restoreOnStartup
}

and inserted the Group “gWeather” as defined in my .items file. But after the restart (as above) I had the same error again, as you can see in the below log.file(and snapshot). This time with item ‘Date_MinMax6’ which is part of the gWeather-Group.

2018-09-19 12:52:09.501 [INFO ] [er.internal.HomeBuilderDashboardTile] - Started Home Builder at /homebuilder
2018-09-19 12:52:10.016 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Time zone set to 'Europe/Berlin'.
2018-09-19 12:52:10.040 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Location set to '48.887211,9.8709123,502'.
2018-09-19 12:52:10.053 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Locale set to 'de_DE'.
2018-09-19 12:52:10.058 [INFO ] [.core.internal.i18n.I18nProviderImpl] - Measurement system set to 'SIUnits'.
2018-09-19 12:52:11.791 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at http://192.168.178.49:8080
2018-09-19 12:52:11.798 [INFO ] [.dashboard.internal.DashboardService] - Started Dashboard at https://192.168.178.49:8443
2018-09-19 12:52:14.235 [INFO ] [ttp.internal.SecureHttpClientFactory] - creating httpClient for endpoint null
2018-09-19 12:52:14.332 [INFO ] [ttp.internal.SecureHttpClientFactory] - jetty shared http client created
2018-09-19 12:52:21.713 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astra_sun.items'
2018-09-19 12:52:22.056 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astra_moon.items'
2018-09-19 12:52:22.223 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'yahoo.items'
2018-09-19 12:52:22.470 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sonoff.items'
2018-09-19 12:52:22.803 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.items'
2018-09-19 12:52:22.967 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sonos.items'
2018-09-19 12:52:23.346 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'system.items'
2018-09-19 12:52:23.546 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'castle.items'
2018-09-19 12:52:27.235 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'avm_fritz.items'
2018-09-19 12:52:27.823 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'network.items'
2018-09-19 12:52:28.680 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'mapdb.persist'
2018-09-19 12:52:31.698 [INFO ] [thome.model.lsp.internal.ModelServer] - Started Language Server Protocol (LSP) service on port 5007
2018-09-19 12:52:37.249 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'cpu.rules'
2018-09-19 12:52:40.342 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'castle.rules'
2018-09-19 12:52:42.622 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.rules'
2018-09-19 12:52:43.135 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'startup.rules'
2018-09-19 12:52:44.797 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'castle.sitemap'
2018-09-19 12:52:45.310 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'avm_fritz.things'
2018-09-19 12:52:45.624 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sample_ntp.things'
2018-09-19 12:52:45.654 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'cpu_tempPI.things'
2018-09-19 12:52:45.785 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'network.things'
2018-09-19 12:52:45.874 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'sonos.things'
2018-09-19 12:52:45.903 [INFO ] [el.core.internal.ModelRepositoryImpl] - Loading model 'astro.things'
2018-09-19 12:52:49.755 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:local
2018-09-19 12:52:49.799 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled Positional job astro:sun:local every 300 seconds
2018-09-19 12:52:50.141 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:moon:local
2018-09-19 12:52:50.151 [INFO ] [ding.astro.handler.AstroThingHandler] - Scheduled Positional job astro:moon:local every 300 seconds
2018-09-19 12:52:50.271 [INFO ] [thome.binding.astro.internal.job.Job] - Scheduled Astro event-jobs for thing astro:sun:stowing
2018-09-19 12:52:57.950 [INFO ] [smarthome.model.script.startup-rules] - Raspberry-Status ist : CPU_RasPi_Temp_num (Type=NumberItem, State=NULL, Label=CPU-Ras-Pi Temperatur, Category=temperature, Groups=[Chart_Sys_Temp])
2018-09-19 12:53:02.073 [INFO ] [basic.internal.servlet.WebAppServlet] - Started Basic UI at /basicui/app
2018-09-19 12:53:02.439 [INFO ] [assic.internal.servlet.WebAppServlet] - Started Classic UI at /classicui/app
2018-09-19 12:53:02.541 [INFO ] [arthome.ui.paper.internal.PaperUIApp] - Started Paper UI at /paperui
2018-09-19 12:53:03.108 [INFO ] [penhab.io.transport.mqtt.MqttService] - MQTT Service initialization completed.
2018-09-19 12:53:03.111 [INFO ] [t.mqtt.internal.MqttBrokerConnection] - Starting MQTT broker connection 'peter'
2018-09-19 12:53:10.838 [INFO ] [smarthome.model.script.startup-rules] - Raspberry-Status ist : CPU_RasPi_Temp_num (Type=NumberItem, State=0, Label=CPU-Ras-Pi Temperatur, Category=temperature, Groups=[Chart_Sys_Temp])
2018-09-19 12:53:10.899 [INFO ] [marthome.model.script.astro-rules_99] -  Mi, 19.Sep.  / 404683.12 kmSa, 06.Okt.  / 366393.96 kmNULL
2018-09-19 12:53:10.936 [INFO ] [marthome.model.script.astro-rules_99] -  Mi, 19.Sep.  / 404683.12 kmSa, 06.Okt.  / 366393.96 kmDo, 20.Sep.  / 404876.85 km
2018-09-19 12:53:11.246 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Date_MinMax6' cannot be resolved to an item or type; line 11, column 25, length 12
2018-09-19 12:53:18.691 [INFO ] [smarthome.model.script.startup-rules] - Raspberry-Status ist : CPU_RasPi_Temp_num (Type=NumberItem, State=0, Label=CPU-Ras-Pi Temperatur, Category=temperature, Groups=[Chart_Sys_Temp])
2018-09-19 13:16:02.538 [INFO ] [marthome.model.script.astro-rules_06] - Mittag - noon. START

And half an hour later, when the Rule is triggered again from the Binding, everything’s ok again and no more errors. So I’m wondering if somethings wrong with my mapDB.

Next step I will test now a createTimer in the Rule, althoug this means a delay every time when the rule is triggered. I will give you a reply, when I have tested it, even if it’s good or bad. And I will set back my smarthome.event.log from WARN to INFO to find more Infos.

First of all thank you for your tips.

Peter

As I mentioned, the rules are being loaded before persistence has restored the item states, possibly before the items are even initialized. So, changing your persistence strategy wouldn’t help. Try something like


rule "moondistances"
when
    //Item Dummy2 changed to ON
    Item LastUpdate changed		// item defined in yahoo.items
then
    if (previousState != NULL) {
        Date_Kilometer_actual.postUpdate(Date_distance.state.format("%1$ta, %1$td.%1$tb. ") + " / " + Kilometer_distance.state.toString)
        Date_Kilometer_perigee.postUpdate(Date_perigee.state.format("%1$ta, %1$td.%1$tb. ") + " / " + Kilometer_perigee.state.toString)
        Date_Kilometer_apogee.postUpdate(Date_apogee.state.format("%1$ta, %1$td.%1$tb. ") + " / " + Kilometer_apogee.state.toString)
        logInfo(filename + "_99"," " + Date_Kilometer_actual.state + Date_Kilometer_perigee.state + Date_Kilometer_apogee.state)
    }
end

Or, this is what I use to delay the loading of my rule files


1 Like

I will try the first version, but I do not understand of which item the previousState is checked ? (Sorry, Newbie :thinking:)

The second version, mmh
 I will think about, but in my former live I was a bookkeeper (now retired) and first I have to learn my lessons. All I understand is that you move the most rules to a temporary folder and later you copy the rules back. But at the moment I don’t know where start.sh is and what happens really.

A last question for a beginner: You wrote somewhere about ESH PR in the context I understand what you mean, but ESH I learned, means eclipse smart home. But what the shortcut PR stands for ? (shame on me :cry:)
Thanks in advance

Sorry, but this was not the solution. I will try another way or ignore it 'til next oh-update.
Thats what the log said. As you can see the item was initialised before.

2018-09-19 15:18:55.710 [vent.ItemStateChangedEvent] - Forecast_7 changed from NULL to Mi, den 26.Sep.  min/max  3.0/13.0
2018-09-19 15:19:03.268 [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'weather forecast formatting': The name 'Forecast_7' cannot be resolved to an item or type; line 12, column 3, length 10

Thanks a lot for your hints
Peter

OH is started by running start.sh (or start.bat). You probably have a service that runs, which calls start.sh. Files are located in different directories, based on how you installed OH. When this script runs, it moves all of the rule files except one, which has a rule that runs at startup. It sleeps for 30s and then moves all of the rule files back.

No shame in asking! PR stands for pull request. In the OH and ESH repositories in Github, a developer can’t push commits. They need to submit a request for them to be pulled in. You can see all of the ESH PRs here. The issue for delaying rule startup has been around for a long time and may be around for a while longer, so don’t expect a quick fix!

Indeed, it was not the solution but an example of how to create a solution :wink:. In the if statement, you’ll need to include NULL checks for any items in the rule where states are being used.

1 Like

Thanks for my first lesson. I have a repository-version and after a quik view on the linked docu I saw something looks like start,but only looked with one eye, so I have to read it first in quiet moment.
In the meantime I have installed the Rule-Version with createTimer -Functionality and it works now without an error. So this workaround will solve my problem 'til the developers find the best way.

rule "weather forecast formatting"
	when
		//Item Dummy2 changed to ON
		Item LastUpdate changed
	then
	createTimer(now.plusMinutes(3), [|
		Forecast_1.postUpdate(Date_MinMax1.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax1.state.toString)
		Forecast_2.postUpdate(Date_MinMax2.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax2.state.toString)
		Forecast_3.postUpdate(Date_MinMax3.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax3.state.toString)
		Forecast_4.postUpdate(Date_MinMax4.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax4.state.toString)
		Forecast_5.postUpdate(Date_MinMax5.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax5.state.toString)
		Forecast_6.postUpdate(Date_MinMax6.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax6.state.toString)
		Forecast_7.postUpdate(Date_MinMax7.state.format("%1$ta, den %1$td.%1$tb. ") + " min/max  " + Temp_MinMax7.state.toString)
		])
	end

Thanks a lot and have a good time
Peter