guowenxue
2021-04-21 a01524eb28cce72db4b499ec242995fbf99b6b7a
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
#!/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