Dobrica Pavlinušić's random unstructured stuff
MQTT: Revision 4
^ monitor all messages

.pre
dpavlin@nuc:~$ mosquitto_sub -h rpi2 -v -t '#'
.pre

^ mosquitto

^^ configure websockets

.pre
pi@rpi2 /etc/mosquitto/conf.d $ cat rpi2.conf
log_type debug

listener 1883

listener 9001
protocol websockets
.pre

^ shell clients

.pre
pi@rpi2 ~ $ cat mqtt-tvservice.sh
#!/bin/sh -xe

host=`hostname -s`
mosquitto_sub -t cmnd/$host/tvservice | xargs -i sh -xc 'tvservice {}' | mosquitto_pub -t stat/$host/tvservice
.pre



^ sonoff

.pre
dpavlin@nuc:~$ mosquitto_pub -h rpi2 -t cmnd/sonoff2/power -m 0
dpavlin@nuc:~$ mosquitto_pub -h rpi2 -t cmnd/sonoff/power -m 1

dpavlin@nuc:~$ mosquitto_pub -h rpi2 -t cmnd/sonoff/ledstate -m 0
dpavlin@nuc:~$ mosquitto_pub -h rpi2 -t cmnd/sonoff/ledstate -m 1


.pre