deladus
(Dennis Lang)
1
Hello all,
at the moment I try to program a variable Timer for my Bathroom Heater.
in the past i used a fix timer:
.....
createTimer(now.plusMinutes(90)) [|
if (MyHeaterBath.state != "ECO") {
sendCommand(MyHeaterBath,"ECO")
}
....
Now I want to Excange the fixed Minutes to a variable value
Fist I create an Item:
Number Heattimer
and set a Setpoint item in my sitemap:
setpoint item=Heattimer minValue=1 maxValue=150 step=1
My event Log shows, dass my Items value is changed to the set value. So it works to Set the wanted Minute value
My Rules I changed like this:
.....
createTimer(now.plusMinutes((Heattimer.state as DecimalType).intValue)) [|
if (MyHeaterBath.state != "ECO") {
sendCommand(MyHeaterBath,"ECO")
}
....
I tried also:
.....
createTimer(now.plusMinutes(Heattimer.state)) [|
if (MyHeaterBath.state != "ECO") {
sendCommand(MyHeaterBath,"ECO")
}
....
and
.....
createTimer(now.plusMinutes(Heattimer)) [|
if (MyHeaterBath.state != "ECO") {
sendCommand(MyHeaterBath,"ECO")
}
....
But the Heater is not switching off after the set Minutes. What i Do wrong? Can anybody help me?
BR
Dennis
vzorglub
(Vincent Regaud)
2
You are on the right track…
val Integer TIMER_TIME = (Heattimer.state as DecimalType).intValue
createTimer(now.plusMinutes(TIMER_TIME), [ |
if (MyHeaterBath.state != "ECO") {
MyHeaterBath.sendCommand("ECO")
}
])
deladus
(Dennis Lang)
3
Thank you, but it doesn’t work
(I recognize your small mistake with TIMERTIME and TIMER_TIME - this is not the cause )
EDIT: It works I make another mistake! Thanks!
vzorglub
(Vincent Regaud)
4
Coolio, please mark the thread as solved. Thanks
Instead of using
val Integer TIMER_TIME = (Heattimer.state as DecimalType).intValue
you could also use
val Integer TIMER_TIME = Heattimer.state as Number
1 Like
vzorglub
(Vincent Regaud)
6
Nice.
Didn’t know you could cast into integers like that
MechD
(Mike Anderson)
7
Hey gentlemen, what is ”ECO” in the code?
Mike
rossko57
(Rossko57)
8
It’s a string that means something to the person who wrote the code. It’s not a magic word or anything.
deladus
(Dennis Lang)
10
“ECO” is a string like @vzorglub has written.
In this case “ECO” is the STring for the ECO-Mode of my Themostat. The Themostat knows to set the Temperature to 17°C if this command is received.
The setting of ECO mode is saved into my fritzbox router, which is also the bridge for the Themostat.
greets and EXTERMINATE!!!