--- title: TB Gateway Custom Server Side RPC tags: ThingsBoard, ThingsBoard Gateway, RPC --- ## 透過 TB Gateway 新增自訂 RPC 設定 ### MQTT 1. 於 /etc/thingsboard-gateway/config/mqtt.json 新增自訂的 RPC ``` "serverSideRpc": [ ... { "deviceNameFilter": "shellyem.*", // shellyem- 開頭的 device 皆適用 "methodFilter": "info", // RPC method 名稱 "requestTopicExpression": "shellies/${deviceName}/command", // Publish Topic "valueExpression": "announce" // publish 的內容 } ] ``` * 此為 oneway RPC 設定,若需 twoway,則加上 ``` responseTopicExpression: "response/topic", // Subscribe Topic responseTimeout: 10000 ``` 2. 使用 RPC API `POST - /api/rpc/oneway/{deviceId}` || `POST - /api/rpc/twoway/{deviceId}` ``` { "method": "info" } ``` ## Issue * 反應時間過久 ( 約 6 s )
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up