Hi,
there are some solutions here, which can be interesting for you.
My solution is a bit amateurish, as it still has two bugs (after restart and when items …117 and/or …120 have no values) it gives space for improvement, but for me it works for the moment and looks like this:
import org.eclipse.smarthome.model.script.ScriptServiceUtil
var logCount = 4
rule "owm Aggregation daily Measures"
when
Item owmTriggerSwitch received command ON or
Item localLastMeasurement changed
then
if( logCount == 4 ) {
logInfo ("owm.rules", "Start of Process - owm Aggregation daily Measures" + " + " + triggeringItem.name) // log every fourth time - means two hours - to show that rule is alive
}
//++++ initial variables for the "while"-loop ++++
var itemindex = 3 //item index
var itemincrement = 3 //item step
//++++ initial variables for daily if-loops as divisor
var count_day0 = 0
var count_day1 = 0
var count_day2 = 0
var count_day3 = 0
var count_day4 = 0
var count_day5 = 0
//++++ Temperature Results for the days
var Number sum_temp_day0 = 0
var Number sum_temp_day1 = 0
var Number sum_temp_day2 = 0
var Number sum_temp_day3 = 0
var Number sum_temp_day4 = 0
var Number sum_temp_day5 = 0
var Number avg_temp_day0 = 0
var Number avg_temp_day1 = 0
var Number avg_temp_day2 = 0
var Number avg_temp_day3 = 0
var Number avg_temp_day4 = 0
var Number avg_temp_day5 = 0
//+++++ for daily MIN/MAX Temperature-Values
var Number min_temp_day0 = 999.9
var Number min_temp_day1 = 999.9
var Number min_temp_day2 = 999.9
var Number min_temp_day3 = 999.9
var Number min_temp_day4 = 999.9
var Number min_temp_day5 = 999.9
var Number max_temp_day0 = -999.9
var Number max_temp_day1 = -999.9
var Number max_temp_day2 = -999.9
var Number max_temp_day3 = -999.9
var Number max_temp_day4 = -999.9
var Number max_temp_day5 = -999.9
//++++ Rain Results for the days
var Number sum_rain_day0 = 0.0
var Number sum_rain_day1 = 0.0
var Number sum_rain_day2 = 0.0
var Number sum_rain_day3 = 0.0
var Number sum_rain_day4 = 0.0
var Number sum_rain_day5 = 0.0
//++++ Snow Results for the days
var Number sum_snow_day0 = 0.0
var Number sum_snow_day1 = 0.0
var Number sum_snow_day2 = 0.0
var Number sum_snow_day3 = 0.0
var Number sum_snow_day4 = 0.0
var Number sum_snow_day5 = 0.0
//++++ initialize daily forecastvariables from day0(today) to day5 to compare in the "if"-loops ++++ ***thx to @5iver and @vzorglub for help***
//++++ https://community.openhab.org/t/datetime-items-compare-against-fixed-datetimes/58615 ++++
var day0 = new DateTime(localLastMeasurement.state.toString).toString("yyMMdd")
var day1 = new DateTime(localLastMeasurement.state.toString).plusDays(1).toString("yyMMdd")
var day2 = new DateTime(localLastMeasurement.state.toString).plusDays(2).toString("yyMMdd")
var day3 = new DateTime(localLastMeasurement.state.toString).plusDays(3).toString("yyMMdd")
var day4 = new DateTime(localLastMeasurement.state.toString).plusDays(4).toString("yyMMdd")
var day5 = new DateTime(localLastMeasurement.state.toString).plusDays(5).toString("yyMMdd")
var tmp_timestamp = new DateTime().toString("yyMMdd")
// logInfo ("owm.rules", "DebugPoint 0: " + tmp_timestamp)
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Processing ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
// possible Errors: (maybe there's one to found a solution, i still didn't) ---------------------------------------------------------------------------------------------------------------
// On Start or Restart:
// [INFO ] [pse.smarthome.model.script.owm.rules] - Start of Process - owm Aggregation daily Measures
// [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'owm Aggregation daily Measures': An error occurred during the script execution: null
// -> you can handle it by using the Switch-Trigger above (owmTriggerSwitch) to get your fields filled presto or wait 'til the next Rule-Processing)
//
// If not all item-fields are filled by the OpenweatherMap-Binding:
// This can happen from time to time, that the items with 'itemindex' 117 and/or 120 are State "NULL" (mostly after the midnight-hours)
// [INFO ] [pse.smarthome.model.script.owm.rules] - Start of Process - owm Aggregation daily Measures + owmTriggerSwitch
// [ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'owm Aggregation daily Measures': Invalid format: "NULL"
// -> you can reduce the itemindex below (while ...) or wait some hours ;)(or look whats wrong with my below if-Statement "if (tempItemTimestamp != NULL && itemindex <=120)")
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
val imin = 0
val imax =120
while ((itemindex >=imin) && (itemindex <=imax)) // ++++ Reduce itemindex for testing, when working it is 120 (imax) or less as in Thing-Parameter --> forecastHours=xxx <-- ++++
{
//logInfo ("owm.rules", "DebugPoint 1: " + tmp_timestamp + " /: " + itemindex)
//++++ Pointer-adresses for the dynamically generated items to get corresponding/generic item ***thx to @5iver and @rlkoshak for help***
var GenericItem tempItemTimestamp = ScriptServiceUtil.getItemRegistry.getItem("localHourlyForecast"+itemindex+"Timestamp") as GenericItem // ***thx to @5iver ***
//logInfo ("owm.rules", "DebugPoint 2: " + tmp_timestamp + " /: " + itemindex+ " /: " + tempItemTimestamp)
var GenericItem tempItemTemperature = ScriptServiceUtil.getItemRegistry.getItem("localHourlyForecast"+itemindex+"Temperature") as GenericItem // ***thx to @5iver ***
//logInfo ("owm.rules", "DebugPoint 3a: " + tmp_timestamp + " /: " + itemindex + " /: " + tempItemTemperature)
var GenericItem tempItemRainVolume = ScriptServiceUtil.getItemRegistry.getItem("localHourlyForecast"+itemindex+"RainVolume") as GenericItem // ***thx to @5iver ***
//logInfo ("owm.rules", "DebugPoint 3aa: " + tmp_timestamp + " /: " + itemindex + " /: " + tempItemRainVolume)
var GenericItem tempItemSnowVolume = ScriptServiceUtil.getItemRegistry.getItem("localHourlyForecast"+itemindex+"SnowVolume") as GenericItem // ***thx to @5iver ***
//logInfo ("owm.rules", "DebugPoint 3aaa: " + tmp_timestamp + " /: " + itemindex + " /: " + tempItemSnowVolume)
var test = tempItemTimestamp.state
//logInfo ("owm.rules", "DebugPoint 3b: " + test)
if (tempItemTimestamp.state != NULL && itemindex <=imax) {
//test = tempItemTimestamp.state
//logInfo ("owm.rules", "DebugPoint 4a: " + test)
//logInfo ("owm.rules", "DebugPoint 4b: " + tempItemTimestamp + " /: " + itemindex)
tmp_timestamp = new DateTime(tempItemTimestamp.state.toString).toString("yyMMdd") // create temporarily timestamp as needed -yyMMdd-
//logInfo ("owm.rules", "DebugPoint 5: " + tmp_timestamp + " /: " + itemindex)
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Day 0 ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (day0 == tmp_timestamp)
{
itemindex = itemindex + itemincrement
count_day0 = count_day0 + 1
sum_temp_day0 = sum_temp_day0 + tempItemTemperature.getStateAs(DecimalType)
//++++++++++++++++ Temperature Minimum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number min = 0
min = min + tempItemTemperature.getStateAs(DecimalType)
if (min_temp_day0 > min) {
min_temp_day0 = min
}
//+++++++++++++++ Temperature Maximum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number max = 0
max = max + tempItemTemperature.getStateAs(DecimalType)
if (max_temp_day0 < max) {
max_temp_day0 = max
}
//+++++++++++++++ Rain Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_rain_day0 = sum_rain_day0 + tempItemRainVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Rain Day 0: " + sum_rain_day0)
//+++++++++++++++ Snow Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_snow_day0 = sum_snow_day0 + tempItemSnowVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Snow Day 0: " + sum_snow_day0)
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Day 1 ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (day1 == tmp_timestamp) {
itemindex = itemindex + itemincrement
count_day1 = count_day1 + 1
sum_temp_day1 = sum_temp_day1 + tempItemTemperature.getStateAs(DecimalType)
//+++++++++++++++ Temperature Minimum of the day ++++++++++++++++++++++++++++++++++++++++++++++
var Number min = 0
min = min + tempItemTemperature.getStateAs(DecimalType)
if (min_temp_day1 > min) {
min_temp_day1 = min
}
//+++++++++++++++ Temperature Maximum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number max = 0
max = max + tempItemTemperature.getStateAs(DecimalType)
if (max_temp_day1 < max) {
max_temp_day1 = max
}
//+++++++++++++++ Rain Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_rain_day1 = sum_rain_day1 + tempItemRainVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Rain Day 1: " + sum_rain_day1 + " : " + tempItemRainVolume.state)
//+++++++++++++++ Snow Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_snow_day1 = sum_snow_day1 + tempItemSnowVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Snow Day 1: " + sum_snow_day1 + " : " + tempItemSnowVolume.state)
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Day 2 ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (day2 == tmp_timestamp) {
itemindex = itemindex + itemincrement
count_day2 = count_day2 + 1
sum_temp_day2 = sum_temp_day2 + tempItemTemperature.getStateAs(DecimalType)
//+++++++++++++++ Temperature Minimum of the day ++++++++++++++++++++++++++++++++++++++++++++++
var Number min = 0
min = min + tempItemTemperature.getStateAs(DecimalType)
if (min_temp_day2 > min) {
min_temp_day2 = min
}
//+++++++++++++++ Temperature Maximum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number max = 0
max = max + tempItemTemperature.getStateAs(DecimalType)
if (max_temp_day2 < max) {
max_temp_day2 = max
}
//+++++++++++++++ Rain Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_rain_day2 = sum_rain_day2 + tempItemRainVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Rain Day 2: " + sum_rain_day2 + " : " + tempItemRainVolume.state)
//+++++++++++++++ Snow Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_snow_day2 = sum_snow_day2 + tempItemSnowVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Snow Day 2: " + sum_snow_day2 + " : " + tempItemSnowVolume.state)
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Day 3 ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (day3 == tmp_timestamp) {
itemindex = itemindex + itemincrement
count_day3 = count_day3 + 1
sum_temp_day3 = sum_temp_day3 + tempItemTemperature.getStateAs(DecimalType)
//+++++++++++++++ Temperature Minimum of the day ++++++++++++++++++++++++++++++++++++++++++++++
var Number min = 0
min = min + tempItemTemperature.getStateAs(DecimalType)
if (min_temp_day3 > min) {
min_temp_day3 = min
}
//+++++++++++++++ Temperature Maximum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number max = 0
max = max + tempItemTemperature.getStateAs(DecimalType)
if (max_temp_day3 < max) {
max_temp_day3 = max
}
//+++++++++++++++ Rain Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_rain_day3 = sum_rain_day3 + tempItemRainVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Rain Day 3: " + sum_rain_day3 + " : " + tempItemRainVolume.state)
//+++++++++++++++ Snow Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_snow_day3 = sum_snow_day3 + tempItemSnowVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Snow Day 3: " + sum_snow_day3 + " : " + tempItemSnowVolume.state)
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Day 4 ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (day4 == tmp_timestamp) {
itemindex = itemindex + itemincrement
count_day4 = count_day4 + 1
sum_temp_day4 = sum_temp_day4 + tempItemTemperature.getStateAs(DecimalType)
//+++++++++++++++ Temperature Minimum of the day ++++++++++++++++++++++++++++++++++++++++++++++
var Number min = 0
min = min + tempItemTemperature.getStateAs(DecimalType)
if (min_temp_day4 > min) {
min_temp_day4 = min
}
//+++++++++++++++ Temperature Maximum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number max = 0
max = max + tempItemTemperature.getStateAs(DecimalType)
if (max_temp_day4 < max) {
max_temp_day4 = max
}
//+++++++++++++++ Rain Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_rain_day4 = sum_rain_day4 + tempItemRainVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Rain Day 4: " + sum_rain_day4 + " : " + tempItemRainVolume.state)
//+++++++++++++++ Snow Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_snow_day4 = sum_snow_day4 + tempItemSnowVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Snow Day 4: " + sum_snow_day4 + " : " + tempItemSnowVolume.state)
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//++++++++++++++++++++++++++++ Day 5 ++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (day5 == tmp_timestamp) {
itemindex = itemindex + itemincrement
count_day5 = count_day5 + 1
sum_temp_day5 = sum_temp_day5 + tempItemTemperature.getStateAs(DecimalType)
//+++++++++++++++ Temperature Minimum of the day ++++++++++++++++++++++++++++++++++++++++++++++
var Number min = 0
min = min + tempItemTemperature.getStateAs(DecimalType)
if (min_temp_day5 > min) {
min_temp_day5 = min
}
//+++++++++++++++ Temperature Maximum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
var Number max = 0
max = max + tempItemTemperature.getStateAs(DecimalType)
if (max_temp_day5 < max) {
max_temp_day5 = max
}
//+++++++++++++++ Rain Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_rain_day5 = sum_rain_day5 + tempItemRainVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Rain Day 5: " + sum_rain_day5 + " : " + tempItemRainVolume.state)
//+++++++++++++++ Snow Sum of the day +++++++++++++++++++++++++++++++++++++++++++++++++
sum_snow_day5 = sum_snow_day5 + tempItemSnowVolume.getStateAs(DecimalType)
// logInfo("owm.rules","DebugPoint 5a Snow Day 5: " + sum_snow_day5 + " : " + tempItemSnowVolume.state)
}
} //end of initial if
else if (tmp_timestamp == day5)
{
logInfo ("owm.rules", " End Else tmp_timestamp:" + tmp_timestamp + " day5: " + day5 + " Schow tempItemTimestamp: " + tempItemTimestamp + " /: " + itemindex)
}
} // End of while
// logInfo ("owm.rules", "DebugPoint 4: Calc begin " + tmp_timestamp + " /: " + itemindex)
//++++++++++++++++++ Check Division by zero and calculate Average ++++++++++++++++++++++++++++
if (sum_temp_day0 != 0 && count_day0 != 0) avg_temp_day0 = sum_temp_day0 / count_day0
if (sum_temp_day1 != 0 && count_day1 != 0) avg_temp_day1 = sum_temp_day1 / count_day1
if (sum_temp_day2 != 0 && count_day2 != 0) avg_temp_day2 = sum_temp_day2 / count_day2
if (sum_temp_day3 != 0 && count_day3 != 0) avg_temp_day3 = sum_temp_day3 / count_day3
if (sum_temp_day4 != 0 && count_day4 != 0) avg_temp_day4 = sum_temp_day4 / count_day4
if (sum_temp_day5 != 0 && count_day5 != 0) avg_temp_day5 = sum_temp_day5 / count_day5
// logInfo ("owm.rules", "DebugPoint 60 after Division")
//++++++++++++++++ Update Items in owm.items +++++++++++++++++++++++++++++++++++++++++++++++++
localDay0TemperatureAverage.postUpdate(avg_temp_day0)
localDay1TemperatureAverage.postUpdate(avg_temp_day1)
localDay2TemperatureAverage.postUpdate(avg_temp_day2)
localDay3TemperatureAverage.postUpdate(avg_temp_day3)
localDay4TemperatureAverage.postUpdate(avg_temp_day4)
localDay5TemperatureAverage.postUpdate(avg_temp_day5)
//+++++++++++++++ Formatting and Updating Forecast StringItems in owm.items ++++++++++++++++++++
var day0_format = new DateTime(localLastMeasurement.state.toString).toString("EE, dd.MMM")
var day1_format = new DateTime(localLastMeasurement.state.toString).plusDays(1).toString("EE, dd.MMM")
var day2_format = new DateTime(localLastMeasurement.state.toString).plusDays(2).toString("EE, dd.MMM")
var day3_format = new DateTime(localLastMeasurement.state.toString).plusDays(3).toString("EE, dd.MMM")
var day4_format = new DateTime(localLastMeasurement.state.toString).plusDays(4).toString("EE, dd.MMM")
var day5_format = new DateTime(localLastMeasurement.state.toString).plusDays(5).toString("EE, dd.MMM")
//var day5_format = new DateTime(localLastMeasurement.state.toString).plusDays(5).toString("EE, yyyy-MM-dd") // old Version
//+++++++++++++++++ Concatenate for sitemap ++*++++++++++++++++++*++++++++++++++++++++++++++++++
owmForecast_0Temp.postUpdate(day0_format + ": min/max/avg: " + String::format("%.1f",min_temp_day0) + " / " + String::format("%.1f",max_temp_day0) + " / " + localDay0TemperatureAverage.state.format("%.1f").toString)
owmForecast_1Temp.postUpdate(day1_format + ": min/max/avg: " + String::format("%.1f",min_temp_day1) + " / " + String::format("%.1f",max_temp_day1) + " / " + localDay1TemperatureAverage.state.format("%.1f").toString)
owmForecast_2Temp.postUpdate(day2_format + ": min/max/avg: " + String::format("%.1f",min_temp_day2) + " / " + String::format("%.1f",max_temp_day2) + " / " + localDay2TemperatureAverage.state.format("%.1f").toString)
owmForecast_3Temp.postUpdate(day3_format + ": min/max/avg: " + String::format("%.1f",min_temp_day3) + " / " + String::format("%.1f",max_temp_day3) + " / " + localDay3TemperatureAverage.state.format("%.1f").toString)
owmForecast_4Temp.postUpdate(day4_format + ": min/max/avg: " + String::format("%.1f",min_temp_day4) + " / " + String::format("%.1f",max_temp_day4) + " / " + localDay4TemperatureAverage.state.format("%.1f").toString)
owmForecast_5Temp.postUpdate(day5_format + ": min/max/avg: " + String::format("%.1f",min_temp_day5) + " / " + String::format("%.1f",max_temp_day5) + " / " + localDay5TemperatureAverage.state.format("%.1f").toString)
// logInfo ("owm.rules", "DebugPoint 100 Temp-update " + sum_rain_day5)
owmForecast_0Rain.postUpdate(day0_format + " " + String::format("%.1f",sum_rain_day0))
owmForecast_1Rain.postUpdate(day1_format + " " + String::format("%.1f",sum_rain_day1))
owmForecast_2Rain.postUpdate(day2_format + " " + String::format("%.1f",sum_rain_day2))
owmForecast_3Rain.postUpdate(day3_format + " " + String::format("%.1f",sum_rain_day3))
owmForecast_4Rain.postUpdate(day4_format + " " + String::format("%.1f",sum_rain_day4))
owmForecast_5Rain.postUpdate(day5_format + " " + String::format("%.1f",sum_rain_day5))
// logInfo ("owm.rules", "DebugPoint 110 Rain-update")
owmForecast_0Snow.postUpdate(day0_format + " " + String::format("%.1f",sum_snow_day0))
owmForecast_1Snow.postUpdate(day1_format + " " + String::format("%.1f",sum_snow_day1))
owmForecast_2Snow.postUpdate(day2_format + " " + String::format("%.1f",sum_snow_day2))
owmForecast_3Snow.postUpdate(day3_format + " " + String::format("%.1f",sum_snow_day3))
owmForecast_4Snow.postUpdate(day4_format + " " + String::format("%.1f",sum_snow_day4))
owmForecast_5Snow.postUpdate(day5_format + " " + String::format("%.1f",sum_snow_day5))
// logInfo ("owm.rules", "DebugPoint 120 Snow-update")
// logInfo ("owm.rules end", "before timestamp:")
// lastRuleRefresh.postUpdate((now).toDate) // Timestamp of RuleRefresh - is not correct
lastRuleRefresh.postUpdate(new DateTimeType())
if( logCount >= 4 ) {
logInfo ("owm.rules", "End of Process - 6a Aggregation daily Measures: " + logCount) // log every fourth time - means two hours - to show that rule is alive
logCount = 0
logCount = logCount + 1
//logInfo ("owm.rules", "End of Process - 6b Aggregation daily Measures: " + logCount) // Test Debug
}
else {
logCount = logCount +1
//logInfo ("owm.rules", "End of Process - 7 Aggregation daily Measures: " + logCount) // Test Debug)
}
//logInfo ("owm.rules", "End of Rule: " ) // Test Debug
end
/*
rule "owm_removeGroup_test"
// This rule is only used to clear the testgroups
when
Item Dummy4x received command ON
then
logInfo ("owm.rules", "Group day 0 " + localHourlyForecast3Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
localHourlyForecast3Temperature.removeGroupName("gTemp_day0") // only for test if dynamic Group - removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 0 " + localHourlyForecast3Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 0 " + localHourlyForecast6Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
localHourlyForecast6Temperature.removeGroupName("gTemp_day0") // only for test if dynamic Group - removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 0 " + localHourlyForecast6Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 0 " + localHourlyForecast9Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
localHourlyForecast9Temperature.removeGroupName("gTemp_day0") // only for test if dynamic Group - removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 0 " + localHourlyForecast9Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 1 " + localHourlyForecast3Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
localHourlyForecast3Temperature.removeGroupName("gTemp_day1") // only for test if dynamic Group - removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 1 " + localHourlyForecast3Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 1 " + localHourlyForecast6Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
localHourlyForecast6Temperature.removeGroupName("gTemp_day1") // only for test if dynamic Group - removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 1 " + localHourlyForecast6Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 1 " + localHourlyForecast9Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
localHourlyForecast9Temperature.removeGroupName("gTemp_day1") // only for test if dynamic Group - removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "Group day 1 " + localHourlyForecast9Temperature) // only for test if dynamic Group removeGroupName works (with a named item from owm.items it works)
logInfo ("owm.rules", "End ")
end
*/
As you can see at end there is another rule, where i began to test with dynamic/generic Groups. But at the moment i have no time( no gusto ) to tinker at it. The result looks like this:
Cheers,
Peter