Automatyzacje oświetlenia w korytarzu i kuchni - Home Assistant i Node-RED

Automatyzacje oświetlenia w korytarzu i kuchni - Home Assistant i Node-RED

Czemu uwielbiam Home Assistant i automatyzacje tworzone w Node-RED? Ponieważ pozwalają stworzyć nieograniczone możliwości automatyzacji! Możemy bardzo prosto je rozbudowywać czy wyłączać poszczególne flow ale co najważniejsze, prześledzić dokładnie co nie działa.

U mnie kuchnia jest otwarta na korytarz, a korytarz na strefę dzienną, więc dość dużo jest zależne od siebie. Jednak ze względu na to, że automatyzację w strefie dziennej mam tak naprawdę tylko jedną, czyli Movie Time, który pokazywałem wcześniej na tym filmie:

...więc tylko gdy ona jest włączona, wszystko w całym mieszkaniu się zmienia i to właśnie też widać na poniższych diagramie.  

Jak widzicie poszalałem tutaj znacząco ale zróbmy to po kolei!

Przedpokój

Jest to pomieszczenie gdzie ciągle się chodzi, dlatego bez sensu aby cały czas zapalało się nam światło - wyzwalamy je wyłącznie otwarciem drzwi lub... jak jest bardzo ciemno (wtedy tylko jedną żarówkę) i WSZYSTKIE światła w mieszkaniu są wyłączone. Mam jeszcze przy lustrze takie kule ozdobne, to one też się zaświecą w nocy. Oczywiście aby zapaliło otwarcie drzwi światło to musimy wchodzić i musi być ciemno, a więc -> pierw otwarcie a dopiero potem czujnik ruchu wykrywa ruch - nie odwrotnie! 

Poniżej mamy tylko zapalanie się tabletu (te żółte elementy). Ale kiedy się gaszą?

Wtedy kiedy są zaświecone i nie ma ruchu w przedpokoju. Chwila, chwila ale tam dalej jest... ano właśnie zapalnie światła, jeżeli przez pierwsze 2 minuty od jego zgaszenia się wyłączyło. Przestaliśmy się ruszać, weszliśmy do łazienki na chwilę itp. wtedy światło (ale tylko wtedy kiedy się wcześniej paliło i nie dłużej niż 2 minuty temu) się ponownie zaświeci - dla nas to jest idealne! 

Kuchnia

Tutaj jest już prosta sprawa, zapala się zawsze, chyba, że jest mega jasno na zewnątrz.

Jak widzicie na pomarańczowym tle, to jak jest dość jasno światło się nam nie zapali, jak jest pomiędzy 6:00 a 7:00 czyli godziną kiedy Kasia ma na rano to pali się mniejsze światło (tylko przy oknie) i przy okazji gasi światło w przedpokoju ;) jak oglądamy film to też włącza się tylko takie mega ciemne światło, ozdobne przy rozkładanym stoliku w kuchni (ozdobne nad cegłami). Zwróćcie uwagę też na to, że pracuję tutaj na grupach czujników ruchu a nie pojedynczych elementach. Jeszcze możecie zwrócić uwagę na to, że nad blatem mam dodatkowy przycisk aby to światło jednak włączyć jak mi jest za ciemno - Kasia inaczej postrzega, że jest jasno, a ja inaczej i to jest nasz kompromis ;) 

Kod

No to co jak chcecie dokładnie to prześledzić to możecie zaglądnąć tutaj. Oczywiście dało by się to na pewno prościej zrobić ALE, ja to cały czas rozbudowuję, wcześniej to połowy nie było i tak się dobudowuje elementy i... ważne, że działa więc nie ruszam ;) 

[
    {
        "id": "54d8466e.e2ead8",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "name": "Motion Hallway Group On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "group.motion_hallway",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 150,
        "y": 320,
        "wires": [
            [
                "1fbc3f5a.c715d1"
            ],
            [
                "e5460254.c18b2",
                "ec923acc.8b0918",
                "ff54b472.91d8b8"
            ]
        ]
    },
    {
        "id": "bbb23d20.266b7",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Hallway Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.shelly_shsw_1_59e9b3",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 970,
        "y": 340,
        "wires": [
            [
                "c3f56a28.5f0b78"
            ]
        ]
    },
    {
        "id": "b632d4b2.d3dac8",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "d": true,
        "name": "Open Sensor Door",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.door_home",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 130,
        "y": 480,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "df3fafb8.a7c0d",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Mirror Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "light",
        "service": "turn_off",
        "entityId": "light.mirror_light",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 780,
        "y": 440,
        "wires": [
            []
        ]
    },
    {
        "id": "ff54b472.91d8b8",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Hallway light on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.shelly_shsw_1_59e9b3",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 490,
        "y": 320,
        "wires": [
            [
                "15ff407e.5d08c"
            ],
            []
        ]
    },
    {
        "id": "48891c2b.1b7f64",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Mirror Light On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "light",
        "service": "turn_on",
        "entityId": "light.mirror_light",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1160,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "e5460254.c18b2",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Mirror light on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.mirror_light",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 460,
        "y": 440,
        "wires": [
            [
                "6d669cca.c84704"
            ],
            []
        ]
    },
    {
        "id": "3f367477.17c04c",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Group Office On?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "group.office_work_time",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 1190,
        "y": 60,
        "wires": [
            [],
            [
                "9c3e1316.a54af"
            ]
        ]
    },
    {
        "id": "d77d5126.17453",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Group Living On?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "group.living_room_lights_cinema",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 990,
        "y": 60,
        "wires": [
            [],
            [
                "3f367477.17c04c"
            ]
        ]
    },
    {
        "id": "c81cda36.2e50d8",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "name": "Motion Kitchen Group On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "group.motion_kitchen",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 150,
        "y": 660,
        "wires": [
            [
                "ad4e8b92.523938",
                "8356e4fc.82d2f8",
                "e5460254.c18b2"
            ],
            [
                "ecf6c354.ddb0d"
            ]
        ]
    },
    {
        "id": "7c544936.34a848",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Kitchen Work Light On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.0xcc86ecfffebb3f45_l1",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1180,
        "y": 680,
        "wires": [
            []
        ]
    },
    {
        "id": "f2a30d99.6ab35",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Kitchen All Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.0xcc86ecfffebb3e28_l1, switch.0xcc86ecfffebb3e28_l2, switch.0xcc86ecfffebb3f45_l1, switch.0xcc86ecfffebb3f45_l2",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1130,
        "y": 740,
        "wires": [
            []
        ]
    },
    {
        "id": "36fe2c47.ff5254",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Kitchen Window Light On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.0xcc86ecfffebb3f45_l2",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 950,
        "y": 580,
        "wires": [
            [
                "e5460254.c18b2",
                "ec923acc.8b0918"
            ]
        ]
    },
    {
        "id": "63529f2b.6582b",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "d": true,
        "name": "Kitchen Work Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "switch.bfccec19e3815e7965sezw_1",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "off",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 140,
        "y": 560,
        "wires": [
            [
                "fac8cc17.46a2f"
            ],
            []
        ]
    },
    {
        "id": "fac8cc17.46a2f",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "d": true,
        "name": "Kitchen Window Light Off",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_off",
        "entityId": "switch.bfccec19e3815e7965sezw_2",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 470,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "ad4e8b92.523938",
        "type": "time-range-switch",
        "z": "78f69306.4a472c",
        "name": "od 6:00 do 7:00",
        "lat": "50.2443",
        "lon": "19.04186",
        "startTime": "6:00",
        "endTime": "7:00",
        "startOffset": 0,
        "endOffset": 0,
        "x": 440,
        "y": 660,
        "wires": [
            [
                "4671dc4f.4c73a4"
            ],
            [
                "9e981b3d.2cb158"
            ]
        ]
    },
    {
        "id": "b44ed431.15bcc8",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Hallway Light On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.shelly_shsw_1_59e9b3",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 990,
        "y": 280,
        "wires": [
            []
        ]
    },
    {
        "id": "964520ca.9c8ff",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "d": true,
        "name": "Hallway Light On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "switch.shelly_shsw_1_59e9b3",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 120,
        "y": 420,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "9c3e1316.a54af",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Hallway light on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.shelly_shsw_1_59e9b3",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 710,
        "y": 120,
        "wires": [
            [],
            [
                "800bc84b.ee4408"
            ]
        ]
    },
    {
        "id": "15ff407e.5d08c",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Hallway motion on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "group.motion_hallway",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 710,
        "y": 340,
        "wires": [
            [],
            [
                "bbb23d20.266b7"
            ]
        ]
    },
    {
        "id": "76f10358.db5f5c",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Kitchen light on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.0xcc86ecfffebb3f45_l1",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 770,
        "y": 60,
        "wires": [
            [],
            [
                "d77d5126.17453"
            ]
        ]
    },
    {
        "id": "9e981b3d.2cb158",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Illuminance Kitchen < 60",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "60",
        "halt_if_type": "num",
        "halt_if_compare": "lt",
        "entity_id": "sensor.0x00158d000449b6ca_illuminance",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 690,
        "y": 660,
        "wires": [
            [
                "ffab78d2.81ae28"
            ],
            []
        ]
    },
    {
        "id": "8356e4fc.82d2f8",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Illuminance Kitchen < 40",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "40",
        "halt_if_type": "num",
        "halt_if_compare": "lt",
        "entity_id": "sensor.0x00158d000449b6ca_illuminance",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 470,
        "y": 580,
        "wires": [
            [
                "4671dc4f.4c73a4"
            ],
            []
        ]
    },
    {
        "id": "1fbc3f5a.c715d1",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Illuminance Kitchen < 10",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "10",
        "halt_if_type": "num",
        "halt_if_compare": "lt",
        "entity_id": "sensor.0x00158d000449b6ca_illuminance",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 390,
        "y": 120,
        "wires": [
            [
                "fb698203.dfc1d"
            ],
            []
        ]
    },
    {
        "id": "9ad0f1d9.5a171",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Motion Kitchen Sonoff on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "binary_sensor.motion_kitchen_rf",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 620,
        "y": 740,
        "wires": [
            [],
            [
                "d187dec4.094cb"
            ]
        ]
    },
    {
        "id": "d187dec4.094cb",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Motion Kitchen on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "group.motion_kitchen",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 870,
        "y": 740,
        "wires": [
            [],
            [
                "f2a30d99.6ab35"
            ]
        ]
    },
    {
        "id": "869d42ee.5696d",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "name": "Motion Kitchen Sonoff On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.motion_kitchen_rf",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 150,
        "y": 720,
        "wires": [
            [],
            [
                "ecf6c354.ddb0d"
            ]
        ]
    },
    {
        "id": "6b45e957.41dc88",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Mirror light on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "light.mirror_light",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 1160,
        "y": 120,
        "wires": [
            [],
            [
                "48891c2b.1b7f64"
            ]
        ]
    },
    {
        "id": "fb698203.dfc1d",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Illuminance Hallway < 10",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "10",
        "halt_if_type": "num",
        "halt_if_compare": "lt",
        "entity_id": "sensor.0x00158d000449923f_illuminance",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 510,
        "y": 60,
        "wires": [
            [
                "76f10358.db5f5c"
            ],
            []
        ]
    },
    {
        "id": "6d669cca.c84704",
        "type": "trigger",
        "z": "78f69306.4a472c",
        "name": "",
        "op1": "",
        "op2": "",
        "op1type": "nul",
        "op2type": "payl",
        "duration": "5",
        "extend": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "outputs": 1,
        "x": 620,
        "y": 440,
        "wires": [
            [
                "df3fafb8.a7c0d"
            ]
        ]
    },
    {
        "id": "800bc84b.ee4408",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Lock Door Hallway open? ",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "binary_sensor.0x00158d00044b7364_contact",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 930,
        "y": 120,
        "wires": [
            [],
            [
                "6b45e957.41dc88",
                "b76b43dd.13aeb"
            ]
        ]
    },
    {
        "id": "ecf6c354.ddb0d",
        "type": "trigger",
        "z": "78f69306.4a472c",
        "name": "",
        "op1": "",
        "op2": "",
        "op1type": "nul",
        "op2type": "payl",
        "duration": "5",
        "extend": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "outputs": 1,
        "x": 420,
        "y": 740,
        "wires": [
            [
                "9ad0f1d9.5a171"
            ]
        ]
    },
    {
        "id": "c3f56a28.5f0b78",
        "type": "ha-wait-until",
        "z": "78f69306.4a472c",
        "name": "Hallway moition on",
        "server": "b3e9b226.7fd0c",
        "version": 0,
        "outputs": 2,
        "entityId": "group.motion_hallway",
        "entityIdFilterType": "exact",
        "property": "state",
        "comparator": "is",
        "value": "on",
        "valueType": "str",
        "timeout": "2",
        "timeoutType": "num",
        "timeoutUnits": "minutes",
        "entityLocation": "",
        "entityLocationType": "none",
        "checkCurrentState": true,
        "blockInputOverrides": true,
        "x": 770,
        "y": 280,
        "wires": [
            [
                "b44ed431.15bcc8"
            ],
            []
        ]
    },
    {
        "id": "82b83014.035c9",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "name": "Kitchen Button SINGLE",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d00027a69b1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "single",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 140,
        "y": 780,
        "wires": [
            [
                "7c544936.34a848"
            ],
            []
        ]
    },
    {
        "id": "aa594e34.91127",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "name": "Kitchen Button DOUBLE",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "sensor.0x00158d00027a69b1_click",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "double",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "0",
        "forType": "num",
        "forUnits": "minutes",
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 150,
        "y": 840,
        "wires": [
            [
                "36fe2c47.ff5254"
            ],
            []
        ]
    },
    {
        "id": "b76b43dd.13aeb",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Door Light on",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "light",
        "service": "turn_on",
        "entityId": "light.14815066d8f15ba39842",
        "data": "{\"brightness\":\"30\",\"rgb_color\":[255,225,124]}",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 940,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "ec923acc.8b0918",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Door Light off",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "light",
        "service": "turn_off",
        "entityId": "light.14815066d8f15ba39842",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 460,
        "y": 380,
        "wires": [
            []
        ]
    },
    {
        "id": "4671dc4f.4c73a4",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Movietime on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.movie_time",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 700,
        "y": 580,
        "wires": [
            [],
            [
                "36fe2c47.ff5254"
            ]
        ]
    },
    {
        "id": "ffab78d2.81ae28",
        "type": "api-current-state",
        "z": "78f69306.4a472c",
        "name": "Movietime on?",
        "server": "b3e9b226.7fd0c",
        "version": 2,
        "outputs": 2,
        "halt_if": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "entity_id": "switch.movie_time",
        "state_type": "str",
        "blockInputOverrides": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "entity"
            }
        ],
        "x": 920,
        "y": 660,
        "wires": [
            [
                "239e56ad.9ae93a"
            ],
            [
                "7c544936.34a848"
            ]
        ]
    },
    {
        "id": "239e56ad.9ae93a",
        "type": "api-call-service",
        "z": "78f69306.4a472c",
        "name": "Kitchen Decor Light On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "debugenabled": false,
        "service_domain": "switch",
        "service": "turn_on",
        "entityId": "switch.0xcc86ecfffebb3e28_l1",
        "data": "",
        "dataType": "json",
        "mergecontext": "",
        "mustacheAltTags": false,
        "outputProperties": [],
        "queue": "none",
        "x": 1190,
        "y": 620,
        "wires": [
            []
        ]
    },
    {
        "id": "8fd058ca.3fc608",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "d": true,
        "name": "Motion Sensor Kitchen 2 On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.0x00158d00049ba740_occupancy",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 160,
        "y": 520,
        "wires": [
            [
                "8356e4fc.82d2f8",
                "ad4e8b92.523938"
            ],
            []
        ]
    },
    {
        "id": "15721f3a.3a5331",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "name": "Motion Sensor Hallway Door On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.0x00158d0006791d0d_occupancy",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 170,
        "y": 200,
        "wires": [
            [
                "145e54a5.05f88b"
            ],
            []
        ]
    },
    {
        "id": "465d7119.63d75",
        "type": "server-state-changed",
        "z": "78f69306.4a472c",
        "d": true,
        "name": "Motion Sensor Kitchen On",
        "server": "b3e9b226.7fd0c",
        "version": 3,
        "exposeToHomeAssistant": false,
        "haConfig": [
            {
                "property": "name",
                "value": ""
            },
            {
                "property": "icon",
                "value": ""
            }
        ],
        "entityidfilter": "binary_sensor.0x00158d000449b6ca_occupancy",
        "entityidfiltertype": "exact",
        "outputinitially": false,
        "state_type": "str",
        "haltifstate": "on",
        "halt_if_type": "str",
        "halt_if_compare": "is",
        "outputs": 2,
        "output_only_on_state_change": true,
        "for": "",
        "forType": "num",
        "forUnits": "minutes",
        "ignorePrevStateNull": false,
        "ignorePrevStateUnknown": false,
        "ignorePrevStateUnavailable": false,
        "ignoreCurrentStateUnknown": false,
        "ignoreCurrentStateUnavailable": false,
        "outputProperties": [
            {
                "property": "payload",
                "propertyType": "msg",
                "value": "",
                "valueType": "entityState"
            },
            {
                "property": "data",
                "propertyType": "msg",
                "value": "",
                "valueType": "eventData"
            },
            {
                "property": "topic",
                "propertyType": "msg",
                "value": "",
                "valueType": "triggerId"
            }
        ],
        "x": 150,
        "y": 600,
        "wires": [
            [
                "ad4e8b92.523938",
                "8356e4fc.82d2f8"
            ],
            []
        ]
    },
    {
        "id": "145e54a5.05f88b",
        "type": "change",
        "z": "78f69306.4a472c",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "headers",
                "pt": "msg",
                "to": "Content-Type: application/json",
                "tot": "str"
            },
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "{\"wake\": true, \"wakeTime\": 60}",
                "tot": "json"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 400,
        "y": 200,
        "wires": [
            [
                "aa0f7e57.666cd"
            ]
        ]
    },
    {
        "id": "aa0f7e57.666cd",
        "type": "www-request",
        "z": "78f69306.4a472c",
        "name": "",
        "method": "POST",
        "ret": "obj",
        "url": "http://192.168.0.71:2971/api/command",
        "follow-redirects": false,
        "persistent-http": false,
        "tls": "",
        "x": 590,
        "y": 200,
        "wires": [
            []
        ]
    }
]

Podsumowanie

Jak widzicie, tek kod się rozrastał w zależności od naszych potrzeb. Na początku było coś, potem coś i tak powstał ten chaos który teraz widzicie. Tutaj właśnie swoją potęgę pokazuje Node-RED i procesy życia, dopiero jak mieszkamy, możemy naprawdę zrobić zaczarowane rzeczy, które będą działać automatycznie. I o to w tym wszystkich chodzi, bo przecież z jakie innego powodu czytalibyście ten artykuł ;)

Jestem mega ciekaw Waszych najbardziej dzikich automatyzacji w domu, zależnych od jak największej liczby czynników, pochwalcie się nimi w komentarzach! 

Chcesz wiedzieć więcej? Dołącz do grupy na FB. Będzie nam też miło jak polubisz Fanpage!

Projektor Xiaomi Mijia Youth SJL4014GL Global

Od: 2104 zł 2562 zł | Powiadom gdy cena spadnie

Świetny projektor all in one. Ciekawa alternatywa z tvboxem, wifi, bluetooth, stereo dolby atmos wieloma opcjami dodatkowymi. Ważne, przyjemność z oglądania będziemy mieli przy maksymalnie zaciemnionym pomieszczeniu! 

Dziwi brak reklam? Przeczytaj dlaczego i wesprzyj bloga na  lub