Advertisement
NittyGritty

Template

May 8th, 2024
353
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 5.73 KB | None | 0 0
  1. [
  2.     {
  3.         "id": "6d054402.bae15c",
  4.         "type": "tab",
  5.         "label": "Template Test",
  6.         "disabled": false,
  7.         "info": ""
  8.     },
  9.     {
  10.         "id": "8bc45fe100c4d4b6",
  11.         "type": "function",
  12.         "z": "6d054402.bae15c",
  13.         "name": "function 58",
  14.         "func": "var options = { hour12: false };\nvar date_options = {day: '2-digit', month: '2-digit', year: '2-digit' };\nvar time_options = {hour: '2-digit', minute: '2-digit', second: '2-digit' };\nconst lang = 'de-DE';\n\n\n/**\n* @param {string} value\n* @param {any} index\n* @param {any} array\n*/\nfunction myFunction(value, index, array) {\n  var varname = value + \"-\";\n\n  var Temp = global.get(varname + \"Temp\");\n  var Hum = global.get(varname + \"Hum\");\n  var Dew = global.get(varname + \"Dew\");\n  var AF = global.get(varname + \"AF\");\n  var TS = global.get(varname + \"TimeStamp\");\n\nvar date = new Date(TS);\n\nconst date_locale = date.toLocaleDateString(lang, {\n    day: 'numeric',\n    month: 'short',\n    year: 'numeric'\n  });\nconst time_locale = date.toLocaleTimeString(lang);\nconst formated = `${date_locale} ${time_locale}`;\n\nvar formated1 = (date.toLocaleTimeString([], {\n    hourCycle: 'h23',\n    hour: '2-digit',\n    minute: '2-digit',\n    second: '2-digit'\n  }));\n\nvar Influx = \n    {\n        Room: value,\n        Temp: Temp,\n        Hum: Hum,\n        Dew: Dew,\n        AF: AF,\n        TS: formated\n}\n  return (Influx);\n}\n// ----------------------------------\nconst Rooms = [\"Wozi\",\n            \"Schlazi\",\n             \"Kueche\",\n             \"Eingang\",\n             \"BadFenster\",\n             \"Bad\",\n             \"Flur\",\n             \"Keller\",\n             \"Thermostat\",\n             \"Heizung\",\n             \"Auriol-2\",\n             \"Auriol-3\",\n             \"UPM_ESIC\",\n             \"Xiron\"];\n\nvar Influx1 = Rooms.map(myFunction);\n\nvar msg1={};\nmsg1[\"payload\"]=Influx1;\nreturn msg1;",
  15.         "outputs": 1,
  16.         "timeout": 0,
  17.         "noerr": 0,
  18.         "initialize": "",
  19.         "finalize": "",
  20.         "libs": [],
  21.         "x": 310,
  22.         "y": 60,
  23.         "wires": [
  24.             [
  25.                 "098b601643948d23",
  26.                 "0259f282ce685ac9"
  27.             ]
  28.         ]
  29.     },
  30.     {
  31.         "id": "098b601643948d23",
  32.         "type": "template",
  33.         "z": "6d054402.bae15c",
  34.         "name": "html template",
  35.         "field": "payload",
  36.         "fieldType": "msg",
  37.         "format": "html",
  38.         "syntax": "mustache",
  39.         "template": "<table border=\"1\" width=\"800px\">\n    \n   <thead>\n        <tr>\n            <th colspan=\"6\">Messages</th>\n        </tr>\n    </thead>\n\n    <tr>\n        <th class=\"White\" width =\"40\"> Room</th>\n        <th class=\"red\"width =\"60\"> Temperature</th>\n        <th class=\"blue\" width=\"60\">  Humidity</th>\n        <th class=\"green\" width=\"60\">  Dewpoint</th>\n        <th class=\"yellow\" width=\"50\">  AF</th>\n        <th class=\"White\" width=\"100\"> Time</th>\n    </tr>\n    {{#payload}}\n        <tr class=\"\">\n            <td>{{Room}}</td> \n            <td>{{Temp}}°C</td>\n            <td>{{Hum}}%rH</td>\n            <td>{{Dew}}°C</td>\n            <td>{{AF}}g/m³</td>\n            <td>{{TS}}</td>\n    </tr>\n    {{/payload}}\n</table>\n",
  40.         "output": "str",
  41.         "x": 540,
  42.         "y": 80,
  43.         "wires": [
  44.             [
  45.                 "15917e027feb8cfb"
  46.             ]
  47.         ]
  48.     },
  49.     {
  50.         "id": "15917e027feb8cfb",
  51.         "type": "ui_template",
  52.         "z": "6d054402.bae15c",
  53.         "group": "4a93a592.39efec",
  54.         "name": "Temp/Hum/Dew",
  55.         "order": 2,
  56.         "width": "0",
  57.         "height": "0",
  58.         "format": "<style>\ntd {\ntext-align: right;\n}\n\n.green\n{\n    background-color:green;\n}\n.red\n{\n    background-color:red;\n}\n.yellow\n{\n    background-color:yellow;\n    color:black;\n}\n.blue\n{\n    background-color:blue;\n}\n</style>\n<div ng-bind-html=\"msg.payload\"  style=\"width:800px;height:500px\">\n\n</div>",
  59.         "storeOutMessages": false,
  60.         "fwdInMessages": false,
  61.         "resendOnRefresh": false,
  62.         "templateScope": "local",
  63.         "className": "",
  64.         "x": 540,
  65.         "y": 120,
  66.         "wires": [
  67.             []
  68.         ]
  69.     },
  70.     {
  71.         "id": "bd5d7af5b7e6584b",
  72.         "type": "inject",
  73.         "z": "6d054402.bae15c",
  74.         "name": "",
  75.         "props": [
  76.             {
  77.                 "p": "payload"
  78.             },
  79.             {
  80.                 "p": "topic",
  81.                 "vt": "str"
  82.             }
  83.         ],
  84.         "repeat": "30",
  85.         "crontab": "",
  86.         "once": true,
  87.         "onceDelay": "3",
  88.         "topic": "",
  89.         "payload": "",
  90.         "payloadType": "date",
  91.         "x": 130,
  92.         "y": 60,
  93.         "wires": [
  94.             [
  95.                 "8bc45fe100c4d4b6"
  96.             ]
  97.         ]
  98.     },
  99.     {
  100.         "id": "0259f282ce685ac9",
  101.         "type": "debug",
  102.         "z": "6d054402.bae15c",
  103.         "name": "debug 48",
  104.         "active": false,
  105.         "tosidebar": true,
  106.         "console": false,
  107.         "tostatus": false,
  108.         "complete": "false",
  109.         "statusVal": "",
  110.         "statusType": "auto",
  111.         "x": 520,
  112.         "y": 40,
  113.         "wires": []
  114.     },
  115.     {
  116.         "id": "4a93a592.39efec",
  117.         "type": "ui_group",
  118.         "name": "",
  119.         "tab": "c4971399.f6246",
  120.         "order": 1,
  121.         "disp": true,
  122.         "width": "16",
  123.         "collapse": false,
  124.         "className": ""
  125.     },
  126.     {
  127.         "id": "c4971399.f6246",
  128.         "type": "ui_tab",
  129.         "name": "TempHumDewAF",
  130.         "icon": "dashboard",
  131.         "order": 2,
  132.         "disabled": false,
  133.         "hidden": false
  134.     }
  135. ]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement