- Platform information:
- Hardware: AMD Ryzen 9 3900X / 64GB / 1TB NVME
- OS: Windows 10
- Java Runtime Environment: 8.0.2510.8
- openHAB version: 2.5.9
- Issue of the topic:
Hello everybody,
I’m kind of new to Openhab and have an issue regarding memory usage. I’ve created a rule to do a full color fade for 3 of my WiFi LED Binding using LED controller. When turned off it is supposed to stop the timer and send off commands to the switches of the 3 LED controllers.
What worries me now is that during the execution of the rule the memory used by the Java™ Platform SE binary is constantly increasing. About 2-4mb / second. I’ll post my rule below this text because I just cannot find my error.
When i stop the execution of the rule (Turn the Switch Oben_Fading to OFF) the memory increase stops at once.
Maybe anybody of you can help me here? Thank you in advance.
Best regards,
Patrick
var Timer timer = null
var HSBType hsb = null
var HSBType newHsb = null
var DecimalType color = null
rule "Start Wabe 3 Rechts fading"
when
Item Oben_Fading changed
then
if (Oben_Fading.state == ON) {
// set a timer to sligtly change the color again and again
timer = createTimer(now, [|
if (Wabe3Links_Eingeschaltet.state == OFF) {
Wabe3Links_Eingeschaltet.sendCommand(ON)
}
if (Wabe3Links_Eingeschaltet.state == OFF) {
Wabe3Links_Eingeschaltet.sendCommand(ON)
}
if (Wabe3STREAM_Eingeschaltet.state == OFF) {
Wabe3STREAM_Eingeschaltet.sendCommand(ON)
}
Oben_Fade_Next.sendCommand(now.toString)
if (timer !== null) {
timer.reschedule(now.plusMillis(100))
}
])
}
else {
timer = null
Thread::sleep(1000)
Wabe3Links_Eingeschaltet.sendCommand(OFF)
Wabe3LinksUnten_Eingeschaltet.sendCommand(OFF)
Wabe3STREAM_Eingeschaltet.sendCommand(OFF)
}
end
rule "Wabe 3 Rechts Fade Next"
when
Item Oben_Fade_Next changed
then
if (Oben_Fading.state == ON) {
// get your current color
hsb = Wabe3Links_Color.state as HSBType
// change it a little bit
color = new DecimalType(hsb.hue.intValue % 359 + 1) // 0-360; 0=red, 120=green, 240=blue, 360=red(again)
newHsb = new HSBType(color,new PercentType(100),new PercentType(100))
// set the new color
Wabe3Links_Color.send(newHsb)
Wabe3LinksUnten_Color.send(newHsb)
Wabe3STREAM_Color.send(newHsb)
}
end