NittyGritty icon

Dimmer-Beispiel

NittyGritty | PRO | 12/17/21 03:30:04 PM UTC | 0 ⭐ | 1495 👁️ | Never ⏰ | []
JSON |

21.16 KB

|

None

|

0 👍

/

0 👎

[
    {
        "id": "3b579211e4193673",
        "type": "function",
        "z": "98537bea.1dd4b8",
        "name": "Brightness up",
        "func": "var step = global.get(\"Step\");\nvar brightness =  global.get(\"Osram-Kueche-Brightness\");\nvar ColorTemp = global.get(\"Osram-Kueche-ColorTemp\");\n\nif(brightness > 0){\n    brightness = brightness + step;\n    global.set(\"Osram-Kueche-Brightness\",brightness);\n\t}\n\t\nif(brightness >= 255){\n    brightness = 254;\n    flow.set('press', false);\n    global.set(\"Osram-Kueche-Brightness\",brightness);\n    }\n\nmsg.topic = \"/home/zigbee/Osram-Kueche/set\"\nmsg.payload = {\"state\":\"ON\",\"brightness\":brightness,\"color_temp\":ColorTemp};\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Brightness: \" + brightness });\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 740,
        "y": 1080,
        "wires": [
            [
                "39764d730d87c8a8",
                "d2168f3d5bfa673f"
            ]
        ]
    },
    {
        "id": "3ab62d5d0fc69c27",
        "type": "function",
        "z": "98537bea.1dd4b8",
        "name": "Brightness down",
        "func": "var step = global.get(\"Step\");\nvar brightness =  global.get(\"Osram-Kueche-Brightness\");\nvar ColorTemp = global.get(\"Osram-Kueche-ColorTemp\");\n\nif(brightness <= 255){\n    brightness = brightness - step; \n    global.set(\"Osram-Kueche-Brightness\",brightness);\n\t}\n\t\nif(brightness <= 0){\n    brightness = 1;\n    flow.set('press', false);\n    global.set(\"Osram-Kueche-Brightness\",brightness);\n    }\n    \nmsg.topic = \"/home/zigbee/Osram-Kueche/set\"\nmsg.payload = {\"state\":\"ON\",\"brightness\":brightness,\"color_temp\":ColorTemp};\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Brightness: \" + brightness });\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 730,
        "y": 1160,
        "wires": [
            [
                "39764d730d87c8a8",
                "dadfb7b9050f4850"
            ]
        ]
    },
    {
        "id": "4d2e6dc3bb4fdb86",
        "type": "switch",
        "z": "98537bea.1dd4b8",
        "name": "Control loop",
        "property": "press",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1150,
        "y": 1080,
        "wires": [
            [
                "3ab62d5d0fc69c27"
            ]
        ]
    },
    {
        "id": "81658a69cc85d85b",
        "type": "switch",
        "z": "98537bea.1dd4b8",
        "name": "Control loop",
        "property": "press",
        "propertyType": "flow",
        "rules": [
            {
                "t": "true"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 1150,
        "y": 1160,
        "wires": [
            [
                "3b579211e4193673"
            ]
        ]
    },
    {
        "id": "d2168f3d5bfa673f",
        "type": "delay",
        "z": "98537bea.1dd4b8",
        "name": "",
        "pauseType": "delay",
        "timeout": "100",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 970,
        "y": 1160,
        "wires": [
            [
                "81658a69cc85d85b"
            ]
        ]
    },
    {
        "id": "dadfb7b9050f4850",
        "type": "delay",
        "z": "98537bea.1dd4b8",
        "name": "",
        "pauseType": "delay",
        "timeout": "100",
        "timeoutUnits": "milliseconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "outputs": 1,
        "x": 970,
        "y": 1080,
        "wires": [
            [
                "4d2e6dc3bb4fdb86"
            ]
        ]
    },
    {
        "id": "2860bb1b36d8e137",
        "type": "change",
        "z": "98537bea.1dd4b8",
        "name": "start",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 770,
        "y": 960,
        "wires": [
            [
                "45913c7235f0f154"
            ]
        ]
    },
    {
        "id": "d1fe0f19ab2df11f",
        "type": "change",
        "z": "98537bea.1dd4b8",
        "name": "stop",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 770,
        "y": 1000,
        "wires": [
            [
                "45913c7235f0f154"
            ]
        ]
    },
    {
        "id": "45913c7235f0f154",
        "type": "change",
        "z": "98537bea.1dd4b8",
        "name": "Control the loop",
        "rules": [
            {
                "t": "set",
                "p": "press",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1160,
        "y": 980,
        "wires": [
            []
        ]
    },
    {
        "id": "39764d730d87c8a8",
        "type": "mqtt out",
        "z": "98537bea.1dd4b8",
        "name": "Osram-Küche",
        "topic": "",
        "qos": "",
        "retain": "",
        "respTopic": "",
        "contentType": "",
        "userProps": "",
        "correl": "",
        "expiry": "",
        "broker": "595dfa51.2c1224",
        "x": 1160,
        "y": 820,
        "wires": []
    },
    {
        "id": "69f647dd88c9c3e7",
        "type": "function",
        "z": "98537bea.1dd4b8",
        "name": "ON",
        "func": "var brightness =  global.get(\"Osram-Kueche-Brightness\");\nvar ColorTemp = global.get(\"Osram-Kueche-ColorTemp\");\n\nmsg.topic = \"/home/zigbee/Osram-Kueche/set\"\nmsg.payload = {\"state\":\"ON\",\"brightness\":brightness,\"color_temp\":ColorTemp};\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Brightness: \" + brightness });\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 770,
        "y": 800,
        "wires": [
            [
                "39764d730d87c8a8"
            ]
        ]
    },
    {
        "id": "c3d7fd7c9b059963",
        "type": "function",
        "z": "98537bea.1dd4b8",
        "name": "OFF",
        "func": "var step = global.get(\"Step\");\nvar brightness =  global.get(\"Osram-Kueche-Brightness\");\nvar ColorTemp = global.get(\"Osram-Kueche-ColorTemp\");\n\nmsg.topic = \"/home/zigbee/Osram-Kueche/set\"\nmsg.payload = {\"state\":\"OFF\",\"brightness\":brightness,\"color_temp\":ColorTemp};\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Brightness: \" + brightness });\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 770,
        "y": 860,
        "wires": [
            [
                "39764d730d87c8a8"
            ]
        ]
    },
    {
        "id": "7d706109166b7846",
        "type": "inject",
        "z": "98537bea.1dd4b8",
        "name": "Osram-Kueche",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "/home/zigbee/Osram-Kueche/get",
        "payload": "{\"state\": \"\"}",
        "payloadType": "str",
        "x": 940,
        "y": 1320,
        "wires": [
            [
                "39764d730d87c8a8"
            ]
        ]
    },
    {
        "id": "f584c5871638c238",
        "type": "switch",
        "z": "98537bea.1dd4b8",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "ON",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "OFF",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 390,
        "y": 840,
        "wires": [
            [
                "69f647dd88c9c3e7"
            ],
            [
                "c3d7fd7c9b059963"
            ]
        ]
    },
    {
        "id": "da3c903a549e06ba",
        "type": "inject",
        "z": "98537bea.1dd4b8",
        "name": "On",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "ON",
        "payloadType": "str",
        "x": 150,
        "y": 820,
        "wires": [
            [
                "f584c5871638c238"
            ]
        ]
    },
    {
        "id": "63e536f00a4a2a63",
        "type": "inject",
        "z": "98537bea.1dd4b8",
        "name": "Off",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "OFF",
        "payloadType": "str",
        "x": 150,
        "y": 860,
        "wires": [
            [
                "f584c5871638c238"
            ]
        ]
    },
    {
        "id": "08f4db8c8e3bf0c6",
        "type": "link in",
        "z": "98537bea.1dd4b8",
        "name": "Licht Küche-On-Off",
        "links": [
            "156b8eb58ea47b97",
            "3db617d9c19542c9",
            "cfd097d97aea7ec1",
            "88dbc163876b9940",
            "ec234b4c2c6ac997"
        ],
        "x": 185,
        "y": 780,
        "wires": [
            [
                "f584c5871638c238"
            ]
        ]
    },
    {
        "id": "f77bde811d3513b2",
        "type": "switch",
        "z": "98537bea.1dd4b8",
        "name": "Messages",
        "property": "payload.action",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "arrow_right_click",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "arrow_right_hold",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "arrow_right_release",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "arrow_left_click",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "arrow_left_hold",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "arrow_left_release",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 6,
        "x": 370,
        "y": 1060,
        "wires": [
            [
                "69f647dd88c9c3e7"
            ],
            [
                "2860bb1b36d8e137",
                "3b579211e4193673"
            ],
            [
                "d1fe0f19ab2df11f"
            ],
            [
                "c3d7fd7c9b059963"
            ],
            [
                "3ab62d5d0fc69c27",
                "2860bb1b36d8e137"
            ],
            [
                "d1fe0f19ab2df11f"
            ]
        ]
    },
    {
        "id": "787bcbc8a4615f34",
        "type": "mqtt in",
        "z": "98537bea.1dd4b8",
        "name": "IKEA Button",
        "topic": "/home/zigbee/Ikea-Button",
        "qos": "1",
        "datatype": "json",
        "broker": "595dfa51.2c1224",
        "inputs": 0,
        "x": 170,
        "y": 1060,
        "wires": [
            [
                "f77bde811d3513b2"
            ]
        ]
    },
    {
        "id": "47d625f8e76bbf6c",
        "type": "mqtt in",
        "z": "98537bea.1dd4b8",
        "name": "",
        "topic": "/home/zigbee/Osram-Kueche",
        "qos": "2",
        "datatype": "auto",
        "broker": "595dfa51.2c1224",
        "nl": false,
        "rap": false,
        "inputs": 0,
        "x": 200,
        "y": 1620,
        "wires": [
            [
                "028c42e493ec4756"
            ]
        ]
    },
    {
        "id": "30f17fecfd960cb4",
        "type": "debug",
        "z": "98537bea.1dd4b8",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 910,
        "y": 1640,
        "wires": []
    },
    {
        "id": "028c42e493ec4756",
        "type": "json",
        "z": "98537bea.1dd4b8",
        "name": "",
        "property": "payload",
        "action": "",
        "pretty": false,
        "x": 430,
        "y": 1620,
        "wires": [
            [
                "8dc5feb5120ad76c",
                "0f055ee4396e48d0"
            ]
        ]
    },
    {
        "id": "8dc5feb5120ad76c",
        "type": "function",
        "z": "98537bea.1dd4b8",
        "name": "",
        "func": "var Knoten = \"Osram-Kueche\"\n\nvar brightness = msg.payload.brightness\nvar qual = msg.payload.linkquality\nvar state = msg.payload.state\n\nmsg.payload = [{\n    Room: Knoten,\n    Bright: brightness,\n    Qual: qual,\n    State: state\n}]\n\nvar newMsg1 = {payload:brightness};\nvar newMsg2 = {payload:state};\nvar newMsg3 = {payload:qual};\nvar newMsg4 = {payload:msg};\n\nnode.status({fill:\"blue\",shape:\"ring\",text:\"Brightness: \" + brightness + \", Qual: \" + qual + \"%, State: \" + state });\n\nreturn [newMsg1, newMsg2, newMsg3, newMsg4];",
        "outputs": 4,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 640,
        "y": 1620,
        "wires": [
            [
                "53e238e062753512"
            ],
            [
                "8f9aaeb045867d4b",
                "d933792c7a1313d1"
            ],
            [
                "4d2e235f11be354a"
            ],
            [
                "30f17fecfd960cb4"
            ]
        ]
    },
    {
        "id": "8f9aaeb045867d4b",
        "type": "ui_led",
        "z": "98537bea.1dd4b8",
        "order": 3,
        "group": "4097eeeffb6bf15d",
        "width": "0",
        "height": "0",
        "label": "Ein / Aus LED",
        "labelPlacement": "left",
        "labelAlignment": "left",
        "colorForValue": [
            {
                "color": "#ff0000",
                "value": "OFF",
                "valueType": "str"
            },
            {
                "color": "#008000",
                "value": "ON",
                "valueType": "str"
            }
        ],
        "allowColorForValueInMessage": false,
        "shape": "circle",
        "showGlow": true,
        "name": "",
        "x": 890,
        "y": 1500,
        "wires": []
    },
    {
        "id": "4d2e235f11be354a",
        "type": "ui_gauge",
        "z": "98537bea.1dd4b8",
        "name": "Link Quality",
        "group": "4097eeeffb6bf15d",
        "order": 4,
        "width": "0",
        "height": "0",
        "gtype": "gage",
        "title": "Link Quality",
        "label": "%",
        "format": "{{value}}",
        "min": 0,
        "max": "100",
        "colors": [
            "#ff0000",
            "#e6e600",
            "#00ff01"
        ],
        "seg1": "",
        "seg2": "",
        "x": 910,
        "y": 1600,
        "wires": []
    },
    {
        "id": "d933792c7a1313d1",
        "type": "ui_switch",
        "z": "98537bea.1dd4b8",
        "name": "",
        "label": "Ein / Ausschalter",
        "tooltip": "",
        "group": "4097eeeffb6bf15d",
        "order": 2,
        "width": "0",
        "height": "0",
        "passthru": false,
        "decouple": "true",
        "topic": "/home/zigbee/IKEA-Schlazi/set",
        "topicType": "str",
        "style": "",
        "onvalue": "ON",
        "onvalueType": "str",
        "onicon": "",
        "oncolor": "",
        "offvalue": "OFF",
        "offvalueType": "str",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "x": 930,
        "y": 1540,
        "wires": [
            [
                "ec234b4c2c6ac997"
            ]
        ]
    },
    {
        "id": "0f055ee4396e48d0",
        "type": "debug",
        "z": "98537bea.1dd4b8",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 660,
        "y": 1700,
        "wires": []
    },
    {
        "id": "53e238e062753512",
        "type": "range",
        "z": "98537bea.1dd4b8",
        "minin": "2",
        "maxin": "254",
        "minout": "2",
        "maxout": "100",
        "action": "scale",
        "round": true,
        "property": "payload",
        "name": "",
        "x": 740,
        "y": 1400,
        "wires": [
            [
                "3d26906748764bca"
            ]
        ]
    },
    {
        "id": "3d26906748764bca",
        "type": "ui_slider",
        "z": "98537bea.1dd4b8",
        "name": "Helligkeit",
        "label": "Helligkeit",
        "tooltip": "",
        "group": "4097eeeffb6bf15d",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "outs": "end",
        "topic": "/home/zigbee/IKEA-Schlazi/set",
        "topicType": "str",
        "min": "1",
        "max": "100",
        "step": "2",
        "x": 840,
        "y": 1460,
        "wires": [
            [
                "c630d0195e3bb8c4"
            ]
        ]
    },
    {
        "id": "4b9fcb6aac104767",
        "type": "debug",
        "z": "98537bea.1dd4b8",
        "name": "",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 1170,
        "y": 1400,
        "wires": []
    },
    {
        "id": "c630d0195e3bb8c4",
        "type": "range",
        "z": "98537bea.1dd4b8",
        "minin": "1",
        "maxin": "100",
        "minout": "1",
        "maxout": "255",
        "action": "scale",
        "round": true,
        "property": "payload",
        "name": "",
        "x": 940,
        "y": 1400,
        "wires": [
            [
                "4b9fcb6aac104767"
            ]
        ]
    },
    {
        "id": "ec234b4c2c6ac997",
        "type": "link out",
        "z": "98537bea.1dd4b8",
        "name": "",
        "links": [
            "08f4db8c8e3bf0c6"
        ],
        "x": 1135,
        "y": 1540,
        "wires": []
    },
    {
        "id": "595dfa51.2c1224",
        "type": "mqtt-broker",
        "name": "",
        "broker": "192.168.123.16",
        "port": "1883",
        "clientid": "",
        "usetls": false,
        "compatmode": true,
        "keepalive": "60",
        "cleansession": true,
        "birthTopic": "",
        "birthQos": "0",
        "birthPayload": "",
        "closeTopic": "",
        "closePayload": "",
        "willTopic": "",
        "willQos": "0",
        "willPayload": ""
    },
    {
        "id": "4097eeeffb6bf15d",
        "type": "ui_group",
        "name": "Küche",
        "tab": "67152ec1.2f63e",
        "order": 6,
        "disp": true,
        "width": "5",
        "collapse": false
    },
    {
        "id": "67152ec1.2f63e",
        "type": "ui_tab",
        "name": "Licht",
        "icon": "dashboard",
        "order": 5,
        "disabled": false,
        "hidden": false
    }
]

Comments