Is it possible to sync multiple calls?
Posted: Friday 05 January 2018 12:37
First of all, I'd like to say that I'm absolutely in love with dzVents. I had to write bash scripts back in the days to do what I wanted, being much more cumbersome in both the code, how to edit them, and how to use them. dzVents has made this SO much faster and easier, love it!
Now, I'm wondering if it's possible to sync calls, instead of having them happen one by one. For example, I'm using an RGBW LED strip. For some odd reason, I want to have a script that turns my lights off after x amount of seconds, but gives me a hint that it's actually going to happen first. So my script currently is like this:
As you can see, what I'm trying to do is:
- Turn everything off
- Quickly flash the R channel of the LED Strip to signal that the command has been received
- Tun everything back on to the same state it was before
- Turn everything of after x seconds
Now, while this works, It's currently pretty obvious that all channels are being switched one by one, making the red flash less noticeable. Is there a way to sync these calls, so they happen simultaneously somehow?
Please keep in mind that this is purely for style points, it's no annoyance or anything like that, just something that I'd like to have.
Now, I'm wondering if it's possible to sync calls, instead of having them happen one by one. For example, I'm using an RGBW LED strip. For some odd reason, I want to have a script that turns my lights off after x amount of seconds, but gives me a hint that it's actually going to happen first. So my script currently is like this:
Code: Select all
execute = function(domoticz, triggeredItem, info)
if (triggeredItem.active) then
local r,g,b,w = domoticz.devices("Red"), domoticz.devices("Green"), domoticz.devices("Blue"), domoticz.devices("White")
local dimmer = domoticz.devices("Dimmer")
r.switchOff().forSec(0.1)
g.switchOff().forSec(0.1)
b.switchOff().forSec(0.1)
w.switchOff().forSec(0.1)
r.dimTo(100).forSec(0.1)
dimmer.switchOff().afterSec(10)
end
end
- Turn everything off
- Quickly flash the R channel of the LED Strip to signal that the command has been received
- Tun everything back on to the same state it was before
- Turn everything of after x seconds
Now, while this works, It's currently pretty obvious that all channels are being switched one by one, making the red flash less noticeable. Is there a way to sync these calls, so they happen simultaneously somehow?
Please keep in mind that this is purely for style points, it's no annoyance or anything like that, just something that I'd like to have.