Page 1 of 1

how to run script from switchcommand

Posted: Wednesday 04 December 2024 16:43
by BartSr
Hi,
I created a dzventsscript which I use to control a tft screen running on esp
I want to sent two http commands after each other:
- clear screen
- set text on screen

but as a matter of facts only the clear screen is executed

Code: Select all

return {

on = {
		devices = {1665},
      },

	execute = function(dz)
	        dz.openURL({ url = "http://192.168.2.230/control?cmd=tftcmd,clear" })
	        dz.openURL({ url = "http://192.168.2.230/control?cmd=tft,txz,10,10,hallo" })


	end
}
any suggestions?

Re: how to run script from switchcommand

Posted: Wednesday 04 December 2024 17:46
by HvdW
First test if just the second line executes as expected and watch the log.

Re: how to run script from switchcommand

Posted: Wednesday 04 December 2024 20:30
by BartSr
yes, the 2nd line is fine as well
if I use a browser for both and execute one after each other it goes well but same in script gives random answers. once just only the hallo next time nothing

Re: how to run script from switchcommand

Posted: Thursday 05 December 2024 2:14
by solarboy
You could try to add ".afterSec(1)" after the second command.