Node-RED flows with GPS multiunit SORACOM edition

Node-RED flow using GPS Multiunit SORACOM Edition. Each sub flow has the following functionality.

  • World map: Plot the current location on world map.
  • Dashboard: Show temperature, humidity, and battery level.
  • Direction: Show the direction of GPS multiunit.
  • Monitor: Monitor the current location. Once the out of bounds data was detected, send data to MQTT broker.

This site explains how to use GPS multiunit SORACOM Edition. This site explains how to send data to Node-RED server with SORACOM beam.


GPSマルチユニット SORACOM Editionを利用したNode-REDのフローです。サブフローごとに以下のことができます。

  • World map:地図上に現在位置をプロットします。
  • Dashbord:温湿度とバッテリーの状態を表示します。
  • Direction:GPSマルチユニットの向きを表示します。
  • Monitor:位置情報を監視し、範囲外の位置を検出した場合MQTTブローカーにデータを送信します。

GPSマルチユニット SORACOM Editionを利用する手順はこちらを、 SORACOM Beamを利用してNode-REDサーバへデータを送信する手順については、こちらを参考にしてください。

[{"id":"87d6c779.359978","type":"tab","label":"GPS","disabled":false,"info":""},{"id":"462baeec.62b32","type":"subflow","name":"Monitor","info":"","category":"","in":[{"x":140,"y":120,"wires":[{"id":"b5a3fb96.c072c8"}]}],"out":[],"env":[],"color":"#DDAA99"},{"id":"9adbcc70.51bb9","type":"subflow","name":"Direction","info":"","category":"","in":[{"x":80,"y":140,"wires":[{"id":"6efd1ae7.4c8924"}]}],"out":[],"env":[],"color":"#DDAA99"},{"id":"1aaec155.5f990f","type":"subflow","name":"Dashboard","info":"","category":"","in":[{"x":200,"y":260,"wires":[{"id":"e296aa06.de2ef8"},{"id":"9d3bb96b.efa558"},{"id":"debf08b3.80fa28"}]}],"out":[],"env":[],"color":"#DDAA99"},{"id":"e65cea23.dee568","type":"subflow","name":"World map","info":"","category":"","in":[{"x":140,"y":80,"wires":[{"id":"d323a060.c059"}]}],"out":[],"env":[],"color":"#DDAA99"},{"id":"61d03c95.0a2db4","type":"ui_tab","z":"","name":"GPS multiunit SORACOM Edition","icon":"dashboard","disabled":false,"hidden":false},{"id":"ec8d0081.dc226","type":"ui_group","z":"","name":"","tab":"61d03c95.0a2db4","order":1,"disp":true,"width":"12","collapse":false},{"id":"655b93d0.a8770c","type":"ui_base","theme":{"name":"theme-light","lightTheme":{"default":"#0094CE","baseColor":"#0094CE","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":true,"reset":false},"darkTheme":{"default":"#097479","baseColor":"#097479","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif","edited":false},"customTheme":{"name":"Untitled Theme 1","default":"#4B7930","baseColor":"#4B7930","baseFont":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"},"themeState":{"base-color":{"default":"#0094CE","value":"#0094CE","edited":false},"page-titlebar-backgroundColor":{"value":"#0094CE","edited":false},"page-backgroundColor":{"value":"#fafafa","edited":false},"page-sidebar-backgroundColor":{"value":"#ffffff","edited":false},"group-textColor":{"value":"#1bbfff","edited":false},"group-borderColor":{"value":"#ffffff","edited":false},"group-backgroundColor":{"value":"#ffffff","edited":false},"widget-textColor":{"value":"#111111","edited":false},"widget-backgroundColor":{"value":"#0094ce","edited":false},"widget-borderColor":{"value":"#ffffff","edited":false},"base-font":{"value":"-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif"}},"angularTheme":{"primary":"indigo","accents":"blue","warn":"red","background":"grey"}},"site":{"name":"Node-RED Dashboard","hideToolbar":"false","allowSwipe":"false","lockMenu":"false","allowTempTheme":"true","dateFormat":"YYYY/MM/DD","sizes":{"sx":48,"sy":48,"gx":6,"gy":6,"cx":6,"cy":6,"px":0,"py":0}}},{"id":"687033c3.e5588c","type":"ui_group","name":"Group 2","tab":"61d03c95.0a2db4","order":2,"disp":true,"width":6},{"id":"76f14af8.3ee784","type":"mqtt-broker","z":"462baeec.62b32","name":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"bf2ccd43.9c498","type":"mqtt-broker","z":"","name":"","broker":"localhost","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"bd49f0e9.6add4","type":"mqtt-broker","z":"","name":"remote","broker":"52.69.55.196","port":"1883","tls":"","clientid":"","usetls":false,"compatmode":false,"keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","closeTopic":"","closeQos":"0","closePayload":"","willTopic":"","willQos":"0","willPayload":""},{"id":"c7f47902.e6e668","type":"http in","z":"87d6c779.359978","name":"","url":"/gps","method":"post","upload":false,"swaggerDoc":"","x":100,"y":100,"wires":[["31944a1b.e44156","3ddbced.78fcf32"]]},{"id":"31944a1b.e44156","type":"http response","z":"87d6c779.359978","name":"HTTP response","statusCode":"","headers":{},"x":320,"y":160,"wires":[]},{"id":"2b9dcfbc.cf716","type":"ui_gauge","z":"1aaec155.5f990f","name":"","group":"ec8d0081.dc226","order":3,"width":"6","height":"6","gtype":"gage","title":"Temperature","label":"units","format":"{{value}}","min":0,"max":"40","colors":["#00b500","#e6e600","#ca3838"],"seg1":"30","seg2":"35","x":650,"y":180,"wires":[]},{"id":"ca6b77a0.fb9298","type":"ui_gauge","z":"1aaec155.5f990f","name":"","group":"ec8d0081.dc226","order":2,"width":"6","height":"6","gtype":"gage","title":"Humidity","label":"units","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"35","seg2":"70","x":640,"y":260,"wires":[]},{"id":"e296aa06.de2ef8","type":"change","z":"1aaec155.5f990f","name":"temperature","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.temp","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":180,"wires":[["2b9dcfbc.cf716","1a2b2ecb.f1d971"]]},{"id":"9d3bb96b.efa558","type":"change","z":"1aaec155.5f990f","name":"humidity","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.humi","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":400,"y":260,"wires":[["ca6b77a0.fb9298"]]},{"id":"1a2b2ecb.f1d971","type":"ui_chart","z":"1aaec155.5f990f","name":"","group":"ec8d0081.dc226","order":1,"width":0,"height":0,"label":"Temperature chart","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"","dot":false,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"3600","cutout":0,"useOneColor":false,"useUTC":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"outputs":1,"x":670,"y":120,"wires":[[]]},{"id":"debf08b3.80fa28","type":"change","z":"1aaec155.5f990f","name":"battery level","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.bat","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":410,"y":340,"wires":[["93d2baae.fa2a98"]]},{"id":"93d2baae.fa2a98","type":"ui_gauge","z":"1aaec155.5f990f","name":"","group":"ec8d0081.dc226","order":4,"width":"6","height":"3","gtype":"gage","title":"Battery Level","label":"units","format":"{{value}}","min":"0","max":"3","colors":["#ca3838","#e6e600","#00b500"],"seg1":"1","seg2":"2","x":650,"y":340,"wires":[]},{"id":"85ec862e.ffee28","type":"subflow:462baeec.62b32","z":"87d6c779.359978","name":"","x":720,"y":280,"wires":[]},{"id":"682a7074.08d2f","type":"subflow:1aaec155.5f990f","z":"87d6c779.359978","name":"","env":[],"x":730,"y":160,"wires":[]},{"id":"d87d346b.9eec58","type":"subflow:9adbcc70.51bb9","z":"87d6c779.359978","name":"","env":[],"x":720,"y":220,"wires":[]},{"id":"7aac7196.7c2eb","type":"switch","z":"9adbcc70.51bb9","name":"check laying","property":"payload.z","propertyType":"msg","rules":[{"t":"lt","v":"-800","vt":"num"},{"t":"gt","v":"800","vt":"num"}],"checkall":"true","repair":false,"outputs":2,"x":290,"y":320,"wires":[["59b7f6ce.bfbbb8"],["680ef2b3.3c8bac"]]},{"id":"441721ce.48536","type":"debug","z":"9adbcc70.51bb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":280,"wires":[]},{"id":"59b7f6ce.bfbbb8","type":"change","z":"9adbcc70.51bb9","name":"Lay","rules":[{"t":"set","p":"payload","pt":"msg","to":"Direction: Lay","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":280,"wires":[["441721ce.48536"]]},{"id":"6efd1ae7.4c8924","type":"switch","z":"9adbcc70.51bb9","name":"check standing","property":"payload.x","propertyType":"msg","rules":[{"t":"gt","v":"800","vt":"num"},{"t":"lt","v":"-800","vt":"num"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":280,"y":140,"wires":[["d97ee6ab.7a6478"],["43d10de7.999a44"],["7aac7196.7c2eb"]]},{"id":"e22a4baa.df4e28","type":"debug","z":"9adbcc70.51bb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":80,"wires":[]},{"id":"d97ee6ab.7a6478","type":"change","z":"9adbcc70.51bb9","name":"Stand","rules":[{"t":"set","p":"payload","pt":"msg","to":"Direction: Stand","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":510,"y":80,"wires":[["e22a4baa.df4e28"]]},{"id":"69c106a5.c1ab68","type":"debug","z":"9adbcc70.51bb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":140,"wires":[]},{"id":"43d10de7.999a44","type":"change","z":"9adbcc70.51bb9","name":"Stand upside down","rules":[{"t":"set","p":"payload","pt":"msg","to":"Direction: Stand upside down","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":140,"wires":[["69c106a5.c1ab68"]]},{"id":"728daab1.c8dc24","type":"debug","z":"9adbcc70.51bb9","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":770,"y":340,"wires":[]},{"id":"680ef2b3.3c8bac","type":"change","z":"9adbcc70.51bb9","name":"Lay upside down","rules":[{"t":"set","p":"payload","pt":"msg","to":"Direction: Lay upside down","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":340,"wires":[["728daab1.c8dc24"]]},{"id":"45aa24bf.0d399c","type":"subflow:e65cea23.dee568","z":"87d6c779.359978","name":"","env":[],"x":730,"y":100,"wires":[]},{"id":"a6c04b17.225768","type":"worldmap","z":"e65cea23.dee568","name":"","lat":"","lon":"","zoom":"","layer":"","cluster":"","maxage":"","usermenu":"show","layers":"show","panit":"false","panlock":"false","zoomlock":"false","hiderightclick":"false","coords":"none","showgrid":"false","path":"/worldmap","x":480,"y":80,"wires":[]},{"id":"d323a060.c059","type":"change","z":"e65cea23.dee568","name":"Add name","rules":[{"t":"set","p":"payload.name","pt":"msg","to":"","tot":"date"}],"action":"","property":"","from":"","to":"","reg":false,"x":310,"y":80,"wires":[["a6c04b17.225768"]]},{"id":"3ddbced.78fcf32","type":"soracom_gps_multiunit","z":"87d6c779.359978","property":"payload","name":"","x":350,"y":100,"wires":[["45aa24bf.0d399c","682a7074.08d2f","d87d346b.9eec58","85ec862e.ffee28"]]},{"id":"86266cae.2a0a4","type":"inject","z":"87d6c779.359978","name":"For test","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"{\"payload\":\"eyJsYXQiOjUxLjAyNDUzNSwibG9uIjotMS4zOTk2MDEsImJhdCI6MywicnMiOjAsInRlbXAiOjI3LjAsImh1bWkiOjU5LjcsIngiOjAuMCwieSI6MC4wLCJ6IjotMTAyNC4wLCJ0eXBlIjoxfQo=\"}","payloadType":"json","x":190,"y":500,"wires":[["30ab4d6b.711492"]]},{"id":"30ab4d6b.711492","type":"soracom_gps_multiunit","z":"87d6c779.359978","property":"payload","name":"","x":460,"y":500,"wires":[["42f8b7e9.a8a208"]]},{"id":"42f8b7e9.a8a208","type":"debug","z":"87d6c779.359978","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":680,"y":500,"wires":[]},{"id":"facd2911.430828","type":"aedes broker","z":"462baeec.62b32","name":"","mqtt_port":1883,"mqtt_ws_port":"","cert":"","key":"","certname":"","keyname":"","dburl":"","usetls":false,"x":210,"y":200,"wires":[[]]},{"id":"10cbb752.ec1f59","type":"mqtt out","z":"462baeec.62b32","name":"Notify to Raspberry Pi","topic":"oob_notification","qos":"1","retain":"","broker":"bf2ccd43.9c498","x":540,"y":120,"wires":[]},{"id":"b5a3fb96.c072c8","type":"geofence","z":"462baeec.62b32","name":"","mode":"circle","inside":"true","rad":0,"points":[],"centre":{"latitude":0,"longitude":0},"x":310,"y":120,"wires":[["10cbb752.ec1f59"]]}]

Flow Info

Created 5 years, 2 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x8)
  • debug (x5)
  • http in (x1)
  • http response (x1)
  • inject (x1)
  • mqtt out (x1)
  • mqtt-broker (x3)
  • switch (x2)
Other
  • aedes broker (x1)
  • geofence (x1)
  • soracom_gps_multiunit (x2)
  • subflow (x4)
  • subflow:1aaec155.5f990f (x1)
  • subflow:462baeec.62b32 (x1)
  • subflow:9adbcc70.51bb9 (x1)
  • subflow:e65cea23.dee568 (x1)
  • tab (x1)
  • ui_base (x1)
  • ui_chart (x1)
  • ui_gauge (x3)
  • ui_group (x2)
  • ui_tab (x1)
  • worldmap (x1)

Tags

  • SORACOM
  • GPS
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option