NittyGritty icon

Template

NittyGritty | PRO | 05/08/24 02:43:24 PM UTC | 0 ⭐ | 10913 👁️ | Never ⏰ | []
JSON |

5.73 KB

|

None

|

0 👍

/

0 👎

[
    {
        "id": "6d054402.bae15c",
        "type": "tab",
        "label": "Template Test",
        "disabled": false,
        "info": ""
    },
    {
        "id": "8bc45fe100c4d4b6",
        "type": "function",
        "z": "6d054402.bae15c",
        "name": "function 58",
        "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;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 310,
        "y": 60,
        "wires": [
            [
                "098b601643948d23",
                "0259f282ce685ac9"
            ]
        ]
    },
    {
        "id": "098b601643948d23",
        "type": "template",
        "z": "6d054402.bae15c",
        "name": "html template",
        "field": "payload",
        "fieldType": "msg",
        "format": "html",
        "syntax": "mustache",
        "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",
        "output": "str",
        "x": 540,
        "y": 80,
        "wires": [
            [
                "15917e027feb8cfb"
            ]
        ]
    },
    {
        "id": "15917e027feb8cfb",
        "type": "ui_template",
        "z": "6d054402.bae15c",
        "group": "4a93a592.39efec",
        "name": "Temp/Hum/Dew",
        "order": 2,
        "width": "0",
        "height": "0",
        "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>",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 540,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "bd5d7af5b7e6584b",
        "type": "inject",
        "z": "6d054402.bae15c",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "30",
        "crontab": "",
        "once": true,
        "onceDelay": "3",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 130,
        "y": 60,
        "wires": [
            [
                "8bc45fe100c4d4b6"
            ]
        ]
    },
    {
        "id": "0259f282ce685ac9",
        "type": "debug",
        "z": "6d054402.bae15c",
        "name": "debug 48",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 520,
        "y": 40,
        "wires": []
    },
    {
        "id": "4a93a592.39efec",
        "type": "ui_group",
        "name": "",
        "tab": "c4971399.f6246",
        "order": 1,
        "disp": true,
        "width": "16",
        "collapse": false,
        "className": ""
    },
    {
        "id": "c4971399.f6246",
        "type": "ui_tab",
        "name": "TempHumDewAF",
        "icon": "dashboard",
        "order": 2,
        "disabled": false,
        "hidden": false
    }
]

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎

    
        
  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎