Page 1 of 1

os.execute mqtt commands

Posted: Sunday 09 February 2020 22:31
by adval40
I want send commands to my mqtt server with dzvents
I think i have an error with quotes

Code: Select all

execute = function(domoticz, device)
		
		domoticz.log(device.state)
		
		if (device.state =='On') then 
	    		os.execute('mosquitto_pub -h 127.0.0.1 -t milight/0x40/cct/0 -u mqtt -P mqtt -m {"status":"on"}  ')
	    	elseif (device.state =='Off') then 
	    		os.execute('mosquitto_pub -h 127.0.0.1 -t milight/0x40/cct/0 -u mqtt -P mqtt -m {"status":"off"} ')	
	  	end
can anyone tell me the exact settings?

Re: os.execute mqtt commands

Posted: Sunday 09 February 2020 22:38
by jvdz
maybe ?:

Code: Select all

os.execute('mosquitto_pub -h 127.0.0.1 -t milight/0x40/cct/0 -u mqtt -P mqtt -m \'{"status":"on"}\'  ')
Jos

Re: os.execute mqtt commands  [Solved]

Posted: Sunday 09 February 2020 23:31
by adval40
it works

thanks Jos

greetings from eindhoven