Hi, i have an item and want its state to define a timer
Number myTimerItem "Timer"
It stores its value like “11.0”
val Timer timer = null
// rule stuff
then
timer = createTimer(now.plusSeconds(myTimerItem.state)
end
I tested different methods but i did not figure it out.
i tried:
myTimerItem.state.toString
myTimerItem.state as Number
myTimerItem.state as Integer
myTimerItem.state.toString.split(‘.’).get(0)
myTimerItem.state.split(‘.’).get(0)
Nothing works. What am i doing wrong? The timer works correctly, if i just put in a random digit
Script execution of rule with UID 'ZigBee-3' failed: An error occurred during the script execution: Could not invoke method: java.time.ZonedDateTime.plusSeconds(long) on instance: 2022-11-08T20:58:34.150644+01:00[Europe/Berlin] in ZigBee
ZigBee is my .rules file.
When saving the rules file, the console is prompting following:
Validation issues found in configuration model 'ZigBee.rules', using it anyway: Cannot reference the field 'myTimerItem' before it is defined