|
- [
- {
- "id": "7814434760ede84f",
- "type": "tab",
- "label": "Flow 1",
- "disabled": false,
- "info": ""
- },
- {
- "id": "f2fa6dd5ecc6fee9",
- "type": "tab",
- "label": "Input",
- "disabled": false,
- "info": ""
- },
- {
- "id": "c5f6844437dd47a5",
- "type": "tab",
- "label": "UI Elements",
- "disabled": false,
- "info": ""
- },
- {
- "id": "d354ea3adc51a23c",
- "type": "tab",
- "label": "Output",
- "disabled": false,
- "info": ""
- },
- {
- "id": "750cc01832709457",
- "type": "ui_base",
- "theme": {
- "name": "theme-dark",
- "lightTheme": {
- "default": "#0094CE",
- "baseColor": "#0094CE",
- "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
- "edited": false
- },
- "darkTheme": {
- "default": "#097479",
- "baseColor": "#097479",
- "baseFont": "-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen-Sans,Ubuntu,Cantarell,Helvetica Neue,sans-serif",
- "edited": true,
- "reset": 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",
- "reset": false
- },
- "themeState": {
- "base-color": {
- "default": "#097479",
- "value": "#097479",
- "edited": false
- },
- "page-titlebar-backgroundColor": {
- "value": "#097479",
- "edited": false
- },
- "page-backgroundColor": {
- "value": "#111111",
- "edited": false
- },
- "page-sidebar-backgroundColor": {
- "value": "#333333",
- "edited": false
- },
- "group-textColor": {
- "value": "#0eb8c0",
- "edited": false
- },
- "group-borderColor": {
- "value": "#555555",
- "edited": false
- },
- "group-backgroundColor": {
- "value": "#333333",
- "edited": false
- },
- "widget-textColor": {
- "value": "#eeeeee",
- "edited": false
- },
- "widget-backgroundColor": {
- "value": "#097479",
- "edited": false
- },
- "widget-borderColor": {
- "value": "#333333",
- "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",
- "palette": "light"
- }
- },
- "site": {
- "name": "Siegfried Dorn",
- "hideToolbar": "false",
- "allowSwipe": "false",
- "lockMenu": "true",
- "allowTempTheme": "none",
- "dateFormat": "DD.MM.YYYY",
- "sizes": {
- "sx": 48,
- "sy": 48,
- "gx": 6,
- "gy": 6,
- "cx": 6,
- "cy": 6,
- "px": 0,
- "py": 0
- }
- }
- },
- {
- "id": "124aa983647c8074",
- "type": "ui_tab",
- "name": "Tab 1",
- "icon": "dashboard",
- "order": 1
- },
- {
- "id": "a756759c113266b5",
- "type": "ui_group",
- "name": "Group 1",
- "tab": "124aa983647c8074",
- "order": 1,
- "disp": true,
- "width": "4",
- "collapse": true,
- "className": ""
- },
- {
- "id": "8dba3ccfebb75b33",
- "type": "ui_group",
- "name": "Windrichtung",
- "tab": "124aa983647c8074",
- "order": 3,
- "disp": true,
- "width": "5",
- "collapse": false,
- "className": ""
- },
- {
- "id": "738d12f3ae8a61a3",
- "type": "mqtt-broker",
- "name": "MQ Broker SDOIT",
- "broker": "mqtt.sdoit.de",
- "port": "8883",
- "tls": "182ecf262e314f5c",
- "clientid": "",
- "usetls": true,
- "protocolVersion": "4",
- "keepalive": "60",
- "cleansession": true,
- "birthTopic": "",
- "birthQos": "0",
- "birthPayload": "",
- "birthMsg": {},
- "closeTopic": "",
- "closeQos": "0",
- "closePayload": "",
- "closeMsg": {},
- "willTopic": "",
- "willQos": "0",
- "willPayload": "",
- "willMsg": {},
- "sessionExpiry": ""
- },
- {
- "id": "182ecf262e314f5c",
- "type": "tls-config",
- "name": "sdoit",
- "cert": "",
- "key": "",
- "ca": "",
- "certname": "",
- "keyname": "",
- "caname": "",
- "servername": "mqtt.sdoit.de",
- "verifyservercert": true,
- "alpnprotocol": ""
- },
- {
- "id": "ba6fd973118b950c",
- "type": "ui_tab",
- "name": "Tab 3",
- "icon": "dashboard",
- "order": 3
- },
- {
- "id": "3710f59d209e7cc2",
- "type": "ui_group",
- "name": "Barometer",
- "tab": "124aa983647c8074",
- "order": 2,
- "disp": true,
- "width": "5",
- "collapse": false,
- "className": ""
- },
- {
- "id": "b7d12b8d.651c8",
- "type": "ui_group",
- "name": "Default",
- "tab": "fe5d396a.0d6d4",
- "order": 1,
- "disp": true,
- "width": "20",
- "collapse": false
- },
- {
- "id": "fe5d396a.0d6d4",
- "type": "ui_tab",
- "name": "Home",
- "icon": "dashboard",
- "disabled": false,
- "hidden": false
- },
- {
- "id": "1db5a64de6fc2d9e",
- "type": "MySQLdatabase",
- "name": "Weather DB",
- "host": "db",
- "port": "3306",
- "db": "node-red",
- "tz": "",
- "charset": "UTF8"
- },
- {
- "id": "6cb911a340dd0ff5",
- "type": "inject",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "props": [
- {
- "p": "payload"
- },
- {
- "p": "topic",
- "vt": "str"
- }
- ],
- "repeat": "300",
- "crontab": "",
- "once": true,
- "onceDelay": 0.1,
- "topic": "test",
- "payloadType": "date",
- "x": 140,
- "y": 300,
- "wires": [
- [
- "dceaa64cdf99920b",
- "e7fa67bc4dae509c"
- ]
- ]
- },
- {
- "id": "f770a584f4cb34b3",
- "type": "debug",
- "z": "f2fa6dd5ecc6fee9",
- "name": "Openweather",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "targetType": "msg",
- "statusVal": "",
- "statusType": "auto",
- "x": 740,
- "y": 220,
- "wires": []
- },
- {
- "id": "220fb7d74b77d77c",
- "type": "json",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "property": "payload",
- "action": "obj",
- "pretty": false,
- "x": 620,
- "y": 300,
- "wires": [
- [
- "f770a584f4cb34b3",
- "e41d26526985556b"
- ]
- ]
- },
- {
- "id": "dceaa64cdf99920b",
- "type": "openweathermap",
- "z": "f2fa6dd5ecc6fee9",
- "name": "Openweathermap",
- "wtype": "current",
- "lon": "",
- "lat": "",
- "city": "Frankfurt",
- "country": "Germany",
- "language": "de",
- "x": 350,
- "y": 300,
- "wires": [
- [
- "220fb7d74b77d77c"
- ]
- ]
- },
- {
- "id": "e41d26526985556b",
- "type": "link out",
- "z": "f2fa6dd5ecc6fee9",
- "name": "weather",
- "links": [
- "baeb6a5a161373bf",
- "7fbd6896a5bc5ed3",
- "73f47758e35544c8",
- "97822532c623d138",
- "5cc92a265ea6197c"
- ],
- "x": 1315,
- "y": 300,
- "wires": []
- },
- {
- "id": "73f47758e35544c8",
- "type": "link in",
- "z": "d354ea3adc51a23c",
- "name": "",
- "links": [
- "e41d26526985556b"
- ],
- "x": 195,
- "y": 100,
- "wires": [
- [
- "0d1d3701ba08c47f",
- "4ee5519b4ee22fbf"
- ]
- ]
- },
- {
- "id": "0d1d3701ba08c47f",
- "type": "mqtt out",
- "z": "d354ea3adc51a23c",
- "name": "raspi/weather",
- "topic": "raspi/weather",
- "qos": "0",
- "retain": "",
- "respTopic": "",
- "contentType": "",
- "userProps": "",
- "correl": "",
- "expiry": "",
- "broker": "738d12f3ae8a61a3",
- "x": 430,
- "y": 100,
- "wires": []
- },
- {
- "id": "4ee5519b4ee22fbf",
- "type": "debug",
- "z": "d354ea3adc51a23c",
- "name": "To weather",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "targetType": "msg",
- "statusVal": "",
- "statusType": "auto",
- "x": 430,
- "y": 160,
- "wires": []
- },
- {
- "id": "ec902514be1514bb",
- "type": "status",
- "z": "f2fa6dd5ecc6fee9",
- "name": "Status",
- "scope": [
- "f770a584f4cb34b3",
- "e7fa67bc4dae509c",
- "50100e920347df93"
- ],
- "x": 170,
- "y": 60,
- "wires": [
- [
- "58bf8caa2d948bba"
- ]
- ]
- },
- {
- "id": "58bf8caa2d948bba",
- "type": "debug",
- "z": "f2fa6dd5ecc6fee9",
- "name": "dbg Status",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "targetType": "msg",
- "statusVal": "",
- "statusType": "auto",
- "x": 370,
- "y": 60,
- "wires": []
- },
- {
- "id": "b6c4bf611cacfb7e",
- "type": "catch",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "scope": [
- "41295103e3127e87",
- "5889653a74b5faef"
- ],
- "uncaught": false,
- "x": 180,
- "y": 680,
- "wires": [
- [
- "50100e920347df93"
- ]
- ]
- },
- {
- "id": "50100e920347df93",
- "type": "debug",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": true,
- "tostatus": true,
- "complete": "true",
- "targetType": "full",
- "statusVal": "payload",
- "statusType": "auto",
- "x": 410,
- "y": 680,
- "wires": []
- },
- {
- "id": "9f0d5da7b921bfc4",
- "type": "ui_template",
- "z": "c5f6844437dd47a5",
- "group": "3710f59d209e7cc2",
- "name": "Barometer",
- "order": 1,
- "width": "5",
- "height": "5",
- "format": "<script src=\"/tween-min.js\"></script>\n<script src=\"/steelseries-min.js\"></script>\n<script>\nvar radial4;\n\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n if (typeof(msg.payload.pressure) != \"undefined\") radial4.setValueAnimated(msg.payload.pressure);\n //if (typeof(msg.payload.temp_maxc) != \"undefined\") radial4.setMaxMeasuredValue(msg.payload.temp_maxc);\n //if (typeof(msg.payload.temp_minc) != \"undefined\") radial4.setMinMeasuredValue(msg.payload.temp_minc);\n //if (typeof(msg.threshold) != \"undefined\") radial4.setThreshold(msg.threshold);\n //if (typeof(msg.odo) != \"undefined\")radial4.setOdoValue(msg.odo); \n //if (typeof(msg.userLed) != \"undefined\") radial4.setUserLedOnOff(msg.userLed); \n //if (typeof(msg.trend) != \"undefined\")\n //{\n // if (msg.trend==1) radial4.setTrend(steelseries.TrendState.UP);\n // if (msg.trend==0) radial4.setTrend(steelseries.TrendState.STEADY);\n // if (msg.trend==-1) radial4.setTrend(steelseries.TrendState.DOWN);\n // if (msg.trend==-2) radial4.setTrend(steelseries.TrendState.OFF);\n //}\n });\n })(scope);\n\n var sections = [steelseries.Section(960, 990, 'rgba(0, 0, 220, 0.3)'),\n steelseries.Section(990, 1030, 'rgba(0, 220, 0, 0.3)'),\n steelseries.Section(1030, 1060, 'rgba(220, 220, 0, 0.3)') ],\n\n // Define one area\n //areas = [steelseries.Section(25, 50, 'rgba(220, 0, 0, 0.3)')],\n\n radial4 = new steelseries.Radial('canvasRadial4', {\n gaugeType: steelseries.GaugeType.TYPE4,\n minValue: 960,\n maxValue: 1060,\n size: 200,\n section: sections,\n // area: areas,\n titleString: \"Barometer\",\n unitString: \"h Pa\",\n //threshold: 25,\n //thresholdRising: false,\n //userLedVisible: false,\n useOdometer: false,\n lcdVisible: true,\n trendVisible: false,\n minMeasuredValueVisible: false,\n maxMeasuredValueVisible: false\n });\n \n radial4.setFrameDesign(steelseries.FrameDesign.BLACK_METAL);\n radial4.setValueAnimated(0);\n //radial4.setThreshold(50);\n //radial4.blinkUserLed(0);\n //radial4.setOdoValue(0);\n \n\n</script>\n\n<canvas id=\"canvasRadial4\" width=\"300\" height=\"300\"></canvas>\n\n",
- "storeOutMessages": true,
- "fwdInMessages": true,
- "resendOnRefresh": true,
- "templateScope": "local",
- "className": "",
- "x": 550,
- "y": 220,
- "wires": [
- []
- ]
- },
- {
- "id": "97822532c623d138",
- "type": "link in",
- "z": "c5f6844437dd47a5",
- "name": "",
- "links": [
- "e41d26526985556b"
- ],
- "x": 155,
- "y": 240,
- "wires": [
- [
- "9f0d5da7b921bfc4",
- "108158c72ae58d7d",
- "4eb9904b0bad1dd4",
- "b8b31f2d3c802145",
- "e178ebc7cdfb3341",
- "e7818ae4907668b2"
- ]
- ]
- },
- {
- "id": "108158c72ae58d7d",
- "type": "ui_text",
- "z": "c5f6844437dd47a5",
- "group": "a756759c113266b5",
- "order": 1,
- "width": 0,
- "height": 0,
- "name": "",
- "label": "Aktuelle Temperatur [°C] :",
- "format": "{{msg.payload.tempc}}",
- "layout": "col-center",
- "className": "",
- "x": 590,
- "y": 180,
- "wires": []
- },
- {
- "id": "4eb9904b0bad1dd4",
- "type": "ui_template",
- "z": "c5f6844437dd47a5",
- "group": "8dba3ccfebb75b33",
- "name": "Winddir",
- "order": 1,
- "width": "5",
- "height": "7",
- "format": "<script src=\"/tween-min.js\"></script>\n<script src=\"/steelseries-min.js\"></script>\n<script src=\"/steeldefaults.js\"></script>\n<script>\nvar windir;\nvar display;\n\n (function(scope){ \n scope.$watch('msg', function(msg) {\n if (typeof(msg.payload.winddirection) != \"undefined\") windir.setValueAnimatedLatest(msg.payload.winddirection);\n if (typeof(msg.payload.wind_avg) != \"undefined\") windir.setValueAnimatedAverage(msg.payload.wind_avg);\n if (typeof(msg.payload.windspeed) != \"undefined\") display.setValue(msg.payload.windspeed);\n });\n })(scope);\n\n windir = new steelseries.WindDirection('windir', {\n size: 200,\n //fractionalScaleDecimals : 2,\n\t //minValue: 1,\n //maxValue: 359,\n\t\tlcdVisible: true,\n\t\tgaugeType: steelseries.GaugeType.TYPE4,\n\t\tframeDesign: def_frame_design,\n\t\tpointerTypeLatest: steelseries.PointerType.TYPE3,\n\t\tpointerTypeAvarage: steelseries.PointerType.TYPE3\n });\n \n display = new steelseries.DisplaySingle('display', {\n width: 200,\n height: 50,\n unitString: \"m/s\",\n unitStringVisibe: true,\n headerString: \"Speed [m/s]\",\n headerStringVisible: true\n });\n \n \n</script>\n<canvas id=\"windir\" width=\"200\" height=\"200\"></canvas>\n<canvas id=\"display\" width=\"200\" height=\"100\"></canvas>\n",
- "storeOutMessages": true,
- "fwdInMessages": true,
- "resendOnRefresh": true,
- "templateScope": "local",
- "className": "",
- "x": 540,
- "y": 300,
- "wires": [
- []
- ]
- },
- {
- "id": "b8b31f2d3c802145",
- "type": "ui_template",
- "z": "c5f6844437dd47a5",
- "group": "a756759c113266b5",
- "name": "Temperatur",
- "order": 2,
- "width": "0",
- "height": "0",
- "format": "<script src=\"/tween-min.js\"></script>\n<script src=\"/steelseries-min.js\"></script>\n<script src=\"/steeldefaults.js\"></script>\n<script>\nvar linear;\n\n(function(scope){ \n scope.$watch('msg', function(msg) {\n if (typeof(msg.payload.tempc) != \"undefined\") linear.setValueAnimated(msg.payload.tempc);\n });\n })(scope);\n\nlinear = new steelseries.LinearBargraph('linear',{\n frameDesign: def_frame_design,\n valueGradient: valGrad,\n useValueGradient: true,\n minValue: -30,\n maxValue: 50,\n unitString: \"°C\"\n });\n\n</script>\n<canvas id=\"linear\" width=\"200\" height=\"500\"></canvas>\n",
- "storeOutMessages": true,
- "fwdInMessages": true,
- "resendOnRefresh": true,
- "templateScope": "local",
- "className": "",
- "x": 550,
- "y": 260,
- "wires": [
- []
- ]
- },
- {
- "id": "fe102a7155a33faa",
- "type": "link out",
- "z": "f2fa6dd5ecc6fee9",
- "name": "DateTime",
- "links": [
- "ae331f1eb19e7b81",
- "b68a9a843348e1bf"
- ],
- "x": 555,
- "y": 460,
- "wires": []
- },
- {
- "id": "df19e2819075fb1a",
- "type": "ui_text",
- "z": "c5f6844437dd47a5",
- "group": "a756759c113266b5",
- "order": 1,
- "width": 0,
- "height": 0,
- "name": "",
- "label": "",
- "format": "<p align=center> {{msg.payload.date}} <br> {{msg.payload.time}} <p>",
- "layout": "col-center",
- "className": "",
- "x": 530,
- "y": 140,
- "wires": []
- },
- {
- "id": "ae331f1eb19e7b81",
- "type": "link in",
- "z": "c5f6844437dd47a5",
- "name": "",
- "links": [
- "fe102a7155a33faa"
- ],
- "x": 155,
- "y": 140,
- "wires": [
- [
- "df19e2819075fb1a"
- ]
- ]
- },
- {
- "id": "396b940d734ab05a",
- "type": "inject",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "props": [
- {
- "p": "payload"
- }
- ],
- "repeat": "",
- "crontab": "",
- "once": false,
- "onceDelay": 0.1,
- "topic": "",
- "payload": "{\"id\":803,\"weather\":\"Clouds\",\"detail\":\"Überwiegend bewölkt\",\"icon\":\"04d\",\"tempk\":283.76,\"tempc\":25,\"temp_maxc\":11.8,\"temp_minc\":9.6,\"humidity\":87,\"pressure\":1020,\"maxtemp\":285.03,\"mintemp\":282.77,\"windspeed\":7.2,\"winddirection\":270,\"location\":\"Frankfurt am Main\",\"sunrise\":1676615606,\"sunset\":1676652328,\"clouds\":75,\"description\":\"The weather in Frankfurt am Main at coordinates: 50.1167, 8.6833 is Clouds (Überwiegend bewölkt).\"}",
- "payloadType": "json",
- "x": 910,
- "y": 60,
- "wires": [
- [
- "e41d26526985556b"
- ]
- ]
- },
- {
- "id": "ebdc01b5a4bcfa93",
- "type": "ui_button",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "group": "a756759c113266b5",
- "order": 3,
- "width": 0,
- "height": 0,
- "passthru": false,
- "label": "Test",
- "tooltip": "",
- "color": "",
- "bgcolor": "",
- "className": "",
- "icon": "",
- "payload": "{\"id\":803,\"weather\":\"Clouds\",\"detail\":\"Überwiegend bewölkt\",\"icon\":\"04d\",\"tempk\":283.76,\"tempc\":35,\"temp_maxc\":11.8,\"temp_minc\":9.6,\"humidity\":87,\"pressure\":1020,\"maxtemp\":285.03,\"mintemp\":282.77,\"windspeed\":7.2,\"winddirection\":270,\"location\":\"Frankfurt am Main\",\"sunrise\":1676615606,\"sunset\":1676652328,\"clouds\":75,\"description\":\"The weather in Frankfurt am Main at coordinates: 50.1167, 8.6833 is Clouds (Überwiegend bewölkt).\"}",
- "payloadType": "json",
- "topic": "topic",
- "topicType": "msg",
- "x": 910,
- "y": 100,
- "wires": [
- [
- "e41d26526985556b"
- ]
- ]
- },
- {
- "id": "e178ebc7cdfb3341",
- "type": "function",
- "z": "c5f6844437dd47a5",
- "name": "",
- "func": "var wind=global.get('wind') || {};\nvar wind_avg = global.get ('wind_avg') || 0;\n\nvar payload=msg.payload.winddirection;\nnode.log(payload);\n\n\nif (wind.message==undefined)\n {\n wind.message=[];\n }\nwind.message.push(payload);\n\nif (wind.message.length>20)\n{\n wind.message.shift();\n}\n\nglobal.set('wind',wind);\nvar s=\"\";\nfor (i=(wind.message.length-1);i>=0;i--)\n s=s+wind.message[i];\nvar c = 0;\nfor (i=(wind.message.length-1);i>=0;i--)\n{\n c=c+wind.message[i];\n}\n\nwind_avg = c/(wind.message.length);\nglobal.set('wind_avg', wind_avg)\nglobal.set('wind', wind)\nnode.log(msg);\nmsg.payload.wind_avg=wind_avg;\n\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 300,
- "y": 320,
- "wires": [
- [
- "722c05d553b5a3e0",
- "4eb9904b0bad1dd4"
- ]
- ]
- },
- {
- "id": "722c05d553b5a3e0",
- "type": "ui_template",
- "z": "c5f6844437dd47a5",
- "group": "b7d12b8d.651c8",
- "name": "",
- "order": 1,
- "width": 0,
- "height": 0,
- "format": "<style>\n.main\n{\nheight:500px;\n//background-color:lightblue;\n}\n</style>\n<div class=main ng-bind-html=\"msg.payload.wind_avg\"></div> \n<script>\n var msg = global.get(\"wind\");\n</script>\n <table>\n <tbody>\n <tr *ngFor=\"let p of msg\">\n <td>{{p.message}}</td>\n </tr>\n </tbody>\n </table>",
- "storeOutMessages": true,
- "fwdInMessages": true,
- "resendOnRefresh": true,
- "templateScope": "local",
- "className": "",
- "x": 540,
- "y": 340,
- "wires": [
- []
- ]
- },
- {
- "id": "5fc826242df12119",
- "type": "mysql",
- "z": "d354ea3adc51a23c",
- "mydb": "1db5a64de6fc2d9e",
- "name": "Database",
- "x": 420,
- "y": 240,
- "wires": [
- [
- "6f5ec86de53be60c"
- ]
- ]
- },
- {
- "id": "e7fa67bc4dae509c",
- "type": "function",
- "z": "f2fa6dd5ecc6fee9",
- "name": "F_Test",
- "func": "function formatDate(date) {\n var d = new Date(date),\n month = '' + (d.getMonth() + 1),\n day = '' + d.getDate(),\n year = d.getFullYear();\n\n if (month.length < 2) \n month = '0' + month;\n if (day.length < 2) \n day = '0' + day;\n\n return [year, month, day].join('-');\n}\n\nvar mymsg = msg.payload;\n\nvar time = new Date(mymsg).toLocaleTimeString(\"de-DE\");\n\nvar date = new Date(mymsg);\nvar f_date = formatDate(date);\n\nnode.status({fill:\"green\",shape:\"ring\",text:f_date + \" \" + time});\nnode.log(f_date+\" \"+time);\nmsg.payload = {date:f_date,time:time};\nmsg.topic = \"DateTime\";\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 370,
- "y": 400,
- "wires": [
- [
- "0a80d66a213a9bd0",
- "fe102a7155a33faa"
- ]
- ]
- },
- {
- "id": "0a80d66a213a9bd0",
- "type": "debug",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": true,
- "complete": "payload",
- "targetType": "msg",
- "statusVal": "payload",
- "statusType": "auto",
- "x": 610,
- "y": 380,
- "wires": []
- },
- {
- "id": "d03c76cf92669797",
- "type": "join",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "mode": "custom",
- "build": "merged",
- "property": "payload",
- "propertyType": "msg",
- "key": "topic",
- "joiner": "\\n",
- "joinerType": "str",
- "accumulate": true,
- "timeout": "",
- "count": "2",
- "reduceRight": false,
- "reduceExp": "",
- "reduceInit": "",
- "reduceInitType": "",
- "reduceFixup": "",
- "x": 870,
- "y": 460,
- "wires": [
- [
- "143a633ae8d40b1e"
- ]
- ]
- },
- {
- "id": "b68a9a843348e1bf",
- "type": "link in",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "links": [
- "fe102a7155a33faa"
- ],
- "x": 715,
- "y": 500,
- "wires": [
- [
- "d03c76cf92669797"
- ]
- ]
- },
- {
- "id": "5cc92a265ea6197c",
- "type": "link in",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "links": [
- "e41d26526985556b"
- ],
- "x": 715,
- "y": 440,
- "wires": [
- [
- "d03c76cf92669797"
- ]
- ]
- },
- {
- "id": "143a633ae8d40b1e",
- "type": "function",
- "z": "f2fa6dd5ecc6fee9",
- "name": "Create Insert SQL",
- "func": "var topic = \"INSERT INTO `node-red`.`Weather` ( \\\n`date` \\\n,`time` \\\n,`weather` \\\n,`detail` \\\n,`icon` \\\n,`tempk` \\\n,`tempc` \\\n,`temp_maxc` \\\n,`temp_minc` \\\n,`humidity` \\\n,`pressure` \\\n,`maxtemp` \\\n,`mintemp` \\\n,`windspeed` \\\n,`winddirection` \\\n,`location` \\\n,`sunrise` \\\n,`sunset` \\\n,`clouds` \\\n,`description`) \\\nVALUES ( \\\n:date \\\n,:time \\\n,:weather \\\n,:detail \\\n,:icon \\\n,:tempk \\\n,:tempc \\\n,:temp_maxc \\\n,:temp_minc \\\n,:humidity \\\n,:pressure \\\n,:maxtemp \\\n,:mintemp \\\n,:windspeed \\\n,:winddirection \\\n,:location \\\n,:sunrise \\\n,:sunset \\\n,:clouds \\\n,:description);\"\nmsg.topic = topic\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 1080,
- "y": 460,
- "wires": [
- [
- "18ce04e729380a08",
- "d153c5b44a8efd0f"
- ]
- ]
- },
- {
- "id": "18ce04e729380a08",
- "type": "debug",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "active": false,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "true",
- "targetType": "full",
- "statusVal": "",
- "statusType": "auto",
- "x": 1250,
- "y": 380,
- "wires": []
- },
- {
- "id": "d153c5b44a8efd0f",
- "type": "link out",
- "z": "f2fa6dd5ecc6fee9",
- "name": "Insert SQL",
- "links": [
- "3bb68b7aeccf8f51"
- ],
- "x": 1315,
- "y": 460,
- "wires": []
- },
- {
- "id": "3bb68b7aeccf8f51",
- "type": "link in",
- "z": "d354ea3adc51a23c",
- "name": "",
- "links": [
- "d153c5b44a8efd0f",
- "d2cda8c31ac9faa4"
- ],
- "x": 185,
- "y": 240,
- "wires": [
- [
- "5fc826242df12119",
- "b8cb5c9b2d285f45"
- ]
- ]
- },
- {
- "id": "6f5ec86de53be60c",
- "type": "debug",
- "z": "d354ea3adc51a23c",
- "name": "",
- "active": true,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "statusVal": "",
- "statusType": "auto",
- "x": 700,
- "y": 240,
- "wires": []
- },
- {
- "id": "934584fe81169855",
- "type": "function",
- "z": "f2fa6dd5ecc6fee9",
- "name": "Select From DB",
- "func": "/*var topic = \"SELECT JSON_UNQUOTE (JSON_OBJECT ('id',id, 'date',date,'time',time,'tempc',tempc,'humidity',humidity,'pressure',pressure,'maxtemp',maxtemp,'mintemp',mintemp,'windspeed',windspeed,'winddirection',winddirection )) \\\n FROM Weather ORDER BY id DESC LIMIT 50;\"\n*/\nvar topic = \"SELECT * from Weather ORDER BY id DESC LIMIT 50;\"\nmsg.topic=topic;\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 900,
- "y": 580,
- "wires": [
- [
- "d2cda8c31ac9faa4"
- ]
- ]
- },
- {
- "id": "3b0f0afc5c00b5eb",
- "type": "inject",
- "z": "f2fa6dd5ecc6fee9",
- "name": "",
- "props": [
- {
- "p": "payload"
- },
- {
- "p": "topic",
- "vt": "str"
- }
- ],
- "repeat": "",
- "crontab": "",
- "once": true,
- "onceDelay": "10",
- "topic": "",
- "payloadType": "date",
- "x": 680,
- "y": 580,
- "wires": [
- [
- "934584fe81169855"
- ]
- ]
- },
- {
- "id": "d2cda8c31ac9faa4",
- "type": "link out",
- "z": "f2fa6dd5ecc6fee9",
- "name": "SELECT",
- "links": [
- "3bb68b7aeccf8f51"
- ],
- "x": 1245,
- "y": 580,
- "wires": []
- },
- {
- "id": "b8cb5c9b2d285f45",
- "type": "debug",
- "z": "d354ea3adc51a23c",
- "name": "Select Request",
- "active": true,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "true",
- "targetType": "full",
- "statusVal": "",
- "statusType": "auto",
- "x": 490,
- "y": 360,
- "wires": []
- },
- {
- "id": "491fa31d350138cd",
- "type": "ui_chart",
- "z": "c5f6844437dd47a5",
- "name": "",
- "group": "b7d12b8d.651c8",
- "order": 1,
- "width": "20",
- "height": "7",
- "label": "chart",
- "chartType": "line",
- "legend": "true",
- "xformat": "HH:mm:ss",
- "interpolate": "linear",
- "nodata": "",
- "dot": false,
- "ymin": "",
- "ymax": "",
- "removeOlder": 1,
- "removeOlderPoints": "",
- "removeOlderUnit": "86400",
- "cutout": 0,
- "useOneColor": false,
- "useUTC": false,
- "colors": [
- "#1f77b4",
- "#aec7e8",
- "#ff7f0e",
- "#2ca02c",
- "#98df8a",
- "#d62728",
- "#ff9896",
- "#9467bd",
- "#c5b0d5"
- ],
- "outputs": 1,
- "useDifferentColor": false,
- "className": "",
- "x": 530,
- "y": 380,
- "wires": [
- []
- ]
- },
- {
- "id": "e7818ae4907668b2",
- "type": "function",
- "z": "c5f6844437dd47a5",
- "name": "",
- "func": "var payload = msg.payload.tempc;\nmsg.payload = payload;\nreturn msg;",
- "outputs": 1,
- "noerr": 0,
- "initialize": "",
- "finalize": "",
- "libs": [],
- "x": 300,
- "y": 380,
- "wires": [
- [
- "491fa31d350138cd"
- ]
- ]
- }
- ]
|