I made a timer to shut my light off after 15 minutes using: timer = createTimer(now.plusSeconds(900))
Is there a way to display the remaining time (or the value of the timer) ?
Thanks.
I made a timer to shut my light off after 15 minutes using: timer = createTimer(now.plusSeconds(900))
Is there a way to display the remaining time (or the value of the timer) ?
Thanks.
I use something for showing the value of a counter, maybe it also works on a timer (tell me if it does)
items:
...
Number ItemCount "Counter: [%d]" <gTest>
...
rule:
...
var Number counter = 0
...
ItemCount.postUpdate(counter)
...
@sihui, is something missing? Cause i can’t even get your example to work.
I get the error: Error during the execution of rule ‘MyTimer’: The name ‘counter’ cannot be resolved to an item or type.
You have to use the names you have set up for your timer … not my counter. This is only an example.
I don’t know if it also works for a timer …
Good luck.
As it didnt work with the times, i just wanted to see the basic works, meaning a value written on the display. That is why i took your example, just to see if i could write to the display. So i am curious to how you managed yours to work, with all the code.
Regards
Sure, no problem:
Item:
Group gTest
Contact FibEye1_Motion_C "Motionsensor: [%s]" (gTest) { zwave="3:command=sensor_binary" }
Number ItemFountainCount "Counter MotSens: [%d]" (gTest)
Rule:
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.java.math.*
import org.joda.time.*
var Number counter = 0
var Number lastCheck = 0
rule "Fountain ON" //when motion is detected 3 times
when
Item FibEye1_Motion_C changed from CLOSED to OPEN
then
counter = counter + 1
if(counter>2) {
sendCommand(Licht_UG_Fountain, ON)
}
ItemFountainCount.postUpdate(counter)
end
rule "Fountain OFF"
when
Time cron "0 * * * * ?"
then
if(lastCheck == counter) {
counter = 0
lastCheck = -1;
sendCommand(Licht_UG_Fountain, OFF)
} else {
lastCheck = counter
}
end
Sitemap:
Frame {
Group item=gTest label="Test" icon="wss3_test"
}