Skip to content

Instantly share code, notes, and snippets.

@markus-li
Last active January 4, 2020 19:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markus-li/ff407c891834a8e2670268ddd52b8330 to your computer and use it in GitHub Desktop.
Save markus-li/ff407c891834a8e2670268ddd52b8330 to your computer and use it in GitHub Desktop.
// Updated with the current Curtain location
Mem1 100
// Step for each increase
Mem2 11
// delay in 10th of a second (1 = 100ms)
Mem3 4
Mem4 9 // Motor startup steps
Mem5 1 // Extra step when opening
// Set delay between Backlog commands
Delay 15
Rule1 ON Dimmer#State DO Mem1 %value%; ENDON
// Closing
Rule1 + ON TuyaReceived#Data=55AA00070005650400010277 DO Backlog Var1 %mem1%; Var2 Go; Var5 C; Add1 %mem2%; Sub1 %mem4%; Var4 %mem2%; Event Go; ENDON
Rule1 + ON Event#Go DO Backlog Dimmer %var1%; Event %var5%%var1%; Event %var2%2; ENDON
Rule1 + ON Event#Go2 DO Backlog Add1 %var4%; Delay %mem3%; Event %var1%; Event %var2%; ENDON
Rule1 + ON Event#O-7 DO Var2 sC; ENDON ON Event#O-8 DO Var2 sC; ENDON ON Event#O-9 DO Var2 sC; ENDON ON Event#O-10 DO Var2 sC; ENDON ON Event#O-11 DO Var2 sC; ENDON
Rule1 1
// Opening
Rule2 ON TuyaReceived#Data=55AA00070005650400010176 DO Backlog Var1 %mem1%; Var2 Go; Var5 O; Sub1 %mem2%; Add1 %mem4%; Var4 %mem2%; Add4 %mem5%; Mult4 -1; Event Go; ENDON
Rule2 + ON Event#sC DO Backlog Var2 sC2; Event sC2; ENDON
Rule2 + ON Event#sC2 DO Backlog Var2 sC2; TuyaSend4 101,1; ENDON
// Stop
Rule2 + ON TuyaReceived#Data=55AA00070005650400010075 DO Var2 sC3; ENDON
Rule2 + ON Event#C107 DO Var2 sC; ENDON ON Event#C108 DO Var2 sC; ENDON ON Event#C109 DO Var2 sC; ENDON ON Event#C110 DO Var2 sC; END ON ON Event#C111 DO Var2 sC; ENDON
Rule2 1
Rule3 ON Event#C100 DO Var2 sC; ENDON ON Event#C101 DO Var2 sC; ENDON ON Event#C102 DO Var2 sC; ENDON ON Event#C103 DO Var2 sC; ENDON ON Event#C104 DO Var2 sC; ENDON ON Event#C105 DO Var2 sC; ENDON ON Event#C106 DO Var2 sC; ENDON ON Event#O0 DO Var2 sC; ENDON ON Event#O-1 DO Var2 sC; ENDON ON Event#O-2 DO Var2 sC; ENDON ON Event#O-3 DO Var2 sC; ENDON ON Event#O-4 DO Var2 sC; ENDON ON Event#O-5 DO Var2 sC; ENDON ON Event#O-6 DO Var2 sC; ENDON ON Event#O-12 DO Var2 sC; ENDON
@meingraham
Copy link

timestamp? Not sure that's a built in variable.

@markus-li
Copy link
Author

Timestamps don't exist, but I did come up with a way to do it, without IFs, timestamps or anything else fancy... Just made sure I had a PWM defined on a pin I don't need so I get the dimmer command, then this works flawlessly...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment