Changes between Version 6 and Version 7 of nodered
- Timestamp:
- 12/17/2021 11:55:41 PM (3 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
nodered
v6 v7 22 22 sudo npm install -g --unsafe-perm node-red #install node-red using npm 23 23 node-red #start the node-red application 24 25 Welcome to Node-RED 26 =================== 27 28 17 Dec 23:23:34 - [info] Node-RED version: v2.1.4 29 17 Dec 23:23:34 - [info] Node.js version: v10.19.0 30 17 Dec 23:23:34 - [info] Linux 5.15.0-00085-g2ec7c180b810 arm64 LE 31 17 Dec 23:23:37 - [info] Loading palette nodes 32 17 Dec 23:23:40 - [info] Settings file : /root/.node-red/settings.js 33 17 Dec 23:23:40 - [info] Context store : 'default' [module=memory] 34 17 Dec 23:23:40 - [info] User directory : /root/.node-red 35 17 Dec 23:23:40 - [warn] Projects disabled : editorTheme.projects.enabled=false 36 17 Dec 23:23:40 - [info] Flows file : /root/.node-red/flows.json 37 17 Dec 23:23:40 - [warn] 38 39 --------------------------------------------------------------------- 40 Your flow credentials file is encrypted using a system-generated key. 41 42 If the system-generated key is lost for any reason, your credentials 43 file will not be recoverable, you will have to delete it and re-enter 44 your credentials. 45 46 You should set your own key using the 'credentialSecret' option in 47 your settings file. Node-RED will then re-encrypt your credentials 48 file using your chosen key the next time you deploy a change. 49 --------------------------------------------------------------------- 50 51 17 Dec 23:23:40 - [info] Server now running at http://127.0.0.1:1880/ 52 17 Dec 23:23:40 - [info] Starting flows 53 17 Dec 23:23:41 - [info] Started flows 54 17 Dec 23:23:41 - [info] [mqtt-broker:c44d6461e1d6d8c3] Connected to broker: mqtt://localhost:1883 55 24 56 }}} 25 57 … … 46 78 == Gateworks Python Script to send MQTT Messages 47 79 48 The below is a sample python script to pass MQTT messages from the Gateworks SBC to the Node-Red server (broker). The script will pass the Gateworks SBC temperature as the payload and send it specific to the device s serial number.80 The below is a sample python script to pass MQTT messages from the Gateworks SBC to the Node-Red server (broker). The script will pass the Gateworks SBC temperature as the payload and send it specific to the device's serial number. 49 81 50 82 {{{ … … 74 106 client.on_connect = on_connect 75 107 client.on_message = on_message 76 broker = "1 22.24.55.93"108 broker = "172.24.33.93" 77 109 client.connect(broker) 78 110 client.loop_start() 79 time.sleep(5) 111 serialnumber = str(open('/proc/device-tree/serial-number', 'r').read()) 112 print(serialnumber) 113 prefix = "gateways/id/" 114 time.sleep(1) 80 115 while True: 81 116 try: 82 117 print("in loop") 83 118 temp = float(open('/sys/class/hwmon/hwmon0/temp1_input', 'r').read().strip())/1000 84 client.publish("gateways/id/45",temp,1) 119 prefix = "gateways/id/" 120 serialnumber = str(open('/proc/device-tree/serial-number', 'r').read().strip('\x00')) 121 topic = prefix + serialnumber 122 client.publish(topic,temp,1) 85 123 print("done publishing") 86 124 … … 94 132 main(sys.argv) 95 133 96 97 134 }}} 98 135