os.execute and http link

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

Moderator: leecollings

Post Reply
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

os.execute and http link

Post by poudenes »

Hi Al,

Is it possible to have this in a dzvents script:

os.execute('http://127.0.0.1:8081/json.htm?type=com ... hite=false')

I want send some values to my milights to give them colours
RPi3 B+, Debain Stretch, Domoticz, Homebridge, Dashticz, RFLink, Milight, Z-Wave, Fibaro, Nanoleaf, Nest, Harmony Hub, Now try to understand pass2php
Freemann
Posts: 94
Joined: Thursday 24 November 2016 14:55
Target OS: Linux
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: os.execute and http link

Post by Freemann »

openURL()

Code: Select all

openURL("http://127.0.0.1:8081/json.htm?type=command&param=setcolbrightnessvalue&idx=3&hue=18&brightness=50&iswhite=false")
?
Domotica/graphs "freak" :)
NUC8i3BEH(8gb/250gb),
Lubuntu 19.04,
Aeotec Z-Stick S2(Gen5)
HarmonyElite
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl
poudenes
Posts: 667
Joined: Wednesday 08 March 2017 9:42
Target OS: Linux
Domoticz version: 3.8993
Location: Amsterdam
Contact:

Re: os.execute and http link

Post by poudenes »

find out that it has to be this

Code: Select all

os.execute('curl "http://127.0.0.1:8081/json.htm?type=command&param=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
Freemann
Posts: 94
Joined: Thursday 24 November 2016 14:55
Target OS: Linux
Domoticz version: >=Béta
Location: Netherlands
Contact:

Re: os.execute and http link

Post by Freemann »

If I'm right os.execute() will wait on the HTTP response and in the meantime will "hang" domoticz and prevent other processes to run.
The preferred way to do this is with:
openURL(url)

or' in dzVents;
domoticz.openURL(url)

Just my2 cents :)
Domotica/graphs "freak" :)
NUC8i3BEH(8gb/250gb),
Lubuntu 19.04,
Aeotec Z-Stick S2(Gen5)
HarmonyElite
HUE(5 bulbs, 2 blooms)
NetAtmo(complete setup)
MiLight iboxV6(2 MiLightBulbs)
IP-Cam

https://www.frijduurzaam.nl
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest