Dobrica Pavlinušić's random unstructured stuff
MQTT: Revision 4

monitor all messages

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

mosquitto

configure websockets

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

listener 1883

listener 9001
protocol websockets

shell clients

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

sonoff

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