smick_db_add_v07r01

Flow per memorizzare su file db le misure.

[{"id":"858f1981.5f6bf","type":"subflow","name":"db add","info":"Add date and time to a misure and save it on file\n\\\\192.168.1.xxx\\TheThingBox\\root\\userdir\\db.txt\n\nNote: Smart Controller data system is 2 hours behind\n\n","in":[{"x":100,"y":100,"wires":[{"id":"e7fb6155.8f3ba8"}]}],"out":[{"x":380,"y":140,"wires":[{"id":"e7fb6155.8f3ba8","port":0}]}],"inputLabels":["json message ftom device"],"outputLabels":["json message with date and time saved on db file"]},{"id":"19765fdb.34b17","type":"file","z":"858f1981.5f6bf","name":"ADD db","filename":"/root/userdir/db.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":420,"y":60,"wires":[]},{"id":"e7fb6155.8f3ba8","type":"change","z":"858f1981.5f6bf","name":"JSONata","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.(\t  {\t    \"date\":$substring($now(),0, 10),\t    \"time\":$substring($now(),11, 8),\t    \"Sn\":Sn,\t    \"name\":name,\t    \"pos\":pos,\t    \"class\":class,\t    \"field1\":field1,\t    \"field2\":field2,\t    \"field3\":field3,\t    \"field4\":field4    \t  }\t)\t\t\t\t\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":240,"y":100,"wires":[["19765fdb.34b17"]]},{"id":"1810f828.1dba7","type":"subflow","name":"dht22 dash","info":"","in":[{"x":40,"y":160,"wires":[{"id":"da56c1b7.d408f"}]}],"out":[],"inputLabels":["json object"]},{"id":"ce3e00d1.9910b","type":"ui_gauge","z":"1810f828.1dba7","name":"","group":"77924864.53a6a8","order":0,"width":0,"height":0,"gtype":"gage","title":"","label":"°C","format":"{{value}}","min":"-10","max":"60","colors":["#80ffff","#ffff00","#ca3838"],"seg1":"12","seg2":"30","x":590,"y":80,"wires":[]},{"id":"7f24dba2.039fc4","type":"ui_gauge","z":"1810f828.1dba7","name":"","group":"653447b3.15c82","order":0,"width":0,"height":0,"gtype":"donut","title":"","label":"% RH","format":"{{msg.payload}}","min":"0","max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":590,"y":180,"wires":[]},{"id":"456f298d.e39918","type":"ui_chart","z":"1810f828.1dba7","name":"","group":"77924864.53a6a8","order":0,"width":0,"height":0,"label":"temperature (°C)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Sensor not connected","dot":true,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":630,"y":120,"wires":[[],[]]},{"id":"77bf9ff0.4a21","type":"ui_chart","z":"1810f828.1dba7","name":"","group":"653447b3.15c82","order":0,"width":0,"height":0,"label":"humidity (% RH)","chartType":"line","legend":"false","xformat":"HH:mm:ss","interpolate":"linear","nodata":"Sensor not connected","dot":true,"ymin":"","ymax":"","removeOlder":1,"removeOlderPoints":"","removeOlderUnit":"86400","cutout":0,"useOneColor":false,"colors":["#1f77b4","#aec7e8","#ff7f0e","#2ca02c","#98df8a","#d62728","#ff9896","#9467bd","#c5b0d5"],"useOldStyle":false,"x":620,"y":220,"wires":[[],[]]},{"id":"7a48836e.c5bb54","type":"change","z":"1810f828.1dba7","name":"Temp","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.field1","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":100,"wires":[["ce3e00d1.9910b","456f298d.e39918"]]},{"id":"fa1bbc2b.cdfea","type":"change","z":"1810f828.1dba7","name":"Hum","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.field2","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":430,"y":200,"wires":[["7f24dba2.039fc4","77bf9ff0.4a21"]]},{"id":"da56c1b7.d408f","type":"switch","z":"1810f828.1dba7","name":"switch(class)","property":"payload.class","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"},{"t":"eq","v":"2","vt":"num"},{"t":"eq","v":"3","vt":"num"}],"checkall":"true","outputs":3,"x":190,"y":160,"wires":[["7a48836e.c5bb54","fa1bbc2b.cdfea"],[],[]],"outputLabels":["class==1: field1=Temp, field2=Hum","class==2: TBD","class==3: TBD"]},{"id":"77924864.53a6a8","type":"ui_group","z":"","name":"Temperature","tab":"3dccec0c.f37104","order":1,"disp":true,"width":"6","collapse":true},{"id":"653447b3.15c82","type":"ui_group","z":"","name":"Humidity","tab":"3dccec0c.f37104","order":2,"disp":true,"width":"6","collapse":true},{"id":"3dccec0c.f37104","type":"ui_tab","z":"","name":"Room","icon":"dashboard","order":7},{"id":"aa831b20.f3f35","type":"subflow","name":"dht22 sensor","info":"","in":[],"out":[{"x":420,"y":80,"wires":[{"id":"9779aeaa.70918","port":0}]}],"outputLabels":["message from sensor"]},{"id":"b783fa98.116208","type":"mqtt in","z":"aa831b20.f3f35","name":"","topic":"out/dht22","qos":"0","broker":"eed163.62e4bea","x":120,"y":80,"wires":[["9779aeaa.70918"]]},{"id":"9779aeaa.70918","type":"json","z":"aa831b20.f3f35","name":"","pretty":false,"x":290,"y":80,"wires":[[]]},{"id":"eed163.62e4bea","type":"mqtt-broker","z":"","broker":"localhost","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"3ae75f15.d892a8","type":"subflow:aa831b20.f3f35","z":"d281347a.9bf4a","name":"","x":130,"y":120,"wires":[["f50ce513.b19668","9f0bbf88.b8b518","e0b57399.4250c"]]},{"id":"f50ce513.b19668","type":"debug","z":"d281347a.9bf4a","name":"","active":true,"console":"false","complete":"payload","x":350,"y":80,"wires":[]},{"id":"9f0bbf88.b8b518","type":"subflow:1810f828.1dba7","z":"d281347a.9bf4a","name":"","x":350,"y":120,"wires":[]},{"id":"e0b57399.4250c","type":"subflow:858f1981.5f6bf","z":"d281347a.9bf4a","name":"","x":340,"y":160,"wires":[["9d3476e9.4cbf8"]]},{"id":"9d3476e9.4cbf8","type":"debug","z":"d281347a.9bf4a","name":"","active":true,"console":"false","complete":"payload","x":530,"y":160,"wires":[]}]

Flow Info

Created 7 years, 7 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x3)
  • debug (x2)
  • file (x1)
  • json (x1)
  • mqtt in (x1)
  • mqtt-broker (x1)
  • switch (x1)
Other
  • subflow (x3)
  • subflow:1810f828.1dba7 (x1)
  • subflow:858f1981.5f6bf (x1)
  • subflow:aa831b20.f3f35 (x1)
  • ui_chart (x2)
  • ui_gauge (x2)
  • ui_group (x2)
  • ui_tab (x1)

Tags

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