#!/bin/bash progname=mosquitto_pub hostname="master.iot-yun.club" port=10883 uid="lingyun" pwd="lingyun-emb" devid="RPi.3B-GP-0001" dltopic="\$Sys/Studio/Downlink" uptopic="\$Sys/Studio/Uplink" pub_downlink_cmd="$progname -h $hostname -p $port -u $uid -P $pwd -t "$dltopic" -m " pub_uplink_cmd="$progname -h $hostname -p $port -u $uid -P $pwd -t "$uptopic" -m " set -x echo $devid #$pub_uplink_cmd '{"id":"RPi.3B-GP-0001", "temp":"25.6" }' #$pub_downlink_cmd '{"id":"RPi.3B-GP-0001", "light":"off" }' $pub_downlink_cmd '{"id":"RPi.3B-GP-0002", "led":[ {"red":"off", "green": "off", "blue":"off"} ] }' #$pub_downlink_cmd '{"id":"RPi.3B-GP-0001", "buzzer" : "on" }' #$pub_downlink_cmd '{"id":"RPi.3B-GP-0001", "light":"off", "buzzer":"on", "led":[ {"red":"on", "green":"off", "blue":"off"} ] }' #$pub_downlink_cmd '{"id":"x86host02","camera" : "on" }' sleep 1