Page 1 of 1

mqtt domoticz/in with motion sensor

Posted: Monday 30 March 2020 14:51
by bend94
Hi,

i created a dummy motion sensor, with that commands i can put the motion on or off
curl "http://192.168.0.6:8080/json.htm?type=c ... itchcmd=On"
curl "http://192.168.0.6:8080/json.htm?type=c ... tchcmd=Off"

My goal is to use mqtt. Now i would like to do the same but with mosquitto_pub command like :

sudo mosquitto_pub -h localhost -m '{"idx" : 12, "switchcmd" : "On" }' -t 'domoticz/in'

this syntax doesn't work but the message is received correctly by domoticz, i can see that in the log
020-03-30 14:50:04.363 Status: Incoming connection from: 192.168.0.6
2020-03-30 14:50:57.320 MQTT: Topic: domoticz/in, Message: {"idx" : 12, "switchcmd" : "On" }
2020-03-30 14:50:57.321 Error: MQTT: Invalid data received!

Do you know what is the good syntax to do that with mosquitto_pub ?
thanks
regards

Re: mqtt domoticz/in with motion sensor

Posted: Monday 30 March 2020 15:00
by waaren
bend94 wrote: Monday 30 March 2020 14:51 2020-03-30 14:50:57.320 MQTT: Topic: domoticz/in, Message: {"idx" : 12, "switchcmd" : "On" }
2020-03-30 14:50:57.321 Error: MQTT: Invalid data received!
Try with

Code: Select all

mosquitto_pub -m '{"command" : "udevice", "idx": 12, "nvalue": 0 }' -t domoticz/in

Re: mqtt domoticz/in with motion sensor

Posted: Tuesday 31 March 2020 8:38
by bend94
hi ok thx working now
one last question: is it possible to add the battery level in a "dummy motion sensor" devices ?

regards