Gage node: Bedingt formatieren

AloisB

New member
Hallo alle,
ich habe zwei Gage-Nodes nebeneinender im Daschboard (Ist und Soll). Wenn Ist < Soll, dann sollen alle Segmentfarben von ist von grün auf rot wechseln.
Ich weiß, dass ich eine Funktion-Node brauche mit der ich über ui_control die Eigenschaften der Gage-Node steuere .... aber wie schreibe ich obige Bedingung rein?

Hoffe auf eure Hilfe.
b.g. Alois
 
Hab mittlerweile die Lösung:

Javascript:
[
    {
        "id": "ccd1a789b7c2b451",
        "type": "inject",
        "z": "d3367dc9b038bd22",
        "name": "set",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "set",
        "payload": "25",
        "payloadType": "num",
        "x": 170,
        "y": 480,
        "wires": [
            [
                "72d70eebee1e87e0"
            ]
        ]
    },
    {
        "id": "1becc3ed638a3a6b",
        "type": "debug",
        "z": "d3367dc9b038bd22",
        "name": "debug 117",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": true,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "payload",
        "statusType": "auto",
        "x": 770,
        "y": 580,
        "wires": []
    },
    {
        "id": "8d23252f01753a62",
        "type": "function",
        "z": "d3367dc9b038bd22",
        "name": "function 10",
        "func": "let _set = msg.payload[\"set\"];\nlet _act  = msg.payload[\"act\"];\n\nif(_set > _act){\n    msg = {\n        ui_control: {colors: [\"red\", \"red\", \"red\"]},\n        payload: _act\n    }\n} else{\n    msg = {\n        ui_control: {colors: [\"gray\", \"gray\", \"gray\"]},\n        payload: _act\n    }\n}\nreturn msg;",
        "outputs": 1,
        "timeout": 0,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 540,
        "y": 520,
        "wires": [
            [
                "1becc3ed638a3a6b",
                "13bf44429215cbfe"
            ]
        ]
    },
    {
        "id": "f4a64247c3e411cb",
        "type": "comment",
        "z": "d3367dc9b038bd22",
        "name": "Gage: Conditional color",
        "info": "join: \nCollects 2 inputs and join them to an object\nand give each of the inputs a key (topic).\n\nfunction:\nReferes to this keys and create the\ncondition based on them.\n\nhttps://www.youtube.com/watch?v=vKf9VZ5A1HQ",
        "x": 420,
        "y": 440,
        "wires": []
    },
    {
        "id": "376dbbdedc95a4bd",
        "type": "inject",
        "z": "d3367dc9b038bd22",
        "name": "actual",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "act",
        "payload": "24",
        "payloadType": "num",
        "x": 170,
        "y": 540,
        "wires": [
            [
                "72d70eebee1e87e0"
            ]
        ]
    },
    {
        "id": "72d70eebee1e87e0",
        "type": "join",
        "z": "d3367dc9b038bd22",
        "name": "",
        "mode": "custom",
        "build": "object",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "useparts": false,
        "accumulate": false,
        "timeout": "5",
        "count": "2",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 370,
        "y": 520,
        "wires": [
            [
                "8d23252f01753a62"
            ]
        ]
    },
    {
        "id": "13bf44429215cbfe",
        "type": "ui_gauge",
        "z": "d3367dc9b038bd22",
        "name": "",
        "group": "e14ecf9f02acfaec",
        "order": 0,
        "width": 0,
        "height": 0,
        "gtype": "gage",
        "title": "gauge",
        "label": "units",
        "format": "{{value}}",
        "min": "15",
        "max": "35",
        "colors": [
            "#00b500",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "20",
        "seg2": "30",
        "diff": false,
        "className": "",
        "x": 750,
        "y": 520,
        "wires": []
    },
    {
        "id": "e14ecf9f02acfaec",
        "type": "ui_group",
        "name": "Test",
        "tab": "148d738185733779",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "148d738185733779",
        "type": "ui_tab",
        "name": "Test",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]
 

Zurzeit aktive Besucher

Keine Mitglieder online.

Letzte Anleitungen

Statistik des Forums

Themen
6.409
Beiträge
61.728
Mitglieder
6.592
Neuestes Mitglied
Fred1955
Zurück
Oben