rule "Batterie leer"
when
Item gBattery changed to ON
then
val lastitem = gBattery.members.filter[i | i.lastUpdate !== null].sortBy[lastUpdate].last
sendTelegram("main",lastitem.label+": Bitte Batterie wechseln !")
end
with
Group:Switch:OR(ON, OFF) gBattery
comes to the following error message, Why?
[ERROR] [ntime.internal.engine.RuleEngineImpl] - Rule 'Batterie leer': java.lang.Double cannot be cast to java.lang.String
Add some logInfo to find out what line the rule breaks
rule "Batterie leer"
when
Item gBattery changed to ON
then
logInfo("RULE","BREAK 1")
val lastitem = gBattery.members.filter[i | i.lastUpdate !== null].sortBy[lastUpdate].last
logInfo("RULE","BREAK 2")
sendTelegram("main",lastitem.label+": Bitte Batterie wechseln !")
end
val lastItem = Windows.members.filter[ w | w.lastUpdate !== null ].sortBy[ lastUpdate ].last
val String nameOfItem = lastItem.name
The only difference I can see are the spaces after [ and before ] and lastItem.name instead of .label. But not sure as I don’t know the Telegram-Command itself. Hope this helps
Thought with putting the values “everyminute” into persistence should result in no "null"s. At least I have to have more time to check this. Meanwhile any hints are welcome …