guowenxue
2019-07-16 4a84ac1e75212a5625ff6b83c413692bb83ce95d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
 
progname=mosquitto_pub
 
hostname="master.iot-yun.com"
port=10883
uid="lingyun"
pwd="lingyun-emb"
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
 
$pub_uplink_cmd '{"id":"rpi3b001", "temp":"25.6" }'
sleep 1
 
$pub_downlink_cmd '{"id":"rpi3b001", "light":"on" }' 
sleep 1
 
$pub_downlink_cmd '{"id":"rpi3b001", "led":[ {"red":"on", "green": "off", "blue":"off"} ] }'
sleep 1
 
$pub_downlink_cmd '{"id":"rpi3b001", "buzzer" : "on" }'
sleep 1
 
#$pub_downlink_cmd '{"id":"rpi3b001", "buzzer" : "music" }'
#sleep 1
 
$pub_downlink_cmd '{"id":"x86host02","camera" :  "on" }'
sleep 1
 
$pub_downlink_cmd '{"id":"rpi3b001", "light":"on", "buzzer":"on", "led":[ {"red":"on", "green":"off", "blue":"off"} ] }'  
sleep 1