Description
Milesight UG6X/UG56 gateway support build-in Node-red. This Node-Red example provides a solution for triggering SMS alarms using Node-Red. and takes an example of triggering an SMS alarm when the EM300 temperature exceeds 26°C.
Requirement
- Milesight Gateway(with cellular module): UG56/UG65/UG67
- LoRaWAN Sensor
- SIM cards and Mobile Phone
Configuration
Step 1: Check Cellular Status
Insert the SIM in the gateway . Go to Network>Interface>Cellular, set the required parameters and fill in regional SMS center number.
Keep cellular in the connected status.
Step 2: Connect the LoRaWAN Sensor to the Gateway
Please refer to this article about how to connect LoRaWAN nodes to milesight gateway:
Step 3: Launch Node-RED and Import Flow Example
1. Go to App > Node-RED page to enable Node-RED program and wait for a while to load the program, click Launch button to start Node-RED web GUI.
2. Log in the Node-RED web GUI. The account information is the same as gateway web GUI.
3. Click Import to import the node-red flow example by pasting the content or import the json format file.
Step 4: Node-RED Configuration
Flow structure:
Content:
[{"id":"8208c83dd9c34e3a","type":"tab","label":"流程 1","disabled":false,"info":"","env":[]},{"id":"58aad37bb390d15b","type":"LoRa Input","z":"8208c83dd9c34e3a","name":"","devEUI":"","extendedField":"","x":340,"y":260,"wires":[["af99ce753bad9c95"]]},{"id":"af99ce753bad9c95","type":"Device Filter","z":"8208c83dd9c34e3a","name":"EM300","eui":"24E124329D395846","x":540,"y":260,"wires":[["66fc1b32a2cde7f6"]]},{"id":"66fc1b32a2cde7f6","type":"Decoder","z":"8208c83dd9c34e3a","name":"","deviceType":"2","deviceTypeName":"","extendedField":"","x":760,"y":260,"wires":[["1a4677d654fcebcf"]]},{"id":"1a4677d654fcebcf","type":"switch","z":"8208c83dd9c34e3a","name":"","property":"payload.temperature","propertyType":"msg","rules":[{"t":"gt","v":"26","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":950,"y":260,"wires":[["6d682cc6c187654f","f761faf035fc7a79"]]},{"id":"6d682cc6c187654f","type":"SMS Output","z":"8208c83dd9c34e3a","name":"","phone":"","message":"The temperature exceeds the threshold. The value is {payload.temperature}","x":1150,"y":260,"wires":[]},{"id":"f761faf035fc7a79","type":"debug","z":"8208c83dd9c34e3a","name":"debug 1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":1080,"y":160,"wires":[]}]
(1) LoRa Input: To get all uplink message from Sensor in network server.
(2) Device Filter: Filter device by Device EUI. Here we configure it to filter EM300 by their device EUI.
(3) Decoder: Embedded Milesight LoRaWAN Node decoder code, choose model to use directly. Choose corresponding decoder for EM300 here.
If the Decode module does not exist and you need a sensor module, refer to this document to use function instead of the decode module.
(4) Switch: Use to set up judgement condition(If…).
More Milesight sensor parameter information in decoder code, get from https://github.com/Milesight-IoT/SensorDecoders
The example setting is triggered when the temperature is higher than 26℃.
(5) Debug: Display selected message properties in the debug sidebar tab and optionally the runtime log. Here, we use it to see sensor uplink package content, keep Output as payload by default.
(6) SMS Output: This is the output setting for the text message. You can fill in the phone number that add on the phone list before . And add alarm information to "message".
Step 5: Deploy and Check Result
1. Click Deploy to save all node-red configurations.
2. Check SMS, gateway will send an SMS alarm when the specified threshold is exceeded.
-------END-----