Facebook
From Insensitive Bushbaby, 4 Years ago, written in JavaScript.
This paste is a reply to AM from Nick - go back
Embed
Viewing differences between AM and Re: AM
[
    {
        "id": "f2b6ddd6.25351",
        "type": "function",
        "z": "94604175.00524",
        "name": "Increment brightness",
        "func": "brightness = (context.get(\"brightness\") || 1) + 1;\nmsg.brightness = Math.min(255, brightness);\nnode.status({text: msg.brightness});\ncontext.set(\"brightness\", brightness);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 520,
        "y": 80,
        "wires": [
            [
                "b83f6b7b.666e08",
                "671c491e.53fc08",
                "dd0dbd98.d454a",
                "604605d9.b5076c"
            ]
        ]
    },
    {
        "id": "b83f6b7b.666e08",
        "type": "debug",
        "z": "94604175.00524",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "brightness",
        "targetType": "msg",
        "x": 720,
        "y": 20,
        "wires": []
    },
    {
        "id": "4406ac1d.da7904",
        "type": "delay",
        "z": "94604175.00524",
        "name": "delay",
        "pauseType": "delayv",
        "timeout": "5",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "2",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": true,
        "x": 1190,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "43e71f80.7965",
        "type": "change",
        "z": "94604175.00524",
        "name": "reset",
        "rules": [
            {
                "t": "set",
                "p": "reset",
                "pt": "msg",
                "to": "true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 250,
        "y": 520,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "6556a04.635f96",
        "type": "inject",
        "z": "94604175.00524",
        "name": "STOP",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 110,
        "y": 240,
        "wires": [
            [
                "43e71f80.7965",
                "f2b6ddd6.25351",
                "e2fecdcf.9a5ec"
            ]
        ]
    },
    {
        "id": "6b7d413a.b9817",
        "type": "looptimer",
        "z": "94604175.00524",
        "duration": "2",
        "units": "Minute",
        "maxloops": "255",
        "maxtimeout": "7",
        "maxtimeoutunits": "Hour",
        "name": "2min 200x 6.33 Hours",
        "x": 280,
        "y": 40,
        "wires": [
            [
                "f2b6ddd6.25351",
                "e2fecdcf.9a5ec"
            ],
            []
        ]
    },
    {
        "id": "b8d63647.695518",
        "type": "api-call-service",
        "z": "94604175.00524",
        "name": "Living  Room | Overhead",
        "server": "2451a35b.d6669c",
        "version": "1",
        "service_domain": "homeassistant",
        "service": "turn_on",
        "entityId": "light.caseta_r_wireless_in_wall_dimmer",
        "data": "{\"brightness\":\"{{brightness}}\"}",
        "dataType": "json",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 910,
        "y": 480,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "928d0136.507c6",
        "type": "api-call-service",
        "z": "94604175.00524",
        "name": "Foyer | Overhead",
        "server": "2451a35b.d6669c",
        "service_domain": "homeassistant",
        "service": "turn_on",
        "data": "{\"entity_id\":\"light.caseta_r_wireless_in_wall_dimmer_2\",\"brightness\":\"{{brightness}}\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 160,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "671c491e.53fc08",
        "type": "api-call-service",
        "z": "94604175.00524",
        "name": "Dining Room | Overhead",
        "server": "2451a35b.d6669c",
        "service_domain": "homeassistant",
        "service": "turn_on",
        "data": "{\"entity_id\":\"light.caseta_r_wireless_in_wall_dimmer_4\",\"brightness\":\"{{brightness}}\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 910,
        "y": 240,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "76494d08.3ab6a4",
        "type": "api-call-service",
        "z": "94604175.00524",
        "name": "Hallway | Overhead",
        "server": "2451a35b.d6669c",
        "service_domain": "homeassistant",
        "service": "turn_on",
        "data": "{\"entity_id\":\"light.caseta_r_wireless_in_wall_dimmer_5\",\"brightness\":\"{{brightness}}\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 400,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "dd0dbd98.d454a",
        "type": "api-call-service",
        "z": "94604175.00524",
        "name": "Bathroom | Overhead",
        "server": "2451a35b.d6669c",
        "service_domain": "homeassistant",
        "service": "turn_on",
        "data": "{\"entity_id\":\"light.caseta_r_wireless_in_wall_dimmer_6\",\"brightness\":\"{{brightness}}\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 900,
        "y": 320,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "136aaf9.b6bd45",
        "type": "inject",
        "z": "94604175.00524",
        "name": "6am",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "00 06 * * *",
        "once": false,
        "onceDelay": 0.1,
        "x": 90,
        "y": 40,
        "wires": [
            [
                "6b7d413a.b9817"
            ]
        ]
    },
    {
        "id": "e2fecdcf.9a5ec",
        "type": "function",
        "z": "94604175.00524",
        "name": "Increment brightness",
        "func": "brightness = (context.get(\"brightness\") || 15) + 1;\nmsg.brightness = Math.min(255, brightness);\nnode.status({text: msg.brightness});\ncontext.set(\"brightness\", brightness);\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 520,
        "y": 160,
        "wires": [
            [
                "b8d63647.695518",
                "76494d08.3ab6a4",
                "b83f6b7b.666e08"
            ]
        ]
    },
    {
        "id": "604605d9.b5076c",
        "type": "delay",
        "z": "94604175.00524",
        "name": "",
        "pauseType": "delay",
        "timeout": "1",
        "timeoutUnits": "seconds",
        "rate": "1",
        "nbRateUnits": "1",
        "rateUnits": "second",
        "randomFirst": "1",
        "randomLast": "5",
        "randomUnits": "seconds",
        "drop": false,
        "x": 780,
        "y": 120,
        "wires": [
            [
                "928d0136.507c6",
                "1dfed425.fc6f4c"
            ]
        ]
    },
    {
        "id": "1dfed425.fc6f4c",
        "type": "api-call-service",
        "z": "94604175.00524",
        "name": "Kitchen | Overhead",
        "server": "2451a35b.d6669c",
        "service_domain": "homeassistant",
        "service": "turn_on",
        "data": "{\"entity_id\":\"light.caseta_r_wireless_in_wall_dimmer_7\",\"brightness\":\"{{brightness}}\"}",
        "mergecontext": "",
        "output_location": "",
        "output_location_type": "none",
        "mustacheAltTags": false,
        "x": 890,
        "y": 80,
        "wires": [
            [
                "4406ac1d.da7904"
            ]
        ]
    },
    {
        "id": "2451a35b.d6669c",
        "type": "server",
        "z": "",
        "name": "Home Assistant"
    }
]