I have my skylights controlled by 2 smart outlets. One outlet closes the skylights and the other opens them using the nomally open/normally closed wires. It takes 24 seconds for open or close. I use a virtual switch which turns either the closed or open outlet on for 24 seconds respectively. This works brilliantly. I know it would be easier with a fibaro garage door opener or similar, however I have these outlets hanging around so why not use them! So at the moment my skylights are fully open or fully closed. I was looking to use a virtual dimmer to control them, but I don't know where to begin. I.e. if dimmer 100% then open for 24 seconds, if dimmer 50% then open for 12 Seconds and so on. I assume I do this with a GV but I don't understand how to do the math logic. Any help would be greatly appreciated. Thanks in advance for reading and helping
If you think of the amount of openness as a percentage 0 to 100, with 0 closed and 100 fully open, you know that it takes 24 seconds to go from 0 to 100, right? So, you want to control it with a number between 0 and 100, just like a dimmer. I did something like this for shades, doing positioning through calculation based on timing..
You need a controller, how about a virtual dimmer? This could be derived from a number variable connector, and this will allow you to do the math. You need to set the dimmer to 0 if you know through event that the skylight is closed, and to set it to 100 if you know it is fully open.
Let's call its current position Y and where we want it be X. If Y > X we need to close it by (Y - X), and if Y < X we need to open it by (X - Y). Whatever that number is, multiplied by 24 and divided by 100 ( the percentage) is the number of seconds to run which ever side we need, open or close. That's easy with two actions:
On: open-outlet
Off: open-outlet Delay (that number of seconds)
With a decimal variable in RM you can do the variable math for multiple times 0.24. There is a bit of complexity here to deal with, since you want an answer like 3.2 seconds, and a dimmer has integer values only. A decimal variable will work for this. So our current position gets put into a decimal variable after each action. And the (Y - X) * 0.24 math gets done into another decimal variable, and then that variable is used in the Delay.
Cheers for this. It's blown my head a little but the more I read it, there more the sense it makes. I'm sure I'll get there with a lot of tinkering today in RM. Appreciate your detailed response
@bravenel , I've been messing around for a lot of today and think I'm making progress with different tests. What i can't work out is how to do variable math with several elements of the formula. I.e i can do one variable minus another variable but that's where it ends. How can I do X-Y *24/100 for example. Any screenshots would be appreciated. However, slowly moving in the right direction and appreciate your support
Brilliant, that makes such sense and i've tested it. Its flawless! ok, for the next steps now....Thanks Again