- Platform information:
- Hardware: CPUArchitecture/RAM/storage
- OS: what OS is used and which version
- Java Runtime Environment: which java platform is used and what version
- openHAB version:
- Issue of the topic: please be detailed explaining your issue
- Please post configurations (if applicable):
- Items configuration related to the issue
- Sitemap configuration related to the issue
- Rules code related to the issue
- Services configuration related to the issue
- If logs where generated please post these here using code fences:
Hello everyone i have a problem with the Thread::sleep(xmillis) opetion.
It seems to be ignored in my rule.
then
if (onewiregpio_sensor_1d9a1ad9_temperature.state > Tempa ) {
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
])
Tempa = 150
Tempb = 26
Tempe = 23
Thread::sleep(10000)
}
I need the rule to stop here and let the above 2000 timer finish its action before the next one starts.
This is part of a control which opens a hatch when temperatures 24,26,28,30 °C are reached.
But if it is for example above 30° all the part of teh rule are triggered. Normally it should open 8 seconds in all but does only 2 seconds.
Thats why i need the pause.
Whole code below. If needed there are still empty timers which also don´t work. But as a test with the Thread::sleep also seems to be ignored i haven´t chnaged it yet.
var Number Tempa = 24
var Number Tempb = 26
var Number Tempc = 28
var Number Tempd = 30
var Number Tempe = 23
var Number Tempf = 25
var Number Tempg = 27
var Number Temph = 29
rule Temperaturschalter1
when
Item Relais5 changed from OFF to ON
then
Tempa = 150
Tempb = 150
Tempc = 150
Tempd = 150
Tempe = -150
Tempf = -150
Tempg = -150
Temph = -150
Relais7.sendCommand(ON)
Relais8.sendCommand(ON)
createTimer(now.plusMillis(20000), [|
Relais8.sendCommand(OFF)
Relais7.sendCommand(OFF)
])
end
rule Temperaturschalter2
when
Item Relais5 changed from ON to OFF
then
Tempa = 24
end
rule Temperaturschalter3
when
Item onewiregpio_sensor_1d9a1ad9_temperature changed
then
if (onewiregpio_sensor_1d9a1ad9_temperature.state > Tempa ) {
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
])
Tempa = 150
if (onewiregpio_sensor_1d9a1ad9_temperature.state > Tempb ) {
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
])
Tempb = 150
Tempc = 28
Tempf = 25
createTimer(now.plusMillis(10000), [| ])
}
if (onewiregpio_sensor_1d9a1ad9_temperature.state > Tempc ) {
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
])
Tempc = 150
Tempd = 30
Tempg = 27
createTimer(now.plusMillis(10000), [| ])
}
if (onewiregpio_sensor_1d9a1ad9_temperature.state > Tempd ) {
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
])
Tempd = 150
Temph = 29
createTimer(now.plusMillis(10000), [| ])
}
if (onewiregpio_sensor_1d9a1ad9_temperature.state < Tempe ) {
Relais7.sendCommand(ON)
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
Relais7.sendCommand(OFF)
])
Tempe = -150
Tempa = 24
createTimer(now.plusMillis(10000), [| ])
}
if (onewiregpio_sensor_1d9a1ad9_temperature.state < Tempf ) {
Relais7.sendCommand(ON)
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais7.sendCommand(OFF)
Relais8.sendCommand(OFF)
])
Tempf = -150
Tempb = 26
createTimer(now.plusMillis(10000), [| ])
}
if (onewiregpio_sensor_1d9a1ad9_temperature.state < Tempg ) {
Relais7.sendCommand(ON)
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
Relais7.sendCommand(OFF)
])
Tempg = -150
Tempc = 28
createTimer(now.plusMillis(10000), [| ])
}
if (onewiregpio_sensor_1d9a1ad9_temperature.state < Temph ) {
Relais7.sendCommand(ON)
Relais8.sendCommand(ON)
createTimer(now.plusMillis(2000), [|
Relais8.sendCommand(OFF)
Relais7.sendCommand(OFF)
])
Temph = -150
Tempd = 30
createTimer(now.plusMillis(10000), [| ])
}
end