Slow execution of http commands in Domoticz towards ESPEasy

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
DeNB3rt
Normal user
Posts: 120
Joined: 15 Dec 2015, 14:07

Slow execution of http commands in Domoticz towards ESPEasy

#1 Post by DeNB3rt » 17 Jan 2017, 17:17

Hi all

question, I know it's more an issue in Domoticz then in ESPEasy firmware.
But maybe anybody here found a solution for this :)


When I use http requests in the On/Off action, it takes aprox. 1sec when action is executed.

e.g.

Code: Select all

 http://<ESP IP address>/control?cmd=GPIO,<pin>,1
(example image, did not test yet with the json.htm)
Image

So I moved to LUA script, that makes it all a bit faster aprox ~200ms
Sometimes a bit faster, sometimes slower.
I can currently live with that :)

Code: Select all

if devicechanged["kerstboom"] then
IP = "192.168.0.100";
RELAYPIN = 5;
print ("kerstboom trigered!");
    if(devicechanged["kerstboom"]=='Off') then
     runcommand = "curl http://" .. IP .. "/control?cmd=gpio,"  ..RELAYPIN.. ",1" .. " ";
     print("Relaypin " .. RELAYPIN .. " OFF command " .. runcommand);
     os.execute(runcommand);
    else if(devicechanged["kerstboom"]=='On') then
        runcommand = "curl http://" .. IP .. "/control?cmd=gpio,"  ..RELAYPIN.. ",0" .. " ";
        print("Relaypin " .. RELAYPIN .. " ON command " .. runcommand);
        os.execute(runcommand);
    end
end  
Log:

Code: Select all

2017-01-17 17:10:19.956 User: domoticz initiated a switch command (13/kerstboom/Off)
2017-01-17 17:10:20.187 LUA: kerstboom trigered!
2017-01-17 17:10:20.187 LUA: Relaypin 5 OFF command curl http://192.168.0.100/control?cmd=gpio,5,1

But, when I do multiple calls at the same time by changing the commandArray, it's extremely slow.
For 3 calls it takes aprox ~2.5sec ok, it do work, but its sloooow ;)

Code: Select all

commandArray['kerstboom']='Off'
commandArray['keuken_dimmer']='Off'
commandArray['living_verlichting']='Off'

Code: Select all

2017-01-17 17:12:33.745 User: domoticz initiated a switch command (20/livingkeuken/On)
2017-01-17 17:12:33.995 LUA: alles uit trigered!
2017-01-17 17:12:33.999 EventSystem: Script event triggered: customevent
2017-01-17 17:12:33.749 (ESPEasy nodemcu 1 0.231) Light/Switch (livingkeuken)
2017-01-17 17:12:34.226 LUA: kerstboom trigered!
2017-01-17 17:12:34.226 LUA: Relaypin 5 ON command curl http://192.168.0.100/control?cmd=gpio,5,0
2017-01-17 17:12:34.003 (ESPEasy nodemcu 2 0.100) Light/Switch (kerstboom)
2017-01-17 17:12:35.015 LUA: living_verlichting trigered!
2017-01-17 17:12:35.015 LUA: Relaypin 13 ON command curl http://192.168.0.231/control?cmd=gpio,13,1
2017-01-17 17:12:34.780 (ESPEasy nodemcu 1 0.231) Light/Switch (living_verlichting)
2017-01-17 17:12:35.706 LUA: ON dimm stored value = 716
2017-01-17 17:12:35.706 LUA: Relaypin 5 ON command curl http://192.168.0.231/control?cmd=gpio,5,0
2017-01-17 17:12:36.558 LUA: PWM calculated value= 716
2017-01-17 17:12:35.445 (ESPEasy nodemcu 1 0.231) Light/Switch (keuken_dimmer)
It must be something with the handling in domotics,because doing the request directly on the domoticz host http or json, the request is almost instant.
I'm sure if I would write a C# console app, I could call multithreaded 3 json call's and the result would be instant.
But that's not possible in Domoticz, or am I wrong?

Does anybody know what I could try or change? :) ty :!:
Located in Belgium, Bruges. Working on a full DIY domoticz setup with ESPEasy.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 99 guests