--- title: LINE Notify tags: ThingsBoard image: --- # LINE Notify * [申請 LINE Notify Token](https://notify-bot.line.me/login) * ==UGS-Pilot== * [LINE Notify API Document](https://notify-bot.line.me/doc/en/) ```bash= curl -X POST -H 'Authorization: Bearer [access_token]' -F 'message=foobar' https://notify-api.line.me/api/notify curl -X POST -H 'Authorization: Bearer DCRyN7hrQwlzll9VjD5QASWnqUO24KCO8K0POkwmwuw' -F 'message=foobar' https://notify-api.line.me/api/notify ``` ## Thingsboard ### Rule Engine * Main: Gas Cylinder Level Sensor ( Device profile 套用相對應的 Rule ! ) * Create & Clear Alarms (在 Main rule 流程中,判定何種狀態會到 Clear and Alarm 這規則) Example: > Main: ![](https://i.imgur.com/dFX0CLI.png) > Create & Clear Alarms ![](https://i.imgur.com/LObI9IL.png) > tenant attributes ![](https://i.imgur.com/35yNDhf.png) > script ``` var newMsg ={}; newMsg.text = '瓦斯桶感測告警' + '\n設備名稱: [' + metadata.deviceName + ']' + '\n即時資訊:' + msg.details.data; return {msg: newMsg, metadata: metadata, msgType: msgType}; ``` > rest api call ![](https://i.imgur.com/715NxpT.png) ```json= { "tenantId": { "entityType": "TENANT", "id": "bf280cf0-1588-11ea-a07b-510cd1df43ec" }, "customerId": { "entityType": "CUSTOMER", "id": "339eb790-ca56-11eb-a06d-3fc4b2588d74" }, "type": "Low battery", "originator": { "entityType": "DEVICE", "id": "f1da6240-e608-11eb-aba1-312155758829" }, "severity": "CRITICAL", "status": "ACTIVE_UNACK", "startTs": 1631522996000, "endTs": 1631522996000, "ackTs": 0, "clearTs": 0, "details": { "data": "Current battery = 10" }, "propagate": false, "propagateRelationTypes": [], "id": { "entityType": "ALARM", "id": "9b252170-146f-11ec-b4b1-8f1f8c6238a1" }, "createdTime": 1631523011847, "name": "Low battery" } ```