Variante 1 hat beim zweiten Anlauf funktioniert (im Code war ein Klammerfehler)
Die Zeit wird nur leider noch nicht gezählt,
Hier nochmal der Code:
Code: Alles auswählen
var Long lStart = 0
var Integer iSeconds = 0
var Timer tBadlicht = null
rule "badlicht"
when
Time cron "5 0 0 * * ?"
then
iSeconds = 0
end
rule "Badlicht geschaltet"
when
Item BadLicht changed
then
if(newState == ON) {
lStart = now.toInstant.toEpochMilli
} else {
iSeconds += ((now.toInstant.toEpochMilli - lStart)/1000).intValue
BadlichtED.postUpdate(iSeconds)
}
end

BadlichtED steht immer auf 0s
Könntest du vielleicht nochmal drüber schauen ob da noch irgendwo ein Fehler ist.