描述該指導文檔的場景,比如“員工首次配置打印機”。
安裝
https://blog.csdn.net/qq_36515349/article/details/107064006
傳遞設備數據
將使用來自本地PC的MQTT
、CoAP
或HTTP
協議來傳遞數據
安裝brew
官方步驟
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
出現問題:
Failed to connect to raw.githubusercontent.com port 443: Connection refused
解決方案:
用瀏覽器打開
保存到本地爲install.sh,cd到下載目錄,並更改權限:
chmod 777 install.sh
把install.sh拖入終端,或者在終端直接執行
install.sh
輸出:
==> This script will install:
/usr/local/bin/brew
/usr/local/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
...
出現問題:
error: RPC failed; curl 56 LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
fatal: the remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
解決方案:
執行如下命令:
git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
clone結束後再重新執行:
install.sh
安裝MQTT
執行如下命令:
brew install mosquitto
創建測試數據
創建一個文件夾存放需要的數據文件如下:
attributes-data.json
- 包含兩個設備屬性值:固件版本和序列號。
{"firmware_version":"1.0.1", "serial_number":"SN-001"}
telemetry-data.json
- 包含三個時間序列值:temperature, humidity and active flag。
{"firmware_version":"1.0.1", "serial_number":"SN-001"}
下載mosquitto.sh創建的文件夾中,並更改權限
chmod +x mosquitto.sh
打開mosquitto.sh並更改內容
# Set ThingsBoard host to "demo.thingsboard.io" or "localhost"
THINGSBOARD_HOST=localhost
# Replace YOUR_ACCESS_TOKEN with one from Device details panel.
ACCESS_TOKEN=A1_TEST_TOKEN
ACCESS_TOKEN的值來自於設備中某一設備的設備憑據