Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Antworten
OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 16.02.2018, 09:05

Это общая тема по Node-RED для сбора опытов пользователей и поиска решений.

Node-RED это визуальная среда программирования, в которой можно реализовать различные сценарии и правила автоматизации в графическом виде без написания какого-либо кода.

здесь общие материалы
Хорошая статья по node-red https://geektimes.ru/post/279814/
Офф. библиотека node-red https://flows.nodered.org/
об интерфейсе Node-Red http://wikihandbk.com/wiki/Raspberry_Pi ... 1_Node-RED
публикация по взаимодействию Nod-Red и xiaomi напрямую https://kuznik.livejournal.com/1429.html

здесь примеры
Spoiler: Show hidden text
Включение/выключение от геркона калитки уличного света после заката. Калиток несколько, свет выключается по таймеру. http://forum.iobroker.net/viewtopic.php ... 51#p125169
Zuletzt geändert von OlegJktu am 10.03.2018, 21:56, insgesamt 2-mal geändert.

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 16.02.2018, 09:10

Включение/выключение от геркона калитки уличного света после заката.
Калиток несколько, свет выключается по таймеру.
Нода рассвета импортирована
Оборудование герконы xiaomi и aqara проводной выключатель
Screenshot_20180215_183042.png
код для импорта
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "baa1fd17.7e498",
        "type": "sunrise",
        "z": "85a64329.4b4868",
        "name": "Sunrise",
        "lat": "",
        "lon": "51.025",
        "start": "sunrise",
        "end": "sunset",
        "x": 213.88333129882812,
        "y": 686.3333129882812,
        "wires": [
            [
                "21122ee.294b452",
                "9acc79fb.e2428"
            ],
            []
        ]
    },
    {
        "id": "21122ee.294b452",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "debug sunrise",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 243.88333129882812,
        "y": 642.6666259765625,
        "wires": []
    },
    {
        "id": "bb8b62dc.6e039",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "this flow on outdoor ligt after sunset when gate is open and off light after 5 min",
        "info": "",
        "x": 752.9833679199219,
        "y": 29,
        "wires": []
    },
    {
        "id": "4fca973e.3c251",
        "type": "ioBroker in",
        "z": "85a64329.4b4868",
        "name": "GATE_magnet_158d00018761d4.state is opened",
        "topic": "mihome.0.devices.magnet_158d00018761d4.state",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 311.88336181640625,
        "y": 256.8666687011719,
        "wires": [
            [
                "776668e.1105998",
                "71a75b15.3706f4"
            ]
        ]
    },
    {
        "id": "776668e.1105998",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "magnet_158d00018761d4.state",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 251.88339233398438,
        "y": 223.23333740234375,
        "wires": []
    },
    {
        "id": "1550a55c.7851bb",
        "type": "ioBroker in",
        "z": "85a64329.4b4868",
        "name": " workshop_magnet_158d00019f3001.state Is opened",
        "topic": "mihome.0.devices.magnet_158d00019f3001.state",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 331.8833312988281,
        "y": 349.8666687011719,
        "wires": [
            [
                "56201f03.9ea298",
                "71a75b15.3706f4"
            ]
        ]
    },
    {
        "id": "56201f03.9ea298",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "magnet_158d00019f3001.state",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 268.8832702636719,
        "y": 316.23333740234375,
        "wires": []
    },
    {
        "id": "71a75b15.3706f4",
        "type": "switch",
        "z": "85a64329.4b4868",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 686.7666320800781,
        "y": 262.8833312988281,
        "wires": [
            [
                "53ecee2e.2398c8"
            ]
        ]
    },
    {
        "id": "997d0d6f.ca65f",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 211.76669311523438,
        "y": 552.88330078125,
        "wires": [
            [
                "9acc79fb.e2428"
            ]
        ]
    },
    {
        "id": "b1a9087e.cb206",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 211.76669311523438,
        "y": 592.88330078125,
        "wires": [
            [
                "9acc79fb.e2428"
            ]
        ]
    },
    {
        "id": "3e0de5ee.0bfb12",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 258.7666931152344,
        "y": 139.13330078125,
        "wires": [
            [
                "71a75b15.3706f4"
            ]
        ]
    },
    {
        "id": "cf8bd889.cad118",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 258.7666931152344,
        "y": 175.13330078125,
        "wires": [
            [
                "71a75b15.3706f4"
            ]
        ]
    },
    {
        "id": "9acc79fb.e2428",
        "type": "switch",
        "z": "85a64329.4b4868",
        "name": "Light Threshold Selector",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "outputs": 2,
        "x": 489.7666320800781,
        "y": 685.1333618164062,
        "wires": [
            [
                "768924ab.192bcc",
                "b7a4a04d.c88a9"
            ],
            [
                "f082e4a.388b698",
                "e66874d7.3af6e"
            ]
        ]
    },
    {
        "id": "f082e4a.388b698",
        "type": "change",
        "z": "85a64329.4b4868",
        "name": "Enable Light",
        "rules": [
            {
                "t": "set",
                "p": "Light_enabled",
                "pt": "flow",
                "to": "Yes",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 707.4332885742188,
        "y": 712.4166870117188,
        "wires": [
            []
        ]
    },
    {
        "id": "768924ab.192bcc",
        "type": "change",
        "z": "85a64329.4b4868",
        "name": "Disable Light",
        "rules": [
            {
                "t": "set",
                "p": "Light_enabled",
                "pt": "flow",
                "to": "No",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 715.0999145507812,
        "y": 654.933349609375,
        "wires": [
            []
        ]
    },
    {
        "id": "53ecee2e.2398c8",
        "type": "switch",
        "z": "85a64329.4b4868",
        "name": "Light Enabled?",
        "property": "Light_enabled",
        "propertyType": "flow",
        "rules": [
            {
                "t": "eq",
                "v": "Yes",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 888.7665710449219,
        "y": 265.1333312988281,
        "wires": [
            [
                "6627bb64.af4574",
                "3c9b49d4.2207b6",
                "d69ccd87.4c3a58"
            ]
        ]
    },
    {
        "id": "e66874d7.3af6e",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "Enable Light",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 479.9833679199219,
        "y": 728.4832763671875,
        "wires": []
    },
    {
        "id": "b7a4a04d.c88a9",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "Disable Light",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 481.9833679199219,
        "y": 638.4832763671875,
        "wires": []
    },
    {
        "id": "6627bb64.af4574",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "Light_enabled",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 891.9832763671875,
        "y": 211.48333740234375,
        "wires": []
    },
    {
        "id": "d69ccd87.4c3a58",
        "type": "trigger",
        "z": "85a64329.4b4868",
        "op1": "",
        "op2": "0",
        "op1type": "nul",
        "op2type": "num",
        "duration": "5",
        "extend": true,
        "units": "min",
        "reset": "",
        "name": "Switch off delay",
        "x": 1119.7666320800781,
        "y": 432.1333312988281,
        "wires": [
            [
                "bea3c898.817f28",
                "b1f418f5.d04728",
                "91d18cbe.93646"
            ]
        ]
    },
    {
        "id": "3c9b49d4.2207b6",
        "type": "change",
        "z": "85a64329.4b4868",
        "name": "turn light on",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "1",
                "tot": "num"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1131.7666625976562,
        "y": 267.1333312988281,
        "wires": [
            [
                "29449ff1.9b69c",
                "b1f418f5.d04728",
                "91d18cbe.93646"
            ]
        ]
    },
    {
        "id": "29449ff1.9b69c",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "turn light on",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 1137.9833374023438,
        "y": 174.48333740234375,
        "wires": []
    },
    {
        "id": "b1f418f5.d04728",
        "type": "ioBroker out",
        "z": "85a64329.4b4868",
        "name": "Outdoor Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_0",
        "ack": "false",
        "autoCreate": "false",
        "x": 1475.9833374023438,
        "y": 262.1166687011719,
        "wires": []
    },
    {
        "id": "91d18cbe.93646",
        "type": "ioBroker out",
        "z": "85a64329.4b4868",
        "name": "Outdoor Wall switch 1",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_1",
        "ack": "false",
        "autoCreate": "false",
        "x": 1473.9833374023438,
        "y": 215.11666870117188,
        "wires": []
    },
    {
        "id": "6adcc643.3d6868",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 1138.7666625976562,
        "y": 71.13333129882812,
        "wires": [
            [
                "b1f418f5.d04728",
                "91d18cbe.93646"
            ]
        ]
    },
    {
        "id": "37c34bfe.9ef6c4",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 1141.7666625976562,
        "y": 112.13333129882812,
        "wires": [
            [
                "91d18cbe.93646",
                "b1f418f5.d04728"
            ]
        ]
    },
    {
        "id": "ecde291d.85ec38",
        "type": "inject",
        "z": "85a64329.4b4868",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 944.7666320800781,
        "y": 476.13336181640625,
        "wires": [
            [
                "d69ccd87.4c3a58"
            ]
        ]
    },
    {
        "id": "bea3c898.817f28",
        "type": "debug",
        "z": "85a64329.4b4868",
        "name": "Switch off delay",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 1132.9833068847656,
        "y": 476.48333740234375,
        "wires": []
    },
    {
        "id": "c79b8e6f.97929",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "todo: добавить проверку если свет включен вручную",
        "info": "",
        "x": 233.98336791992188,
        "y": 26.416671752929688,
        "wires": []
    },
    {
        "id": "addb06e3.2317b8",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "use only open state",
        "info": "",
        "x": 683.9833068847656,
        "y": 227.41665649414062,
        "wires": []
    },
    {
        "id": "ad0906e7.0ecfc",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "Light Enable? logic \t",
        "info": "",
        "x": 518.9833679199219,
        "y": 583.4166259765625,
        "wires": []
    },
    {
        "id": "eee07832.758b7",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "transform true to number 1",
        "info": "",
        "x": 1149.9833374023438,
        "y": 298.4166564941406,
        "wires": []
    },
    {
        "id": "babce20c.3c7838",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "timer auto off",
        "info": "",
        "x": 1113.0999755859375,
        "y": 398.4166564941406,
        "wires": []
    },
    {
        "id": "30ce3361.293e44",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "instruction http://forums.opto22.com/t/sun-rise-set-inside-outside-light-control/1206",
        "info": "",
        "x": 437.8833312988281,
        "y": 807.88330078125,
        "wires": []
    },
    {
        "id": "a7cdf129.a3e248",
        "type": "comment",
        "z": "85a64329.4b4868",
        "name": "The  sunrise node provide two outputs. The first output emits a msg.payload of 1 or 0 every minute depending if day-time (1) or night-time (0).",
        "info": "",
        "x": 617.8833312988281,
        "y": 770.5499877929688,
        "wires": []
    }
]

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Правило автоматизации на Nod-red при открытии геркона зажигается определенным цветом шлюз xiaomi , потом по таймеру выкл

Beitrag von OlegJktu » 19.02.2018, 17:24

Скрипт автоматизации на Nod-red
при открытии геркона зажигается определенным цветом шлюз xiaomi , потом по таймеру выключается

В блоках
Spoiler: Show hidden text
[img]
Screenshot_20180219_162343.png
[/img]
Код для импорта
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "456cb82a.fd7948",
        "type": "ioBroker in",
        "z": "a66658c7.550b58",
        "name": " workshop_magnet_158d00019f3001.state Is opened",
        "topic": "mihome.0.devices.magnet_158d00019f3001.state",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 260,
        "y": 300,
        "wires": [
            [
                "af011381.eb9f",
                "8bd93765.129008"
            ]
        ]
    },
    {
        "id": "af011381.eb9f",
        "type": "debug",
        "z": "a66658c7.550b58",
        "name": "magnet_158d00019f3001.state",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 190,
        "y": 260,
        "wires": []
    },
    {
        "id": "fd83b635.f38138",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 130,
        "y": 360,
        "wires": [
            [
                "8bd93765.129008"
            ]
        ]
    },
    {
        "id": "8e12fb37.497708",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 130,
        "y": 396,
        "wires": [
            [
                "8bd93765.129008"
            ]
        ]
    },
    {
        "id": "8ce5e25d.17d4",
        "type": "ioBroker out",
        "z": "a66658c7.550b58",
        "name": "RGB",
        "topic": "mihome.0.devices.gateway_34ce008acd8e.rgb",
        "ack": "false",
        "autoCreate": "false",
        "x": 1430,
        "y": 280,
        "wires": []
    },
    {
        "id": "68772b5c.25b88c",
        "type": "ioBroker out",
        "z": "a66658c7.550b58",
        "name": "Switch Light",
        "topic": "mihome.0.devices.gateway_34ce008acd8e.on",
        "ack": "false",
        "autoCreate": "false",
        "x": 1450,
        "y": 360,
        "wires": []
    },
    {
        "id": "b64768f6.d049d8",
        "type": "ioBroker out",
        "z": "a66658c7.550b58",
        "name": "Dimmer Light",
        "topic": "mihome.0.devices.gateway_34ce008acd8e.dimmer",
        "ack": "false",
        "autoCreate": "false",
        "x": 1460,
        "y": 440,
        "wires": []
    },
    {
        "id": "18bd5339.0386f5",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "xiaomi gate light",
        "info": "",
        "x": 1460,
        "y": 240,
        "wires": []
    },
    {
        "id": "1de3d955.71503f",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 790,
        "y": 740,
        "wires": [
            [
                "68772b5c.25b88c"
            ]
        ]
    },
    {
        "id": "3f5b4c40.1bc1fc",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 790,
        "y": 820,
        "wires": [
            [
                "68772b5c.25b88c"
            ]
        ]
    },
    {
        "id": "b40c358a.1fb2d",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "10",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 950,
        "y": 740,
        "wires": [
            [
                "b64768f6.d049d8"
            ]
        ]
    },
    {
        "id": "10b5b883.56783f",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "100",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 950,
        "y": 820,
        "wires": [
            [
                "b64768f6.d049d8"
            ]
        ]
    },
    {
        "id": "bdf673f6.71fba8",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "3b5998",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 1130,
        "y": 840,
        "wires": [
            [
                "8ce5e25d.17d4"
            ]
        ]
    },
    {
        "id": "4099cfb6.c7903",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "blue",
        "info": "",
        "x": 1130,
        "y": 800,
        "wires": []
    },
    {
        "id": "88d99b3.b59b568",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "rose light",
        "info": "",
        "x": 1140,
        "y": 620,
        "wires": []
    },
    {
        "id": "c79c8b4a.0d3018",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "ff052b",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 1130,
        "y": 660,
        "wires": [
            [
                "8ce5e25d.17d4"
            ]
        ]
    },
    {
        "id": "74b535ca.f6f42c",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "25525500",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 1140,
        "y": 740,
        "wires": [
            [
                "8ce5e25d.17d4"
            ]
        ]
    },
    {
        "id": "bc34c3f.1f533c",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "yellow",
        "info": "",
        "x": 1130,
        "y": 700,
        "wires": []
    },
    {
        "id": "f7c7a1e3.715438",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "use rgb code for colore",
        "info": "",
        "x": 1180,
        "y": 580,
        "wires": []
    },
    {
        "id": "964fed94.f8d07",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "0168107",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 1140,
        "y": 920,
        "wires": [
            [
                "8ce5e25d.17d4"
            ]
        ]
    },
    {
        "id": "4fea5244.f7857c",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "green (jade)",
        "info": "",
        "x": 1150,
        "y": 880,
        "wires": []
    },
    {
        "id": "ff5974a4.ad7fa",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "off light",
        "info": "",
        "x": 770,
        "y": 780,
        "wires": []
    },
    {
        "id": "de1be05a.f80a78",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "on light",
        "info": "",
        "x": 770,
        "y": 700,
        "wires": []
    },
    {
        "id": "11bcb3e9.21585c",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "dimmer 10%",
        "info": "",
        "x": 950,
        "y": 700,
        "wires": []
    },
    {
        "id": "2ca7693d.efac0e",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "dimmer 100%",
        "info": "",
        "x": 950,
        "y": 780,
        "wires": []
    },
    {
        "id": "8bd93765.129008",
        "type": "switch",
        "z": "a66658c7.550b58",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 670,
        "y": 340,
        "wires": [
            [
                "13edfbbe.d9906c",
                "cd3f8ab7.0eca08"
            ]
        ]
    },
    {
        "id": "cd3f8ab7.0eca08",
        "type": "trigger",
        "z": "a66658c7.550b58",
        "op1": "",
        "op2": "0",
        "op1type": "nul",
        "op2type": "num",
        "duration": "5",
        "extend": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "Switch off delay",
        "x": 970,
        "y": 440,
        "wires": [
            [
                "289711e6.f11e5e",
                "68772b5c.25b88c"
            ]
        ]
    },
    {
        "id": "13edfbbe.d9906c",
        "type": "change",
        "z": "a66658c7.550b58",
        "name": "turn on light=rose",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "ff052b",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 300,
        "wires": [
            [
                "b0f9ddc5.20bec8",
                "8ce5e25d.17d4"
            ]
        ]
    },
    {
        "id": "b0f9ddc5.20bec8",
        "type": "debug",
        "z": "a66658c7.550b58",
        "name": "light сolour",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 950,
        "y": 260,
        "wires": []
    },
    {
        "id": "be57342b.3db75",
        "type": "inject",
        "z": "a66658c7.550b58",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 950,
        "y": 480,
        "wires": [
            [
                "cd3f8ab7.0eca08"
            ]
        ]
    },
    {
        "id": "289711e6.f11e5e",
        "type": "debug",
        "z": "a66658c7.550b58",
        "name": "Switch off delay colour",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 990,
        "y": 400,
        "wires": []
    },
    {
        "id": "42bbf4a.ddb650c",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "use only open state",
        "info": "",
        "x": 667.2166748046875,
        "y": 304.5333251953125,
        "wires": []
    },
    {
        "id": "ec572092.e9152",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "transform true to a/z = rgb light",
        "info": "",
        "x": 1010,
        "y": 220,
        "wires": []
    },
    {
        "id": "c41b84e3.0d613",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "xiaomi magnet",
        "info": "",
        "x": 140,
        "y": 220,
        "wires": []
    },
    {
        "id": "2da7ae59.6e0652",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "todo добавить проверку на яркость",
        "info": "",
        "x": 200,
        "y": 80,
        "wires": []
    },
    {
        "id": "b34db716.47b03",
        "type": "comment",
        "z": "a66658c7.550b58",
        "name": "зажигает определенным цветом шлюз xiaomi при открытии геркона, потом по таймеру выключает",
        "info": "",
        "x": 800,
        "y": 40,
        "wires": []
    }
]

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 01.03.2018, 13:43

и тут через пол года обнаружилось, что все таки нужно кормить исполнителям в iobroker boolean true или false . Так что буду все свои 1 и 0 переписывать.
Spoiler: Show hidden text
Screenshot_20180301_144122.png

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 22.03.2018, 07:29

усложненная версия включение света после рассвета/заката от геркона
добавлена кнопка для ручнных действий
изменено включение на boolean правда/ложь
кубик рассвет/закат нужно установить
Spoiler: Show hidden text
[img]
Screenshot_20180322_082024.png
Screenshot_20180322_082024.png (102.44 KiB) 465 mal betrachtet
[/img]
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "6ac9c974.384968",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "instruction http://forums.opto22.com/t/sun-rise-set-inside-outside-light-control/1206",
        "info": "",
        "x": 1880,
        "y": 340,
        "wires": []
    },
    {
        "id": "626a2b09.b47c3c",
        "type": "sunrise",
        "z": "cb46759f.f0546",
        "name": "Sunrise",
        "lat": "34.745",
        "lon": "33.202",
        "start": "sunrise",
        "end": "sunset",
        "x": 1698.9999694824219,
        "y": 197.33331298828125,
        "wires": [
            [
                "a957fffa.db7b98"
            ],
            []
        ]
    },
    {
        "id": "5afbe96b.88fd28",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "The  sunrise node provide two outputs. The first output emits a msg.payload of 1 or 0 every minute depending if day-time (1) or night-time (0).",
        "info": "",
        "x": 2060,
        "y": 302.66668701171875,
        "wires": []
    },
    {
        "id": "478e60b1.e34a2",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "on outdoor ligt after sunset when gate is open and off light after 5 min",
        "info": "",
        "x": 678.1000061035156,
        "y": 20,
        "wires": []
    },
    {
        "id": "36ac190e.c8dfd6",
        "type": "ioBroker in",
        "z": "cb46759f.f0546",
        "name": "GATE_magnet_158d00018761d4.state is opened",
        "topic": "mihome.0.devices.magnet_158d00018761d4.state",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 257,
        "y": 247.86666870117188,
        "wires": [
            [
                "34ca1746.53007",
                "b0640f61.3d05e8"
            ]
        ]
    },
    {
        "id": "34ca1746.53007",
        "type": "debug",
        "z": "cb46759f.f0546",
        "name": "magnet_158d00018761d4.state",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 197.00003051757812,
        "y": 214.23333740234375,
        "wires": []
    },
    {
        "id": "3e9889a3.95a206",
        "type": "ioBroker in",
        "z": "cb46759f.f0546",
        "name": " workshop_magnet_158d00019f3001.state Is opened",
        "topic": "mihome.0.devices.magnet_158d00019f3001.state",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 276.9999694824219,
        "y": 340.8666687011719,
        "wires": [
            [
                "34f0e658.cd3cca",
                "b0640f61.3d05e8"
            ]
        ]
    },
    {
        "id": "34f0e658.cd3cca",
        "type": "debug",
        "z": "cb46759f.f0546",
        "name": "magnet_158d00019f3001.state",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 213.99990844726562,
        "y": 307.23333740234375,
        "wires": []
    },
    {
        "id": "b0640f61.3d05e8",
        "type": "switch",
        "z": "cb46759f.f0546",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 671.8833312988281,
        "y": 256.8833312988281,
        "wires": [
            [
                "9a9335d.fada8c8"
            ]
        ]
    },
    {
        "id": "85144b0f.ed3c38",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "1",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 1696.8833312988281,
        "y": 63.88330078125,
        "wires": [
            [
                "a957fffa.db7b98"
            ]
        ]
    },
    {
        "id": "191ee8fd.faa00f",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "0",
        "payloadType": "num",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 1696.8833312988281,
        "y": 103.88330078125,
        "wires": [
            [
                "a957fffa.db7b98"
            ]
        ]
    },
    {
        "id": "affc8f7f.a95b9",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 203.88333129882812,
        "y": 130.13330078125,
        "wires": [
            [
                "b0640f61.3d05e8"
            ]
        ]
    },
    {
        "id": "998219b6.9fe0d",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 203.88333129882812,
        "y": 166.13330078125,
        "wires": [
            [
                "b0640f61.3d05e8"
            ]
        ]
    },
    {
        "id": "a957fffa.db7b98",
        "type": "switch",
        "z": "cb46759f.f0546",
        "name": "Light Threshold Selector",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "1",
                "vt": "num"
            },
            {
                "t": "eq",
                "v": "0",
                "vt": "num"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1974.8832702636719,
        "y": 196.13336181640625,
        "wires": [
            [
                "462070c5.411e08",
                "870a9285.9b6d88"
            ],
            [
                "eec13355.379898",
                "abf36251.890f4"
            ]
        ]
    },
    {
        "id": "eec13355.379898",
        "type": "change",
        "z": "cb46759f.f0546",
        "name": "Enable Light",
        "rules": [
            {
                "t": "set",
                "p": "Light_enabled",
                "pt": "flow",
                "to": "Yes",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2192.5499267578125,
        "y": 223.41668701171875,
        "wires": [
            []
        ]
    },
    {
        "id": "462070c5.411e08",
        "type": "change",
        "z": "cb46759f.f0546",
        "name": "Disable Light",
        "rules": [
            {
                "t": "set",
                "p": "Light_enabled",
                "pt": "flow",
                "to": "No",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 2200.216552734375,
        "y": 165.933349609375,
        "wires": [
            []
        ]
    },
    {
        "id": "9a9335d.fada8c8",
        "type": "switch",
        "z": "cb46759f.f0546",
        "name": "Light Enabled?",
        "property": "Light_enabled",
        "propertyType": "flow",
        "rules": [
            {
                "t": "eq",
                "v": "Yes",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 873.8832702636719,
        "y": 259.1333312988281,
        "wires": [
            [
                "fac6bbcc.150b48",
                "a68bffb3.949ff"
            ]
        ]
    },
    {
        "id": "abf36251.890f4",
        "type": "debug",
        "z": "cb46759f.f0546",
        "name": "Enable Light",
        "active": true,
        "console": "false",
        "complete": "payload",
        "x": 1965.1000061035156,
        "y": 239.4832763671875,
        "wires": []
    },
    {
        "id": "870a9285.9b6d88",
        "type": "debug",
        "z": "cb46759f.f0546",
        "name": "Disable Light",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 1967.1000061035156,
        "y": 149.4832763671875,
        "wires": []
    },
    {
        "id": "a68bffb3.949ff",
        "type": "trigger",
        "z": "cb46759f.f0546",
        "op1": "",
        "op2": "false",
        "op1type": "nul",
        "op2type": "bool",
        "duration": "5",
        "extend": true,
        "units": "min",
        "reset": "",
        "bytopic": "all",
        "name": "Switch off delay",
        "x": 877.88330078125,
        "y": 362.1333312988281,
        "wires": [
            [
                "93ad5800.9f6eb",
                "c72be595.1351b8"
            ]
        ]
    },
    {
        "id": "fac6bbcc.150b48",
        "type": "change",
        "z": "cb46759f.f0546",
        "name": "turn light on",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1076.88330078125,
        "y": 258.1333312988281,
        "wires": [
            [
                "93ad5800.9f6eb",
                "c72be595.1351b8"
            ]
        ]
    },
    {
        "id": "93ad5800.9f6eb",
        "type": "ioBroker out",
        "z": "cb46759f.f0546",
        "name": "Outdoor Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_0",
        "ack": "false",
        "autoCreate": "false",
        "x": 1421.0999755859375,
        "y": 253.11666870117188,
        "wires": []
    },
    {
        "id": "c72be595.1351b8",
        "type": "ioBroker out",
        "z": "cb46759f.f0546",
        "name": "Outdoor Wall switch 1",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_1",
        "ack": "false",
        "autoCreate": "false",
        "x": 1419.0999755859375,
        "y": 206.11666870117188,
        "wires": []
    },
    {
        "id": "da2930d3.54392",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "x": 650,
        "y": 380,
        "wires": [
            [
                "a68bffb3.949ff"
            ]
        ]
    },
    {
        "id": "a730a086.c9536",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "добавить проверку если свет включен вручную",
        "info": "",
        "x": 223.10000610351562,
        "y": 22.416671752929688,
        "wires": []
    },
    {
        "id": "50fea2fa.cfdeec",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "use only open state",
        "info": "",
        "x": 669.1000061035156,
        "y": 221.41665649414062,
        "wires": []
    },
    {
        "id": "54440158.f3c1d",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "Light Enable? logic \t",
        "info": "",
        "x": 2004.1000061035156,
        "y": 94.4166259765625,
        "wires": []
    },
    {
        "id": "13855cce.d47e0b",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "transform true to boolean true",
        "info": "",
        "x": 1105.0999755859375,
        "y": 289.4166564941406,
        "wires": []
    },
    {
        "id": "5c28d209.d7908c",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 1110,
        "y": 60,
        "wires": [
            [
                "93ad5800.9f6eb",
                "c72be595.1351b8"
            ]
        ]
    },
    {
        "id": "e89a076b.9e796",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "bool",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 1110,
        "y": 100,
        "wires": [
            [
                "93ad5800.9f6eb",
                "c72be595.1351b8"
            ]
        ]
    },
    {
        "id": "7d5e3d7f.77248c",
        "type": "switch",
        "z": "cb46759f.f0546",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 620,
        "y": 660,
        "wires": [
            [
                "fcec6a63.c39b8",
                "a68bffb3.949ff"
            ]
        ]
    },
    {
        "id": "fcec6a63.c39b8",
        "type": "change",
        "z": "cb46759f.f0546",
        "name": "turn light on",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 990,
        "y": 660,
        "wires": [
            [
                "c72be595.1351b8",
                "93ad5800.9f6eb"
            ]
        ]
    },
    {
        "id": "dcebfe1a.b17568",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "use only open state",
        "info": "",
        "x": 610,
        "y": 620,
        "wires": []
    },
    {
        "id": "dcd691d1.b462d8",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "transform true to boolean true",
        "info": "",
        "x": 1018.2166748046875,
        "y": 691.2833251953125,
        "wires": []
    },
    {
        "id": "e86a0bf3.8f1088",
        "type": "ioBroker in",
        "z": "cb46759f.f0546",
        "name": "Simple click",
        "topic": "mihome.0.devices.switch_158d00018b3ec2.click",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 150,
        "y": 600,
        "wires": [
            [
                "7d5e3d7f.77248c"
            ]
        ]
    },
    {
        "id": "4ae7bdc8.0ee354",
        "type": "ioBroker in",
        "z": "cb46759f.f0546",
        "name": "Long click",
        "topic": "mihome.0.devices.switch_158d00018b3ec2.long",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 140,
        "y": 660,
        "wires": [
            [
                "7d5e3d7f.77248c"
            ]
        ]
    },
    {
        "id": "6d7dfc8f.675164",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "Button in workshop",
        "info": "",
        "x": 150,
        "y": 540,
        "wires": []
    },
    {
        "id": "17500624.77184a",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 150,
        "y": 740,
        "wires": [
            [
                "7d5e3d7f.77248c"
            ]
        ]
    },
    {
        "id": "70b2aa44.66bb44",
        "type": "inject",
        "z": "cb46759f.f0546",
        "name": "",
        "topic": "",
        "payload": "false",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": "",
        "x": 150,
        "y": 776,
        "wires": [
            [
                "7d5e3d7f.77248c"
            ]
        ]
    },
    {
        "id": "2e6fc6e2.5a7f0a",
        "type": "ioBroker in",
        "z": "cb46759f.f0546",
        "name": "Double click",
        "topic": "mihome.0.devices.switch_158d00018b3ec2.double",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 150,
        "y": 980,
        "wires": [
            [
                "5c44adfc.2874e4"
            ]
        ]
    },
    {
        "id": "fe5ed37e.c754b",
        "type": "change",
        "z": "cb46759f.f0546",
        "name": "turn light off",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 550,
        "y": 980,
        "wires": [
            [
                "bc8e2b43.fe6888",
                "1c209343.871e7d"
            ]
        ]
    },
    {
        "id": "5c44adfc.2874e4",
        "type": "switch",
        "z": "cb46759f.f0546",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "outputs": 1,
        "x": 360,
        "y": 980,
        "wires": [
            [
                "fe5ed37e.c754b"
            ]
        ]
    },
    {
        "id": "1c209343.871e7d",
        "type": "ioBroker out",
        "z": "cb46759f.f0546",
        "name": "Outdoor Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_0",
        "ack": "false",
        "autoCreate": "false",
        "x": 820,
        "y": 1000,
        "wires": []
    },
    {
        "id": "bc8e2b43.fe6888",
        "type": "ioBroker out",
        "z": "cb46759f.f0546",
        "name": "Outdoor Wall switch 1",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_1",
        "ack": "false",
        "autoCreate": "false",
        "x": 818,
        "y": 953,
        "wires": []
    },
    {
        "id": "80cea61f.bcd498",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "transform true to boolean false",
        "info": "",
        "x": 540,
        "y": 1020,
        "wires": []
    },
    {
        "id": "225e21ac.8c67f6",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "Turb on light when Simple Click and auto off (5 min)",
        "info": "",
        "x": 240,
        "y": 500,
        "wires": []
    },
    {
        "id": "91d6e72d.497cb8",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "Turn off light when Double Click xiaomi button",
        "info": "",
        "x": 190,
        "y": 940,
        "wires": []
    },
    {
        "id": "3c7a4a19.08b98e",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "I",
        "info": "",
        "x": 50,
        "y": 100,
        "wires": []
    },
    {
        "id": "e9affc54.6d159",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "II",
        "info": "",
        "x": 50,
        "y": 460,
        "wires": []
    },
    {
        "id": "8f32f343.3396b",
        "type": "comment",
        "z": "cb46759f.f0546",
        "name": "III",
        "info": "",
        "x": 50,
        "y": 900,
        "wires": []
    }
]

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 22.03.2018, 07:41

супер простой пример отправки в телеграмм показаний температуры
буквально в 2 клика
в ежедневном использовании не удобен, но демонстрирует легкость использования всей связки
можно на основании примера сделать с сенсором движения и таймером или включением от кнопки - примитивная сигнализация.
Spoiler: Show hidden text
Выделение_003.png
Выделение_003.png (18.88 KiB) 465 mal betrachtet
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "2489f4e.baaaf8c",
        "type": "ioBroker out",
        "z": "574f3b3e.d4abf4",
        "name": "Send text through telegram",
        "topic": "telegram.0.communicate.response",
        "ack": "false",
        "autoCreate": "false",
        "x": 500,
        "y": 160,
        "wires": []
    },
    {
        "id": "418735a7.2f9ed4",
        "type": "ioBroker in",
        "z": "574f3b3e.d4abf4",
        "name": "Temperature",
        "topic": "mihome.0.devices.sensor_ht_158d0001a2ac8c.temperature",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 90,
        "y": 160,
        "wires": [
            [
                "2489f4e.baaaf8c"
            ]
        ]
    },
    {
        "id": "729c5909.13793",
        "type": "comment",
        "z": "574f3b3e.d4abf4",
        "name": "простой пример отправки показаний температуры через telegram",
        "info": "",
        "x": 390,
        "y": 40,
        "wires": []
    },
    {
        "id": "3346ce5e.bfc1ba",
        "type": "comment",
        "z": "574f3b3e.d4abf4",
        "name": "температура датчик xiaomi",
        "info": "",
        "x": 140,
        "y": 120,
        "wires": []
    },
    {
        "id": "3fea008e.59c6e8",
        "type": "comment",
        "z": "574f3b3e.d4abf4",
        "name": "отправка в телеграм через драйвер ioBroker",
        "info": "",
        "x": 560,
        "y": 120,
        "wires": []
    },
    {
        "id": "215495b9.63d532",
        "type": "comment",
        "z": "574f3b3e.d4abf4",
        "name": "при изменении выдает новое значение",
        "info": "",
        "x": 180,
        "y": 200,
        "wires": []
    }
]

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 29.04.2018, 13:07

Управление поливом с помощью Megad
Пример включения и выключения с кнопки
Участвуют, кнопка, датчик тока, тупой насос, клапан полива
Spoiler: Show hidden text
nod-red megad полив.png
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "46789dc2.3c2a44",
        "type": "comment",
        "z": "e3989afe.8977f",
        "name": "megad-328 управляет насосом и клапанами",
        "info": "",
        "x": 260,
        "y": 80,
        "wires": []
    },
    {
        "id": "33a9bbce.29e0dc",
        "type": "comment",
        "z": "e3989afe.8977f",
        "name": "Улица, полив",
        "info": "",
        "x": 150,
        "y": 40,
        "wires": []
    },
    {
        "id": "e0633c01.d000a8",
        "type": "comment",
        "z": "e3989afe.8977f",
        "name": "https://github.com/ioBroker/ioBroker.megad",
        "info": "",
        "x": 630,
        "y": 80,
        "wires": []
    },
    {
        "id": "941defa2.7bc51",
        "type": "ioBroker in",
        "z": "e3989afe.8977f",
        "name": "P0 Кнопка Полива",
        "topic": "megad.0.p0_P0_Кнопка_Полива",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 170,
        "y": 240,
        "wires": [
            [
                "2e48bd16.1c6af2"
            ]
        ]
    },
    {
        "id": "2e48bd16.1c6af2",
        "type": "switch",
        "z": "e3989afe.8977f",
        "name": "используем только  true",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 390,
        "y": 240,
        "wires": [
            [
                "93cc0e23.b69f1"
            ]
        ]
    },
    {
        "id": "93cc0e23.b69f1",
        "type": "trigger",
        "z": "e3989afe.8977f",
        "op1": "",
        "op2": "true",
        "op1type": "nul",
        "op2type": "str",
        "duration": "1",
        "extend": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "защита от дребезга",
        "x": 620,
        "y": 240,
        "wires": [
            [
                "99201819.1550f",
                "c42febb8.9dc128"
            ]
        ]
    },
    {
        "id": "4368c932.80665",
        "type": "comment",
        "z": "e3989afe.8977f",
        "name": "Насос без реле давления, открываем поливочный клапан на 1 секунду раньше запуска насоса, избегаем гидроудара",
        "info": "",
        "x": 510,
        "y": 120,
        "wires": []
    },
    {
        "id": "c068cdcb.9d73c",
        "type": "ioBroker out",
        "z": "e3989afe.8977f",
        "name": "P13 насос",
        "topic": "megad.0.p13_P13_насос",
        "ack": "false",
        "autoCreate": "false",
        "x": 1330,
        "y": 160,
        "wires": []
    },
    {
        "id": "6f3f49ef.868208",
        "type": "ioBroker out",
        "z": "e3989afe.8977f",
        "name": "P7 клапан полива",
        "topic": "megad.0.p7_P7_клапан_полива",
        "ack": "false",
        "autoCreate": "false",
        "x": 1350,
        "y": 100,
        "wires": []
    },
    {
        "id": "5b4256ee.883bb",
        "type": "trigger",
        "z": "e3989afe.8977f",
        "op1": "",
        "op2": "true",
        "op1type": "nul",
        "op2type": "bool",
        "duration": "1",
        "extend": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "задержка запуска насоса",
        "x": 1120,
        "y": 160,
        "wires": [
            [
                "c068cdcb.9d73c",
                "70f70af7.c5fdc4"
            ]
        ]
    },
    {
        "id": "fcae5628.9128b8",
        "type": "ioBroker out",
        "z": "e3989afe.8977f",
        "name": "P13 насос",
        "topic": "megad.0.p13_P13_насос",
        "ack": "false",
        "autoCreate": "false",
        "x": 1330,
        "y": 320,
        "wires": []
    },
    {
        "id": "44b8be25.efad08",
        "type": "ioBroker out",
        "z": "e3989afe.8977f",
        "name": "P7 клапан полива",
        "topic": "megad.0.p7_P7_клапан_полива",
        "ack": "false",
        "autoCreate": "false",
        "x": 1350,
        "y": 380,
        "wires": []
    },
    {
        "id": "1d8ba8ac.e64b5f",
        "type": "trigger",
        "z": "e3989afe.8977f",
        "op1": "",
        "op2": "false",
        "op1type": "nul",
        "op2type": "bool",
        "duration": "1",
        "extend": true,
        "units": "s",
        "reset": "",
        "bytopic": "all",
        "name": "задержка закрытия клапана",
        "x": 1090,
        "y": 320,
        "wires": [
            [
                "44b8be25.efad08",
                "25803339.499cf4"
            ]
        ]
    },
    {
        "id": "1524a368.575175",
        "type": "switch",
        "z": "e3989afe.8977f",
        "name": "WATER_PUMP_STATUS",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "true",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "false",
                "vt": "str"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 2,
        "x": 500,
        "y": 480,
        "wires": [
            [
                "a40b4c82.f71cc8"
            ],
            [
                "824b2a03.fe3e6"
            ]
        ]
    },
    {
        "id": "a40b4c82.f71cc8",
        "type": "change",
        "z": "e3989afe.8977f",
        "name": "PUMP on",
        "rules": [
            {
                "t": "set",
                "p": "WATER_PUMP_STATUS",
                "pt": "flow",
                "to": "true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 720,
        "y": 440,
        "wires": [
            []
        ]
    },
    {
        "id": "824b2a03.fe3e6",
        "type": "change",
        "z": "e3989afe.8977f",
        "name": "PUMP off",
        "rules": [
            {
                "t": "set",
                "p": "WATER_PUMP_STATUS",
                "pt": "flow",
                "to": "false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 730,
        "y": 520,
        "wires": [
            []
        ]
    },
    {
        "id": "99201819.1550f",
        "type": "switch",
        "z": "e3989afe.8977f",
        "name": "Насос включен?",
        "property": "WATER_PUMP_STATUS",
        "propertyType": "flow",
        "rules": [
            {
                "t": "eq",
                "v": "false",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 830,
        "y": 240,
        "wires": [
            [
                "250c5e6f.ba05d2",
                "684b7ac1.b2f894"
            ],
            [
                "f6b74775.1674b",
                "18627b04.646b2d"
            ]
        ]
    },
    {
        "id": "65e49bf.8ed3064",
        "type": "comment",
        "z": "e3989afe.8977f",
        "name": "кнопка насоса передает кратко временное нажатие. Логика нажали кнопку - нужно совершить дейтствие. Включить или выключиь воду",
        "info": "",
        "x": 750,
        "y": 40,
        "wires": []
    },
    {
        "id": "c42febb8.9dc128",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "P0 Кнопка Полива",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 560,
        "y": 320,
        "wires": []
    },
    {
        "id": "c520ce3f.6653",
        "type": "inject",
        "z": "e3989afe.8977f",
        "name": "Эмуляция нажатия кнопки",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 160,
        "y": 320,
        "wires": [
            [
                "2e48bd16.1c6af2"
            ]
        ]
    },
    {
        "id": "250c5e6f.ba05d2",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "включаем воду",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 850,
        "y": 200,
        "wires": []
    },
    {
        "id": "f6b74775.1674b",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "выключаем воду",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 850,
        "y": 280,
        "wires": []
    },
    {
        "id": "f73c67af.2318f",
        "type": "ioBroker in",
        "z": "e3989afe.8977f",
        "name": "P6 Датчик тока на насосе",
        "topic": "megad.0.p6_P6_Датчик_тока_на_насосе",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 200,
        "y": 480,
        "wires": [
            [
                "9732da94.a91608",
                "1524a368.575175"
            ]
        ]
    },
    {
        "id": "9732da94.a91608",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "P6 Датчик тока на насосе",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 210,
        "y": 440,
        "wires": []
    },
    {
        "id": "d974ed91.798988",
        "type": "inject",
        "z": "e3989afe.8977f",
        "name": "Эмуляция насос работает",
        "topic": "",
        "payload": "true",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 200,
        "y": 580,
        "wires": [
            [
                "1524a368.575175",
                "9732da94.a91608"
            ]
        ]
    },
    {
        "id": "3aff6ba2.f636bc",
        "type": "inject",
        "z": "e3989afe.8977f",
        "name": "Эмуляция насос выключен",
        "topic": "",
        "payload": "false",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 200,
        "y": 620,
        "wires": [
            [
                "1524a368.575175",
                "9732da94.a91608"
            ]
        ]
    },
    {
        "id": "70f70af7.c5fdc4",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "Включаем насос",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 1570,
        "y": 160,
        "wires": []
    },
    {
        "id": "aa7d5953.99fb9",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "Открываем клапан",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 1580,
        "y": 100,
        "wires": []
    },
    {
        "id": "cc4e41d1.9599b8",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "Выключаем насос",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 1580,
        "y": 320,
        "wires": []
    },
    {
        "id": "25803339.499cf4",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "закрываем клапан",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 1580,
        "y": 380,
        "wires": []
    },
    {
        "id": "684b7ac1.b2f894",
        "type": "change",
        "z": "e3989afe.8977f",
        "name": "включаеи воду",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1080,
        "y": 220,
        "wires": [
            [
                "5b4256ee.883bb",
                "6f3f49ef.868208",
                "aa7d5953.99fb9"
            ]
        ]
    },
    {
        "id": "18627b04.646b2d",
        "type": "change",
        "z": "e3989afe.8977f",
        "name": "выключаем воду",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1090,
        "y": 260,
        "wires": [
            [
                "1d8ba8ac.e64b5f",
                "fcae5628.9128b8",
                "cc4e41d1.9599b8"
            ]
        ]
    },
    {
        "id": "283b136.f00c86c",
        "type": "ioBroker in",
        "z": "e3989afe.8977f",
        "name": "P13 насос",
        "topic": "megad.0.p13_P13_насос",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 580,
        "y": 640,
        "wires": [
            [
                "1b2112ce.90a1f5"
            ]
        ]
    },
    {
        "id": "1b2112ce.90a1f5",
        "type": "debug",
        "z": "e3989afe.8977f",
        "name": "реле насос данные из ioBroker  (megad не отдает включение реле, сервер должен помнить сам или переодически опрашивать)",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 1150,
        "y": 640,
        "wires": []
    }
]
Zuletzt geändert von OlegJktu am 02.05.2018, 07:27, insgesamt 1-mal geändert.

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 29.04.2018, 19:35

Управление выключателем xiaomi с реле с помощью кнопки xiaomi
однократное - включаем первую нагрузку
двойное - включаем вторую нагрузку
длинное - выключаем все
Spoiler: Show hidden text
Screenshot_20180429_212811.png
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "69a9ed68.238a84",
        "type": "ioBroker in",
        "z": "4ee7097b.356f",
        "name": "Simple click",
        "topic": "mihome.0.devices.switch_158d0001a2dd26.click",
        "payloadType": "value",
        "onlyack": false,
        "func": "all",
        "gap": "",
        "x": 190,
        "y": 300,
        "wires": [
            [
                "36bc6c90.9c9324",
                "745d4961.1a05"
            ]
        ]
    },
    {
        "id": "467664dc.4dbb14",
        "type": "ioBroker in",
        "z": "4ee7097b.356f",
        "name": "Double click",
        "topic": "mihome.0.devices.switch_158d0001a2dd26.double",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 190,
        "y": 460,
        "wires": [
            [
                "ac75359e.a18658",
                "379acba1.aa162c"
            ]
        ]
    },
    {
        "id": "7f082a3.20eb054",
        "type": "ioBroker in",
        "z": "4ee7097b.356f",
        "name": "Long click",
        "topic": "mihome.0.devices.switch_158d0001a2dd26.long",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 180,
        "y": 640,
        "wires": [
            [
                "e02a9e6.202296",
                "509fcc41.fa17f4"
            ]
        ]
    },
    {
        "id": "3095b95f.a9e6c6",
        "type": "comment",
        "z": "4ee7097b.356f",
        "name": "Xiaomi button",
        "info": "",
        "x": 190,
        "y": 160,
        "wires": []
    },
    {
        "id": "36bc6c90.9c9324",
        "type": "debug",
        "z": "4ee7097b.356f",
        "name": "Simple click",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 190,
        "y": 260,
        "wires": []
    },
    {
        "id": "ac75359e.a18658",
        "type": "debug",
        "z": "4ee7097b.356f",
        "name": "Double click",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 190,
        "y": 420,
        "wires": []
    },
    {
        "id": "e02a9e6.202296",
        "type": "debug",
        "z": "4ee7097b.356f",
        "name": "Long click",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 180,
        "y": 600,
        "wires": []
    },
    {
        "id": "509fcc41.fa17f4",
        "type": "switch",
        "z": "4ee7097b.356f",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 440,
        "y": 640,
        "wires": [
            [
                "3dad983e.35515"
            ]
        ]
    },
    {
        "id": "3dad983e.35515",
        "type": "change",
        "z": "4ee7097b.356f",
        "name": "turn off light ",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 684.9999694824219,
        "y": 641.25,
        "wires": [
            [
                "4c4c1867.8ee4e8",
                "d6794d95.06d58",
                "4bd2fa2c.3a68dc"
            ]
        ]
    },
    {
        "id": "4c4c1867.8ee4e8",
        "type": "debug",
        "z": "4ee7097b.356f",
        "name": "выключаем все",
        "active": false,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 710,
        "y": 600,
        "wires": []
    },
    {
        "id": "31141ed2.4e3ffa",
        "type": "comment",
        "z": "4ee7097b.356f",
        "name": "use only true",
        "info": "",
        "x": 430,
        "y": 600,
        "wires": []
    },
    {
        "id": "11f80759.28aeb1",
        "type": "comment",
        "z": "4ee7097b.356f",
        "name": "transform string true to boolean false",
        "info": "",
        "x": 700,
        "y": 680,
        "wires": []
    },
    {
        "id": "379acba1.aa162c",
        "type": "switch",
        "z": "4ee7097b.356f",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 440,
        "y": 460,
        "wires": [
            [
                "8ec236c2.32943"
            ]
        ]
    },
    {
        "id": "7b52b34d.b9df4c",
        "type": "comment",
        "z": "4ee7097b.356f",
        "name": "use only true",
        "info": "",
        "x": 430,
        "y": 420,
        "wires": []
    },
    {
        "id": "745d4961.1a05",
        "type": "switch",
        "z": "4ee7097b.356f",
        "name": "only true can go ",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 440,
        "y": 300,
        "wires": [
            [
                "92164e8f.1ec86"
            ]
        ]
    },
    {
        "id": "522d7bad.c43f34",
        "type": "comment",
        "z": "4ee7097b.356f",
        "name": "use only true",
        "info": "",
        "x": 430,
        "y": 260,
        "wires": []
    },
    {
        "id": "8ec236c2.32943",
        "type": "change",
        "z": "4ee7097b.356f",
        "name": "turn light on",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 460,
        "wires": [
            [
                "7ea19fca.814e2",
                "717cb955.c6f5f"
            ]
        ]
    },
    {
        "id": "92164e8f.1ec86",
        "type": "change",
        "z": "4ee7097b.356f",
        "name": "turn light on",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 670,
        "y": 300,
        "wires": [
            [
                "71059890.74a9e",
                "b0b19ebb.e07358"
            ]
        ]
    },
    {
        "id": "7ea19fca.814e2",
        "type": "ioBroker out",
        "z": "4ee7097b.356f",
        "name": "Outdoor Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_0",
        "ack": "false",
        "autoCreate": "false",
        "x": 1000,
        "y": 460,
        "wires": []
    },
    {
        "id": "71059890.74a9e",
        "type": "ioBroker out",
        "z": "4ee7097b.356f",
        "name": "Outdoor Wall switch 1",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_1",
        "ack": "false",
        "autoCreate": "false",
        "x": 998,
        "y": 293,
        "wires": []
    },
    {
        "id": "d6794d95.06d58",
        "type": "ioBroker out",
        "z": "4ee7097b.356f",
        "name": "Outdoor Wall switch 0",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_0",
        "ack": "false",
        "autoCreate": "false",
        "x": 1000,
        "y": 620,
        "wires": []
    },
    {
        "id": "4bd2fa2c.3a68dc",
        "type": "ioBroker out",
        "z": "4ee7097b.356f",
        "name": "Outdoor Wall switch 1",
        "topic": "mihome.0.devices.ctrl_neutral2_158d00014a81c0.channel_1",
        "ack": "false",
        "autoCreate": "false",
        "x": 998,
        "y": 573,
        "wires": []
    },
    {
        "id": "e4ef99e8.9f5c6",
        "type": "comment",
        "z": "4ee7097b.356f",
        "name": "реле xiaomi",
        "info": "",
        "x": 1010,
        "y": 220,
        "wires": []
    },
    {
        "id": "717cb955.c6f5f",
        "type": "debug",
        "z": "4ee7097b.356f",
        "name": "зажигаем по двойному",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 710,
        "y": 400,
        "wires": []
    },
    {
        "id": "b0b19ebb.e07358",
        "type": "debug",
        "z": "4ee7097b.356f",
        "name": "зажигаем по одиночному",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 720,
        "y": 240,
        "wires": []
    }
]

Sergey777
starter
Beiträge: 18
Registriert: 27.01.2018, 22:00

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von Sergey777 » 01.05.2018, 08:21

Кто поможет реализовать переключение в Node-RED? Нужно чтоб один раз пришел сигнал - реле включилось. Проверка статуса, если второй раз сигнал пришёл, то состояние реле переключилось из true в false. (Сигнал от кнопки - "true").
В JS скриптах в Blockly есть такой готовый функционал, но мне интересно знать как это сделать в Node-RED.
Пааамааагитеее!

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 02.05.2018, 07:33

Sergey777 hat geschrieben:
01.05.2018, 08:21
Кто поможет реализовать переключение в Node-RED? Нужно чтоб один раз пришел сигнал - реле включилось. Проверка статуса, если второй раз сигнал пришёл, то состояние реле переключилось из true в false. (Сигнал от кнопки - "true").
...

Вот в этом примере Управление поливом с помощью Megad viewtopic.php?f=48&t=11969&p=146339#p146339

Включается и выключается реле с одинакового триггера (события? какой термин лучше?).
Там конечно в связи с железной реализацией статус берется с датчика тока, но можно и статус реле брать из ioBroker.

По сути вы заводите поток, который работает как стрелка у поезда и переводит логику на разные ветки. В примере две ветки завязаны на статус датчика тока. А кнопка одна и сигнал с нее всегда используется один.
Хотя на практике при управлении скажем групповыми объектами это просто физически не удобно. Лучше использовать разные триггеры.

Sergey777
starter
Beiträge: 18
Registriert: 27.01.2018, 22:00

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von Sergey777 » 02.05.2018, 19:41

Управление устройством Sonoff POW с прошивкой Sonoff-Tasmota 5.12.0 by Theo Arends с помощью кнопки Xiaomi Smart Wireless Switch способом переключателя: оно нажатие - включение, повторное одиночное нажатие - выключение в Node-RED.
Switch_Sonoff-Tasmota.PNG
Spoiler: Show hidden text

Code: Alles auswählen

[
    {
        "id": "3d24ecec.e06e74",
        "type": "ioBroker in",
        "z": "592d1520.8a0b7c",
        "name": "Sonoff_POW_2",
        "topic": "sonoff.0.Sonoff_POW_2_A02EBD.POWER",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 100,
        "y": 100,
        "wires": [
            [
                "27d901f5.d4750e"
            ]
        ]
    },
    {
        "id": "6f767919.8e2a08",
        "type": "ioBroker in",
        "z": "592d1520.8a0b7c",
        "name": "Simple click",
        "topic": "mihome.0.devices.switch_158d0001f35894.click",
        "payloadType": "value",
        "onlyack": "",
        "func": "all",
        "gap": "",
        "x": 90,
        "y": 240,
        "wires": [
            [
                "968c2eb2.8acea"
            ]
        ]
    },
    {
        "id": "968c2eb2.8acea",
        "type": "switch",
        "z": "592d1520.8a0b7c",
        "name": "Берём только  true",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 310,
        "y": 240,
        "wires": [
            [
                "8e6a94c5.d104d8"
            ]
        ]
    },
    {
        "id": "8e6a94c5.d104d8",
        "type": "switch",
        "z": "592d1520.8a0b7c",
        "name": "Sonoff включен?",
        "property": "SONOFF_STATUS",
        "propertyType": "flow",
        "rules": [
            {
                "t": "eq",
                "v": "false",
                "vt": "str"
            },
            {
                "t": "eq",
                "v": "true",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 530,
        "y": 240,
        "wires": [
            [
                "c050f5a9.d5b6e8"
            ],
            [
                "ae48a910.728298"
            ]
        ]
    },
    {
        "id": "c050f5a9.d5b6e8",
        "type": "change",
        "z": "592d1520.8a0b7c",
        "name": "Включаем Sonoff",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 200,
        "wires": [
            [
                "1a869456.60fd4c",
                "50071ed6.6539"
            ]
        ]
    },
    {
        "id": "ae48a910.728298",
        "type": "change",
        "z": "592d1520.8a0b7c",
        "name": "Отключаем Sonoff",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 280,
        "wires": [
            [
                "e49adeee.4b67c",
                "4b2f12f9.8b6b0c"
            ]
        ]
    },
    {
        "id": "50071ed6.6539",
        "type": "ioBroker out",
        "z": "592d1520.8a0b7c",
        "name": "Sonoff_POW_2",
        "topic": "sonoff.0.Sonoff_POW_2_A02EBD.POWER",
        "ack": "false",
        "autoCreate": "false",
        "x": 960,
        "y": 200,
        "wires": []
    },
    {
        "id": "4b2f12f9.8b6b0c",
        "type": "ioBroker out",
        "z": "592d1520.8a0b7c",
        "name": "Sonoff_POW_2",
        "topic": "sonoff.0.Sonoff_POW_2_A02EBD.POWER",
        "ack": "false",
        "autoCreate": "false",
        "x": 960,
        "y": 280,
        "wires": []
    },
    {
        "id": "27d901f5.d4750e",
        "type": "switch",
        "z": "592d1520.8a0b7c",
        "name": "Передаём статус Sonoff",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "cont",
                "v": "true",
                "vt": "str"
            },
            {
                "t": "cont",
                "v": "false",
                "vt": "str"
            }
        ],
        "checkall": "false",
        "repair": false,
        "outputs": 2,
        "x": 330,
        "y": 100,
        "wires": [
            [
                "95638670.fa4628"
            ],
            [
                "826333d5.a331d"
            ]
        ]
    },
    {
        "id": "95638670.fa4628",
        "type": "change",
        "z": "592d1520.8a0b7c",
        "name": "Sonoff ON",
        "rules": [
            {
                "t": "set",
                "p": "SONOFF_STATUS",
                "pt": "flow",
                "to": "true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 80,
        "wires": [
            []
        ]
    },
    {
        "id": "826333d5.a331d",
        "type": "change",
        "z": "592d1520.8a0b7c",
        "name": "Sonoff OFF",
        "rules": [
            {
                "t": "set",
                "p": "SONOFF_STATUS",
                "pt": "flow",
                "to": "false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 570,
        "y": 120,
        "wires": [
            []
        ]
    },
    {
        "id": "1a869456.60fd4c",
        "type": "debug",
        "z": "592d1520.8a0b7c",
        "name": "Включаем",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 950,
        "y": 140,
        "wires": []
    },
    {
        "id": "e49adeee.4b67c",
        "type": "debug",
        "z": "592d1520.8a0b7c",
        "name": "Отключаем",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 950,
        "y": 340,
        "wires": []
    },
    {
        "id": "31ce9e04.577692",
        "type": "comment",
        "z": "592d1520.8a0b7c",
        "name": "Тут логика работы",
        "info": "",
        "x": 310,
        "y": 180,
        "wires": []
    },
    {
        "id": "c6fc3258.f4318",
        "type": "comment",
        "z": "592d1520.8a0b7c",
        "name": "Тут определяем состояние реле Sonoff",
        "info": "",
        "x": 330,
        "y": 40,
        "wires": []
    }
]
P.S. Идею подсказал выше OlegJktu, подсмотрено тут: viewtopic.php?f=48&t=11969&p=146339#p146339

OlegJktu
starter
Beiträge: 18
Registriert: 29.10.2017, 06:48

Re: Node-RED примеры, решения и и вопросы. Общая тема по Node-RED

Beitrag von OlegJktu » 06.05.2018, 18:25

1) спасибо, что выложили.
2) 5+ за оформление.

Antworten