Is it possible to sync multiple calls?

Easy to use, 100% Lua-based event scripting framework.

Moderator: leecollings

Post Reply
Timmiej93
Posts: 64
Joined: Saturday 26 December 2015 0:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Is it possible to sync multiple calls?

Post by Timmiej93 »

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:

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
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.
Last edited by Timmiej93 on Friday 05 January 2018 13:57, edited 1 time in total.
dannybloe
Posts: 1355
Joined: Friday 29 August 2014 11:26
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: Ermelo
Contact:

Re: Is it possible to sync multiple calls?

Post by dannybloe »

Timmiej93 wrote: 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!
Well thank your for the compliments! Glad you enjoy it.

So, back to the question. I'm not really sure if that's possible. Have you tried to put all the devices in a group and switch that group? (Not sure if that works or changes anything. I think Domoticz will switch them one by one anyway but maybe it is faster.

Where does the 'red' come from? i don't see it defined in the code anywhere.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
Timmiej93
Posts: 64
Joined: Saturday 26 December 2015 0:37
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Is it possible to sync multiple calls?

Post by Timmiej93 »

I haven't tried that, no, maybe that'll work, thanks for the suggestion.

Yes, I noticed after posting that there was an error there, I tend to make mistakes like that :p

Edit:
Running a quick test on having all the lights in a group: It gives me the same result. Lights go out one by one, I'm guessing that's just how domoticz handles it unfortunately.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 1 guest