how to run script from switchcommand

Moderator: leecollings

Post Reply
BartSr
Posts: 365
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

how to run script from switchcommand

Post 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?
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
HvdW
Posts: 538
Joined: Sunday 01 November 2015 22:45
Target OS: Raspberry Pi / ODroid
Domoticz version: 2023.2
Location: Twente
Contact:

Re: how to run script from switchcommand

Post by HvdW »

First test if just the second line executes as expected and watch the log.
Bugs bug me.
BartSr
Posts: 365
Joined: Sunday 03 July 2016 16:16
Target OS: Raspberry Pi / ODroid
Domoticz version: V2024.7
Location: Netherlands
Contact:

Re: how to run script from switchcommand

Post 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
Raspberry pi 3b
Arduino
KAKU
RfxCom
Zwave2MQTT
OTGW
Chinese sensors temp (Dallas),movement
Tasmota
Esp8266 / 32 espeasy
Zigbee2MQTT
solarboy
Posts: 320
Joined: Thursday 01 November 2018 19:47
Target OS: Raspberry Pi / ODroid
Domoticz version: 2024.6
Location: Portugal
Contact:

Re: how to run script from switchcommand

Post by solarboy »

You could try to add ".afterSec(1)" after the second command.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),SMA Hub (docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests