This page last changed on Oct 10, 2012 by nejc.

Hello

I would like to control roll shade with two relays (relay for up and down). To achieve this I need three buttons: UP, DOWN and STOP.

I also need virtual commands and rules that will trigger relays. Why all this? Let me explain:

Required responses:

  • when UP button is pressed, should "relay down" turn off and "relay up" turn on.
  • when DOWN button is pressed, should "relay down" turn on and "relay up" turn off.
  • when STOP button is pressed, should "relay down and up" turn off.

So I created three rules that will be triggered by three buttons.

The first step was to create three virtual commands (virtual UP, virtual DOWN, virtual STOP - all command status) and their sensors (all custom). I linked virtual commands with three buttons.

And rules:

rule " button UP is pressed and roll shade goes up"
when
Event(source == "virtual UP sensor")
then
execute.command("relay4 OFF");
execute.command("relay3 ON");
end

rule "button DOWN is pressed and roll shade goes down"
when
Event(source == "virtual DOWN sensor")
Then
execute.command("relay4 ON");
execute.command("relay3 OFF");
end

rule " button STOP is pressed and roll shade stops"
when
Event(source == "virtual STOP sensor")
then
execute.command("relay4 OFF");
execute.command("relay3 OFF");
end

But I have a problem. Only first press on the button triggers the relay.
For example: I press UP button and "relay up" turns on, then I press STOP button relay turns off, but if I press UP button again nothing happens.

I suspect that the rule operates continuously from the first press. Am I right and how to prevent this?

Thanks all,
Nejc

Unfortunately there is no direct way to trigger a rule from a button (it's somewhere on a todo list)
How did you implement the commands for the virtual protocol? Normally you need on/off and status.
This means once the virtual value is set to "on" and it's not set back to "off" the rule will only trigger once.
You can try to set the virtual value back to "off" in your rule and always trigger the "on" command from your button.

Posted by mredeker at Oct 11, 2012 08:44

Hi Marcus.

Exactly with this idea, I wake up today .
In the next hour I will tested it.

Thank you for your help.

Regards,
Nejc

Posted by nejc at Oct 11, 2012 08:52

Success!

This rules work:

rule "up"
when
Switch(source == "virtual UP sensor", value == "on")
then
execute.command("virtual DOWN off");
execute.command("virtual STOP off");
execute.command("rele4 OFF");
execute.command("rele3 ON");
end

rule "down"
when
Switch(source == "virtual DOWN sensor", value == "on")
then
execute.command("virtual UP off");
execute.command("virtual STOP off");
execute.command("rele3 OFF");
execute.command("rele4 ON");
end

rule "stop"
when
Switch(source == "virtual STOP sensor", value == "on")
then
execute.command("virtual DOWN off");
execute.command("virtual UP off");
execute.command("rele4 OFF");
execute.command("rele3 OFF");
end

I created three virtual switches: virtual DOWN on/off/status, virtual DOWN on/off/status, virtual DOWN on/off/status. Buttons call commands virtual UP/DOWN/STOP on.

Regards,
Nejc

Posted by nejc at Oct 11, 2012 09:23

You need such rules only if your hardware does not have XOR functionally.
There is another issue here and that is immediate direction change which has to protected (see Lentz law). There will be back EMF here unless you wait about Half a second.
I own Schneider hardware. It took me a while to figure out what to do since you also have the blinds angle to control. The Schneider can be configured by the switch panels to work with 2 buttons per blind using short and log press. I have mine working with no virtual switches yes currently needing 3 buttons.
When I will fine some time, I will convert it to the more natural way of 2 buttons.
BTW, I still have issue with the blinds sensor as it is being reported in the logs as erroneous.

Nir.

Posted by niraviry at Nov 06, 2012 20:09
Document generated by Confluence on Jun 05, 2016 09:31