os.execute.aftersec
Moderator: leecollings
-
markjgabb
- Posts: 142
- Joined: Tuesday 24 January 2017 23:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Location: Australia
- Contact:
os.execute.aftersec
is there a way to get a delayed os.execute working in dzvents atm i have the following
os.execute('espeak welcome-home').afterSec(20)
but it seems to ifnore the aftersec and just runs it instantly.....
also not sure how to make longer that one word arguments os the os.execute as it will only take one word at the moment
os.execute('espeak welcome-home').afterSec(20)
but it seems to ifnore the aftersec and just runs it instantly.....
also not sure how to make longer that one word arguments os the os.execute as it will only take one word at the moment
V 2020.2 RPI 3
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
-
dannybloe
- Posts: 1355
- Joined: Friday 29 August 2014 11:26
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Ermelo
- Contact:
Re: os.execute.aftersec
os.execute is an os function that is not managed at all by dzVents. So no, that's not working unfortunately. Maybe you can create some bash function with an internal delay and execute that instead from your script.
Creator dzVents - RPi3, loads of zwave devices, esp8266, evohome.
-
markjgabb
- Posts: 142
- Joined: Tuesday 24 January 2017 23:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Location: Australia
- Contact:
Re: os.execute.aftersec
that sounds like a likely way to do it...simple and it works 
V 2020.2 RPI 3
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
-
BakSeeDaa
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: os.execute.aftersec
Below is an example how it can be done. This specific example calls an url using curl on a linux platform. The important thing is to release the control back to Domoticz immediately.
Code: Select all
local delay = 5
local url = 'http://somwebsite.com'
os.execute('(sleep '..delay..';curl -s "'..url..'" > /dev/null)&')-
markjgabb
- Posts: 142
- Joined: Tuesday 24 January 2017 23:00
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 3.8153
- Location: Australia
- Contact:
Re: os.execute.aftersec
have used this method and its works wonderfully thanks guys for the advice......now to laugh at wifes reaction when house welcomes her home later on
V 2020.2 RPI 3
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
RFlink 334 mhz
mysensors
broadlink
Mirabella Genio Globes
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: os.execute.aftersec
What is the reason you put this a the end: > /dev/null)&BakSeeDaa wrote: Tuesday 21 November 2017 8:28 Below is an example how it can be done. This specific example calls an url using curl on a linux platform. The important thing is to release the control back to Domoticz immediately.Code: Select all
local delay = 5 local url = 'http://somwebsite.com' os.execute('(sleep '..delay..';curl -s "'..url..'" > /dev/null)&')
I use os.execute as well but then just the URL :
Code: Select all
os.execute('curl "http://127.0.0.1:8081/json.htm?type=command¶m=setcolbrightnessvalue&idx=3&hue=18&brightness=50&iswhite=false"')RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
BakSeeDaa
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: os.execute.aftersec
It's a redirection (discard) of the command output (not necessary) followed by the ampersand sign that will cause the command to run in the background. (prevents delays caused by waiting for the command to finish)poudenes wrote: Tuesday 21 November 2017 13:49
What is the reason you put this a the end: > /dev/null)&
I use os.execute as well but then just the URL :
Code: Select all
os.execute('curl "http://127.0.0.1:8081/json.htm?type=command¶m=setcolbrightnessvalue&idx=3&hue=18&brightness=50&iswhite=false"')
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: os.execute.aftersec
Thanks for the "always" great help!!!. I will add them as well thenBakSeeDaa wrote: Tuesday 21 November 2017 14:59It's a redirection (discard) of the command output (not necessary) followed by the ampersand sign that will cause the command to run in the background. (prevents delays caused by waiting for the command to finish)poudenes wrote: Tuesday 21 November 2017 13:49
What is the reason you put this a the end: > /dev/null)&
I use os.execute as well but then just the URL :
Code: Select all
os.execute('curl "http://127.0.0.1:8081/json.htm?type=command¶m=setcolbrightnessvalue&idx=3&hue=18&brightness=50&iswhite=false"')
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
BakSeeDaa
- Posts: 485
- Joined: Thursday 17 September 2015 10:13
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
Re: os.execute.aftersec
Your'e welcome. Don't forget the inner parenthesis which is crucial for it to work.poudenes wrote: Tuesday 21 November 2017 15:01 Thanks for the "always" great help!!!. I will add them as well then![]()
-
poudenes
- Posts: 667
- Joined: Wednesday 08 March 2017 9:42
- Target OS: Linux
- Domoticz version: 3.8993
- Location: Amsterdam
- Contact:
Re: os.execute.aftersec
So it will look like this then
Code: Select all
os.execute('(curl -s "http://127.0.0.1:8081/........iswhite=false" > /dev/null)&')RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
-
Nautilus
- Posts: 722
- Joined: Friday 02 October 2015 12:12
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Finland
- Contact:
Re: os.execute.aftersec
This should be enough when you don't need the separate sleep command:
Code: Select all
os.execute('curl -s "http://127.0.0.1:8081/json.htm?type=command¶m=setcolbrightnessvalue&idx=3&hue=18&brightness=50&iswhite=false" &')-
ben53252642
- Posts: 543
- Joined: Saturday 02 July 2016 5:17
- Target OS: Linux
- Domoticz version: Beta
- Contact:
Re: os.execute.aftersec
Using this in a Lua script to run multiple commands using os.execute, thanks!
Code: Select all
os.execute ('(/bin/sleep 4 && /usr/bin/curl -s "http://192.168.0.5:1880/hueapi?devicename=lightstripmainbathmirror&state=on&brightness=254&r=0&g=0&b=0&colortemp=351&transition=0.5")&')Unless otherwise stated, all my code is released under GPL 3 license: https://www.gnu.org/licenses/gpl-3.0.en.html
Who is online
Users browsing this forum: No registered users and 1 guest