Hi everyone.
I’ve been using WebCoRE with my SmartThings hub for more than half a year now, I have many pistons created for different automations at home, and I love it.
One of the main resons I started using WebCoRE was because I had bought Aeotec Nano Shutters (z-wave shutter motor controllers) and the device handler was extremely limited (it would only allow me to fully open or fully close the blinds), so I needed WebCoRE to send stop commands. While learning how to use WebCoRE I created all the pistons that currently automate my home.
Now I got an update for my blinds controllers and they can be used as dimmer switches, with the percentage being the position of the blinds, so I need to redesign my pistons and I’d like to improve them a bit too.
Currently I have a piston that uses a time variable to send the open/close/stop commands and open or close my blinds sequentially. I would like to create a new one that calculates the time it has to wait between sending the commands to each controller.
Let’s say blind 1 is at 50% (half open), 2 is at 100% (fully open) and 3 is at 70% (almost fully open). The full travel time between 0 and 100% is 21 seconds.
I want a piston that, when setting its simulated dimmer switch to 0%, does something like this:
Read blind 1 percentage (50%), calculate travel time (11,5s), set blind 1 to 0%
wait 11,5s +1s
Read blind 2 percentage (100%), calculate travel time (21s), set blind 2 to 0%
wait 21s +1s
Read blind 3 percentage (70%), calculate travel time (14,7s), set blind 3 to 0%
Wait 14,7s, stop.
How would I write this formula?
Also, I’d like to have a way to stop the piston. Maybe a separate button or maybe the OFF state being the “stop” action. Something like:
IF all-blinds-dimmer changes,
perform all the calculations and send the commands, at the end turn off this switch
IF all-blinds-dimmer changes to OFF
send STOP command
Would the OFF state necessarily mean that the first IF will close all the blinds? How do I avoid this?
Thanks!
Rodrigo