Venetian Blinds script

Moderator: leecollings

Post Reply
woody4165
Posts: 476
Joined: Monday 14 March 2016 13:55
Target OS: Linux
Domoticz version: beta
Location: Rome, Italy
Contact:

Venetian Blinds script

Post by woody4165 »

Hi all

I would like to use a venetian blinds dummy switch to control my blinds.

What I would like to do is when is pressed Open or Close (On or Off), to let this command execute for x seconds and then go in a Stop status. And if the Stop command is pressed, to stop it immediately.

I've done such a simple script, but I don't think is the best.

Code: Select all

commandArray = {}

if (devicechanged['PersBasSalMain'] == 'On') then
    os.execute('curl "http://192.168.xx.yy/control?cmd=GPIO,zz,1"')
    os.execute('curl "http://192.168.xx.yy/control?cmd=GPIO,ww,0"')
    commandArray['PersBasSalMain'] = "Stop AFTER 10"
elseif (devicechanged['PersBasSalMain'] == 'Off') then
    os.execute('curl "http://192.168.xx.yy/control?cmd=GPIO,ww,1"')
    os.execute('curl "http://192.168.xx.yy/control?cmd=GPIO,zz,0"')
    commandArray['PersBasSalMain'] = "Stop AFTER 10"
elseif (devicechanged['PersBasSalMain'] == 'Stop') then
    os.execute('curl "http://192.168.xx.yy/control?cmd=GPIO,ww,1"')
    os.execute('curl "http://192.168.xx.yy/control?cmd=GPIO,zz,1"')
end

return commandArray
It seems that the timer (Stop AFTER 10) remain active also if I press the manual stop.
Example:
I press On, then press Stop after 2 secs, then press Off. The Off command should go in a Stop status after 10 secs, but it's like it gets the timer from the previous On and it stops after few secs.

Is there a better way to do it?

Thanks
Cubietruck - Linux cubietruck 4.13.16 (Debian GNU/Linux 8 (jessie)) + Domoticz + RFLink, Xiaomi Gateway, Owl USB, Yeelight Color and B/W, ESP8266, Broadlink RM2, Netatmo Thermostat
georgesattali
Posts: 84
Joined: Saturday 05 March 2016 16:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Location: France
Contact:

Re: Venetian Blinds script

Post by georgesattali »

Hello,
yes I think that "Stop AFTER 10" have got priority on manual stop.
I think you have to add a virtual device "PersBasSalMainStop10" and a "device" script for it.

The instruction commandArray['PersBasSalMain'] = "Stop AFTER 10" becomes commandArray['PersBasSalMainStop10'] = "Stop AFTER 10"
and a new "device" script : when commandArray['PersBasSalMainStop10'] becomes off, turn off your GPIOs.

In that way PersBasSalMain can be stopped any time and should act on yours blinds, whereas after 10s, virtual PersBasSalMainStop10 will also put them down.

I don't know the syntax you use with curl ; "...control?cmd=GPIO...", is that correct ?

Bye, GD
pollefinario
Posts: 21
Joined: Wednesday 10 February 2016 12:40
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: Venetian Blinds script

Post by pollefinario »

What are you using for controlling the blinds? Servo? Stepper motor?
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest