Hi,
I’m totally new about rules and I don’t understand Xtend very well.
I wanna ask you why I get the error “The method getLocalMillis() is not visible” aside of my rule in OH designer.
I used Habmin to compile the rule and then I’m looking inside of it to understand how to create from txt lines.
The line with error is
if (PIR_soggiorno.state == ON && (new LocalTime().getLocalMillis() >= new LocalTime(21, 0, 0, 0).getLocalMillis() || new LocalTime().getLocalMillis() <= new LocalTime(7, 0, 0, 0).getLocalMillis()) && LIFX1_Int_Soggiorno_Accendi.state == OFF && Luminosita_Int_Soggiorno.state < 15)
The complete rule is
// Imports
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
// Global Variables
var boolean PIR_Flag = false
var Timer _timer_001_A = null
rule "PIR_Soggiorno"
when
Time cron "0 0 * * * ?"
or
Item PIR_soggiorno changed
or
Item LIFX1_Int_Soggiorno_Accendi changed
or
Item Luminosita_Int_Soggiorno changed
then
if (PIR_soggiorno.state == ON && (new LocalTime().getLocalMillis() >= new LocalTime(21, 0, 0, 0).getLocalMillis() || new LocalTime().getLocalMillis() <= new LocalTime(7, 0, 0, 0).getLocalMillis()) && LIFX1_Int_Soggiorno_Accendi.state == OFF && Luminosita_Int_Soggiorno.state < 15) {
sendCommand(LIFX1_Int_Soggiorno_Dimmer, 25)
PIR_Flag = true
}
if ((PIR_Flag == true)) {
if (_timer_001_A == null) {
_timer_001_A = createTimer(now.plusSeconds(30)) [|
_timer_001_A.cancel()
_timer_001_A = null
sendCommand(LIFX1_Int_Soggiorno_Accendi, OFF)
PIR_Flag = false
]
}
}
else if(_timer_001_A != null) {
_timer_001_A.cancel()
_timer_001_A = null
}
end
Thank you so much to explain me something.