Add push-button toggle for roller shutters

Martin Weinelt 2019-11-18 19:04:36 +01:00
parent c42754676c
commit a70728d7a7
1 changed files with 31 additions and 0 deletions

@ -40,6 +40,7 @@
- [Garage Door Opener](#Garage-Door-Opener)
- [Remote Control Button Multi-press](#Remote-Control-Button-Multi-press)
- [Two-way light switches without MQTT](#two-way-light-switches-without-mqtt)
- [Roller shutter push-button toggle](#roller-shutter-push-button-toggle)
------------------------------------------------------------------------------
#### Use long press action on a switch
@ -1493,3 +1494,33 @@ Backlog Rule1 1; Rule2 1; Rule3 1
[Back To Top](#top)
------------------------------------------------------------------------------
#### Roller shutter push-button toggle
With e.g. Shelly 2.5 configured for a roller shutter with two relays you can also connect your regular push-button switches and set up inverted toggle behaviour. Pressing a push-button once makes the roller shutter move in a direction, pressing it again stops it. The rules each use a variable to remember the state they're in, where `0 == Stopped` and `1 == Moving`.
```lua
Backlog SwitchTopic 0; SwitchMode1 4; SwitchMode2 4
Rule1
ON System#Boot DO Var1 0 ENDON
ON Switch1#State==1 DO Add1 1 ENDON
ON Var1#State==0 DO ShutterStop1 ENDON
ON Var1#State==1 DO ShutterClose1 ENDON
ON Var1#State>=2 DO Var1 0 ENDON
ON Shutter1#Close DO Var1 0 ENDON
Rule2
ON System#Boot DO Var2 0 ENDON
ON Switch2#State==1 DO Add2 1 ENDON
ON Var2#State==0 DO ShutterStop1 ENDON
ON Var2#State==1 DO ShutterOpen1 ENDON
ON Var2#State>=2 DO Var2 0 ENDON
ON Shutter1#Open DO Var2 0 ENDON
Backlog Rule1 1; Rule2 1
```
[Back To Top](#top)
------------------------------------------------------------------------------