nw378 hat geschrieben: Heute 07:55
So setze ich between ein:
Danke für deinen Tipp.
Ich hab ihn ausprobiert ..... und was soll ich sagen; die gleiche Fehlermeldung.
Code: Alles auswählen
2026-04-17 12:19:29.056 [WARN ] [el.core.internal.ModelRepositoryImpl] - DSL model 'datum_testen_2.rules' has errors, therefore ignoring it: [12,32]: no viable alternative at input 'between'
[16,31]: no viable alternative at input 'between'
Die Meldung in VSC ist:
Code: Alles auswählen
[{
"resource": "/p:/rules/datum_testen_2.rules",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Syntax",
"severity": 8,
"message": "no viable alternative at input 'between'",
"startLineNumber": 12,
"startColumn": 32,
"endLineNumber": 12,
"endColumn": 39,
"modelVersionId": 4,
"origin": "extHost1"
},{
"resource": "/p:/rules/datum_testen_2.rules",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Syntax",
"severity": 8,
"message": "no viable alternative at input 'between'",
"startLineNumber": 16,
"startColumn": 31,
"endLineNumber": 16,
"endColumn": 38,
"modelVersionId": 4,
"origin": "extHost1"
},{
"resource": "/p:/rules/datum_testen_2.rules",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Linking",
"severity": 8,
"message": "The method or field getYears is undefined for the type long",
"startLineNumber": 20,
"startColumn": 77,
"endLineNumber": 20,
"endColumn": 85,
"modelVersionId": 4,
"origin": "extHost1"
},{
"resource": "/p:/rules/datum_testen_2.rules",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Linking",
"severity": 8,
"message": "The method or field getMonths is undefined for the type long",
"startLineNumber": 20,
"startColumn": 93,
"endLineNumber": 20,
"endColumn": 102,
"modelVersionId": 4,
"origin": "extHost1"
},{
"resource": "/p:/rules/datum_testen_2.rules",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "org.eclipse.xtext.diagnostics.Diagnostic.Linking",
"severity": 8,
"message": "The method or field getDays is undefined for the type long",
"startLineNumber": 20,
"startColumn": 110,
"endLineNumber": 20,
"endColumn": 117,
"modelVersionId": 4,
"origin": "extHost1"
}]
Ich hab mich gefragt, was ausser der OH-Version noch anders ist. Dann ist mir eingefallen, dass ich auf dem Test-Rechner nicht mehr die "Temurin"-Version von Java habe sondern wieder den "Standard-OpenJDK habe.
Code: Alles auswählen
_ _ _ ____ _
___ ___ ___ ___ | | | | / \ | __ ) (_) ____ ___
/ _ \ / _ \ / _ \ / _ \ | |_| | / _ \ | _ \ | | / _ \ / _ \
| (_) | (_) | __/| | | || _ | / ___ \ | |_) )| || (_) || | | |
\___/| __/ \___/|_| |_||_| |_|/_/ \_\|____/ |_| \__|_||_| | |
|_| openHAB 5.1.3 - Release Build
Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://raspi58:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'
ohab@raspi58:~ $ java -version
openjdk version "21.0.10" 2026-01-20 LTS
OpenJDK Runtime Environment Temurin-21.0.10+7 (build 21.0.10+7-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.10+7 (build 21.0.10+7-LTS, mixed mode, sharing)
ohab@raspi58:~ $
---------------------------------------------------------------------------
_ _ _ ____ _
___ ___ ___ ___ | | | | / \ | __ ) (_) ____ ___
/ _ \ / _ \ / _ \ / _ \ | |_| | / _ \ | _ \ | | / _ \ / _ \
| (_) | (_) | __/| | | || _ | / ___ \ | |_) )| || (_) || | | |
\___/| __/ \___/|_| |_||_| |_|/_/ \_\|____/ |_| \__|_||_| | |
|_| openHAB 5.2.0-SNAPSHOT - Build #5306
Looking for a place to get started? Check out 'sudo openhabian-config' and the
documentation at https://www.openhab.org/docs/installation/openhabian.html
The openHAB dashboard can be reached at http://pi5:8080
To interact with openHAB on the command line, execute: 'openhab-cli --help'
ohab@pi5:~ $ java -version
openjdk version "21.0.10" 2026-01-20
OpenJDK Runtime Environment (build 21.0.10+7-Debian-1)
OpenJDK 64-Bit Server VM (build 21.0.10+7-Debian-1, mixed mode, sharing)
ohab@pi5:~
-----------------------------------------------------------------------
Könnte das evtl. der Grund sein ?
Der Rule-Code sieht so aus:
.rules
Code: Alles auswählen
rule "Datum testen_3"
when
Item Dummy_12 changed to ON
then
// var LocalDate endofCentury = LocalDate.of(2014, 01, 01)
// var LocalDate just = LocalDate.now()
val heute = now.toLocalDate
val abholTag = (garbage_currwaste_Begin.state as DateTimeType)
.getZonedDateTime(ZoneId.systemDefault)
.toLocalDate
val delta = ChronoUnit.DAYS.between(heute, abholTag)
//var diff = Period.between(endofCentury, just)
var diff = java.time.Period.between(abholTag, heute)
// var Duration diff1 = Duration.between(endofCentury, just)
logInfo("datediff", "diff between Years: {} Months: {} Days: {}", diff.getYears, diff.getMonths, diff.getDays)
logInfo("datediff", "Delta zwischen Years: {} Months: {} Days: {}", delta.getYears, delta.getMonths, delta.getDays)
// logInfo("datediff1", "diff between Duration: {} ", diff1)
end