Hello
I have this rule to activate a door relay but it works once when I charge the rule but it does not work anymore, look if you see the problem
a greeting
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*.
rule "Entrada peatones"
when
Item Peatones_Ent changed
then
Puerta_Parcela.sendCommand(ON)
createTimer(now.plusSeconds(5)) [| Puerta_Parcela.sendCommand(ON) ]
createTimer(now.plusSeconds(15)) [| Puerta_Parcela.sendCommand(ON) ]
end
Hello, thanks for the response, the door is activated with the relay ON but seeing the log and as I have said it only works the first time I charge the rule. Use OH 1.8.3. a greeting
The question of @rossko57 was: “How is the Item Puerta_Parcela set to OFF after it has been switched to ON by your rule”.
Your rule does Switch this item to ON 3 times (first time immidiatly, second time 5 seconds after art and third time 15 seconds after start). I would assume you don’t “see” the second and third time as well.
Using lines like:
I don’t now a item-type button in openHAB. Do you mean a switch? A switch holds the state. If you change to ON you have to change also to OFF. The question was, there or how do you do, in a other rule or with expire or manually.
And why do you set 3 times to ON in the rule?
Is there a log-entry that Peatones_Ent was changed?
Hello, I have configured my OH as the wiki says I understand that it will be fine, I put my items and my sitemap, anyway I will try a simple light instead of the door. In any case, I am very bad at English. a greeting
hello, of course I have put my building (souliss), only the button if it works what does not work is the rule. The link is to the OH wiki where it explains how to make a button. a greeting
The thing is - if OpenHAB turns a switch ON, it stays ON forever. It will not turn ON again if you command it, because it is already ON.
We think you need a method to turn the OpenHAB Item OFF again, in-between the ON commands.
You can do that in the rule,
when
Item Peatones_Ent changed
then
Puerta_Parcela.sendCommand(ON)
Thread::sleep(1000)
createTimer(now.plusSeconds(5)) [|
Puerta_Parcela.sendCommand(ON)
Thread::sleep(1000) ]
createTimer(now.plusSeconds(15)) [|
Puerta_Parcela.sendCommand(ON)
Thread::sleep(1000) ]
end
Or, if this Item is only ever needed to be ON for a second or two (like a real push button) you might use the ‘expire’ binding to turn it OFF a few seconds after the last update.
hello at the end it has been a mix of the response of @rossko57 with the delays and @opus because by no side did the OFF come out at the end it has stayed that way
import org.openhab.core.library.types.*
import org.openhab.core.persistence.*
import org.openhab.model.script.actions.*
import org.joda.time.*
rule "Entrada peatones"
when
Item Peatones_Ent changed to ON
then
Puerta_Parcela.sendCommand(ON)
Thread::sleep(1000)
createTimer(now.plusSeconds(5)) [|
Puerta_Parcela.sendCommand(ON)
Thread::sleep(1000) ]
createTimer(now.plusSeconds(15)) [|
Puerta_Parcela.sendCommand(ON)
Peatones_Ent.sendCommand(OFF)
Thread::sleep(1000) ]
end