NEWS
Node-RED примеры, решения и и вопросы. Общая тема по Node-RED
-
Это общая тема по Node-RED для сбора опытов пользователей и поиска решений.
Допускается писать вопросы и примеры по Node-red не связанные напрямую с IoBroker, а уж как использовать их в строительстве УД мы найдем.
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
upd1 23/08/18: еще интересные материалы по nod-red
https://community.vscale.io/hc/ru/commu ... 1-Debian-8
https://zftlab.org/pages/2017012100.html
https://stefkblog.wordpress.com/node-red-install-steps/
https://tech.scargill.net/a-thermostat-weekend/
русскоязычный канал в телеграмм: https://t.me/node_red
-
upd: обновлено добавлен ручной режим
****Включение/выключение от геркона калитки уличного света после заката.
Калиток несколько, свет выключается по таймеру.
Нода рассвета импортирована
Оборудование герконы xiaomi и aqara проводной выключатель****
!
код для импорта
!
[ { "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": 360, "y": 460, "wires": [] }, { "id": "626a2b09.b47c3c", "type": "sunrise", "z": "cb46759f.f0546", "name": "Sunrise", "lat": "34.745", "lon": "33.202", "start": "sunrise", "end": "sunset", "x": 178.99996948242188, "y": 317.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": 540, "y": 422.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": 290, "y": 40, "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": 270, "y": 740, "wires": [ [ "34ca1746.53007", "b0640f61.3d05e8" ] ] }, { "id": "34ca1746.53007", "type": "debug", "z": "cb46759f.f0546", "name": "геркон ворота", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 160.00003051757812, "y": 706.3666687011719, "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": 289.9999694824219, "y": 833, "wires": [ [ "34f0e658.cd3cca", "b0640f61.3d05e8" ] ] }, { "id": "34f0e658.cd3cca", "type": "debug", "z": "cb46759f.f0546", "name": "геркон мастерская", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 196.99990844726562, "y": 799.3666687011719, "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", "repair": false, "outputs": 1, "x": 393, "y": 672.1333312988281, "wires": [ [ "9a9335d.fada8c8" ] ] }, { "id": "85144b0f.ed3c38", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "1", "payloadType": "num", "repeat": "", "crontab": "", "once": false, "x": 176.88333129882812, "y": 183.88330078125, "wires": [ [ "a957fffa.db7b98" ] ] }, { "id": "191ee8fd.faa00f", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "0", "payloadType": "num", "repeat": "", "crontab": "", "once": false, "x": 176.88333129882812, "y": 223.88330078125, "wires": [ [ "a957fffa.db7b98" ] ] }, { "id": "affc8f7f.a95b9", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 150, "y": 920, "wires": [ [ "b0640f61.3d05e8" ] ] }, { "id": "998219b6.9fe0d", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "false", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 150, "y": 960, "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": 454.8832702636719, "y": 316.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": 672.5499267578125, "y": 343.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": 680.216552734375, "y": 285.933349609375, "wires": [ [] ] }, { "id": "9a9335d.fada8c8", "type": "switch", "z": "cb46759f.f0546", "name": "Нужно включать свет?", "property": "Light_enabled", "propertyType": "flow", "rules": [ { "t": "eq", "v": "Yes", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 643, "y": 752.1333312988281, "wires": [ [ "fac6bbcc.150b48", "a68bffb3.949ff" ] ] }, { "id": "abf36251.890f4", "type": "debug", "z": "cb46759f.f0546", "name": "Enable Light", "active": false, "console": "false", "complete": "payload", "x": 445.1000061035156, "y": 359.4832763671875, "wires": [] }, { "id": "870a9285.9b6d88", "type": "debug", "z": "cb46759f.f0546", "name": "Disable Light", "active": false, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 447.1000061035156, "y": 269.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": "Таймер авто отключения", "x": 853, "y": 932.1333312988281, "wires": [ [ "3dbb8c81.9a35f4" ] ] }, { "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": 883, "y": 752.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": 1434.0999755859375, "y": 745.25, "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": 1432.0999755859375, "y": 698.25, "wires": [] }, { "id": "da2930d3.54392", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 623, "y": 932.1333312988281, "wires": [ [ "a68bffb3.949ff" ] ] }, { "id": "50fea2fa.cfdeec", "type": "comment", "z": "cb46759f.f0546", "name": "используем только сигнал открыто", "info": "", "x": 463, "y": 632.1333312988281, "wires": [] }, { "id": "54440158.f3c1d", "type": "comment", "z": "cb46759f.f0546", "name": "Логика от состояние рассвет/закат запрещает/разрешает авто включение света ", "info": "", "x": 660, "y": 220, "wires": [] }, { "id": "13855cce.d47e0b", "type": "comment", "z": "cb46759f.f0546", "name": "transform true to boolean true", "info": "", "x": 893, "y": 712.1333312988281, "wires": [] }, { "id": "5c28d209.d7908c", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "false", "payloadType": "bool", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 1150, "y": 600, "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": 1150, "y": 640, "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", "repair": false, "outputs": 1, "x": 473, "y": 1212.1333312988281, "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": 763, "y": 1212.1333312988281, "wires": [ [ "9a9335d.fada8c8", "93ad5800.9f6eb", "c72be595.1351b8" ] ] }, { "id": "dcebfe1a.b17568", "type": "comment", "z": "cb46759f.f0546", "name": "используем только сигнал о нажатии", "info": "", "x": 463, "y": 1172.1333312988281, "wires": [] }, { "id": "dcd691d1.b462d8", "type": "comment", "z": "cb46759f.f0546", "name": "превращаем сообщение в boolean true", "info": "", "x": 813, "y": 1172.1333312988281, "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": 143, "y": 1132.1333312988281, "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": 133, "y": 1172.1333312988281, "wires": [ [ "7d5e3d7f.77248c" ] ] }, { "id": "6d7dfc8f.675164", "type": "comment", "z": "cb46759f.f0546", "name": "Кнопка в мастерской", "info": "", "x": 113, "y": 1092.1333312988281, "wires": [] }, { "id": "17500624.77184a", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 123, "y": 1412.1333312988281, "wires": [ [ "7d5e3d7f.77248c" ] ] }, { "id": "70b2aa44.66bb44", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "false", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 123, "y": 1448.1333312988281, "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": 143, "y": 1652.1333312988281, "wires": [ [ "5c44adfc.2874e4" ] ] }, { "id": "fe5ed37e.c754b", "type": "change", "z": "cb46759f.f0546", "name": "выключаем свет", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 563, "y": 1652.1333312988281, "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": 353, "y": 1652.1333312988281, "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": 813, "y": 1672.1333312988281, "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": 811, "y": 1625.1333312988281, "wires": [] }, { "id": "80cea61f.bcd498", "type": "comment", "z": "cb46759f.f0546", "name": "превращаем сообщение в boolean false", "info": "", "x": 493, "y": 1612.1333312988281, "wires": [] }, { "id": "225e21ac.8c67f6", "type": "comment", "z": "cb46759f.f0546", "name": "Turb on light when Simple Click and auto off (5 min)", "info": "", "x": 203, "y": 1052.1333312988281, "wires": [] }, { "id": "91d6e72d.497cb8", "type": "comment", "z": "cb46759f.f0546", "name": "Выключение света по двойному нажатию кнопки Xiaomi", "info": "", "x": 223, "y": 1572.1333312988281, "wires": [] }, { "id": "3c7a4a19.08b98e", "type": "comment", "z": "cb46759f.f0546", "name": "I", "info": "", "x": 63, "y": 592.1333312988281, "wires": [] }, { "id": "e9affc54.6d159", "type": "comment", "z": "cb46759f.f0546", "name": "II", "info": "", "x": 63, "y": 1012.1333312988281, "wires": [] }, { "id": "8f32f343.3396b", "type": "comment", "z": "cb46759f.f0546", "name": "III", "info": "", "x": 63, "y": 1532.1333312988281, "wires": [] }, { "id": "4100d8cb.babfb", "type": "comment", "z": "cb46759f.f0546", "name": "Ручной режим ", "info": "", "x": 100, "y": 1880, "wires": [] }, { "id": "47bb610.eb57c2", "type": "comment", "z": "cb46759f.f0546", "name": "IIII", "info": "", "x": 70, "y": 1840, "wires": [] }, { "id": "1120f943.0573ef", "type": "ioBroker in", "z": "cb46759f.f0546", "name": "Long click", "topic": "mihome.0.devices.switch_158d0001a2dd26.long", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 93, "y": 2032.1333312988281, "wires": [ [ "1b606179.733b1f" ] ] }, { "id": "1b606179.733b1f", "type": "switch", "z": "cb46759f.f0546", "name": "only true can go ", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "true", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 1, "x": 353, "y": 2012.1333312988281, "wires": [ [ "8436e0d5.05c67" ] ] }, { "id": "10feeddd.470caa", "type": "comment", "z": "cb46759f.f0546", "name": "круглые кнопки xiaomi", "info": "", "x": 130, "y": 1940, "wires": [] }, { "id": "533c1650.4f8be", "type": "switch", "z": "cb46759f.f0546", "name": "переключатель ручного режима", "property": "payload", "propertyType": "msg", "rules": [ { "t": "true" }, { "t": "false" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 933, "y": 2012.1333312988281, "wires": [ [ "69f5f8c7.75d05", "19f3f7b3.1c995", "ed41ad9f.adf9d8" ], [ "d5db7112.6cb68", "1f07736a.051ddd" ] ] }, { "id": "d5db7112.6cb68", "type": "debug", "z": "cb46759f.f0546", "name": "выключить ручной режим", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 933, "y": 2052.133331298828, "wires": [] }, { "id": "69f5f8c7.75d05", "type": "debug", "z": "cb46759f.f0546", "name": "включить ручной режим", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 933, "y": 1972.1333312988281, "wires": [] }, { "id": "19f3f7b3.1c995", "type": "change", "z": "cb46759f.f0546", "name": "включить ручной режим", "rules": [ { "t": "set", "p": "manual_mod", "pt": "flow", "to": "Yes", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1243, "y": 1912.1333312988281, "wires": [ [] ] }, { "id": "1f07736a.051ddd", "type": "change", "z": "cb46759f.f0546", "name": "выключить ручной режим", "rules": [ { "t": "set", "p": "manual_mod", "pt": "flow", "to": "No", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1253, "y": 2132.133331298828, "wires": [ [] ] }, { "id": "3dbb8c81.9a35f4", "type": "switch", "z": "cb46759f.f0546", "name": "ручной режим?", "property": "manual_mod", "propertyType": "flow", "rules": [ { "t": "eq", "v": "Yes", "vt": "str" }, { "t": "eq", "v": "No", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 860, "y": 1040, "wires": [ [ "a68bffb3.949ff", "26dd8ba7.a1573c" ], [ "6ea62e98.8ec52", "c72be595.1351b8", "93ad5800.9f6eb" ] ] }, { "id": "79079cb3.a3f0ac", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 123, "y": 2132.133331298828, "wires": [ [ "1b606179.733b1f" ] ] }, { "id": "2a5380d9.685da8", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "false", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": "", "x": 123, "y": 2168.133331298828, "wires": [ [ "1b606179.733b1f", "533c1650.4f8be" ] ] }, { "id": "eb07aef.56605d", "type": "comment", "z": "cb46759f.f0546", "name": "эмулятор кнопок", "info": "", "x": 123, "y": 2092.133331298828, "wires": [] }, { "id": "ed41ad9f.adf9d8", "type": "trigger", "z": "cb46759f.f0546", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "360", "extend": true, "units": "min", "reset": "", "bytopic": "all", "name": "Таймер выключения ручного режима", "x": 1293, "y": 1952.1333312988281, "wires": [ [ "533c1650.4f8be" ] ] }, { "id": "d7948e5b.9ea028", "type": "comment", "z": "cb46759f.f0546", "name": "авто отключение ручного режима по таймеру на 60 минут", "info": "", "x": 490, "y": 1880, "wires": [] }, { "id": "926c0ed6.1d195", "type": "comment", "z": "cb46759f.f0546", "name": "проверяем закат/рассвет", "info": "", "x": 643, "y": 712.1333312988281, "wires": [] }, { "id": "b304da48.b33de", "type": "comment", "z": "cb46759f.f0546", "name": "при включении ручного режима, авто отключение продлевается по логике в п IIII", "info": "", "x": 750, "y": 1000, "wires": [] }, { "id": "cc5dea99.11219", "type": "comment", "z": "cb46759f.f0546", "name": "эмулятор геркона", "info": "", "x": 130, "y": 880, "wires": [] }, { "id": "66481dee.67a94c", "type": "ioBroker in", "z": "cb46759f.f0546", "name": "Simple click", "topic": "mihome.0.devices.switch_158d0001a2dd26.click", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 143, "y": 1292.1333312988281, "wires": [ [ "7d5e3d7f.77248c" ] ] }, { "id": "23f68768.596aa", "type": "comment", "z": "cb46759f.f0546", "name": "Кнопка под навесом", "info": "", "x": 113, "y": 1252.1333312988281, "wires": [] }, { "id": "6ea1b3b6.1103fc", "type": "ioBroker in", "z": "cb46759f.f0546", "name": "Long click", "topic": "mihome.0.devices.switch_158d0001a2dd26.long", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 133, "y": 1332.1333312988281, "wires": [ [ "7d5e3d7f.77248c" ] ] }, { "id": "a44da673.3bc668", "type": "comment", "z": "cb46759f.f0546", "name": "Кнопка в мастерской", "info": "", "x": 113, "y": 1612.1333312988281, "wires": [] }, { "id": "b5ee6421.bc2448", "type": "ioBroker in", "z": "cb46759f.f0546", "name": "Double click", "topic": "mihome.0.devices.switch_158d0001a2dd26.double", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 143, "y": 1732.1333312988281, "wires": [ [ "5c44adfc.2874e4" ] ] }, { "id": "ab1c22b3.4a67f8", "type": "comment", "z": "cb46759f.f0546", "name": "Кнопка под навесом", "info": "", "x": 113, "y": 1692.1333312988281, "wires": [] }, { "id": "8436e0d5.05c67", "type": "change", "z": "cb46759f.f0546", "name": "boolean true", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 603, "y": 2012.1333312988281, "wires": [ [ "533c1650.4f8be" ] ] }, { "id": "ed666b29.847768", "type": "comment", "z": "cb46759f.f0546", "name": "превращаем сообщение в boolean true", "info": "", "x": 613, "y": 1952.1333312988281, "wires": [] }, { "id": "b811f0f2.1b804", "type": "comment", "z": "cb46759f.f0546", "name": "Кнопка под навесом", "info": "", "x": 113, "y": 1992.1333312988281, "wires": [] }, { "id": "26dd8ba7.a1573c", "type": "debug", "z": "cb46759f.f0546", "name": "авто отключение включена задержка - ручной режим", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1330, "y": 1020, "wires": [] }, { "id": "6ea62e98.8ec52", "type": "debug", "z": "cb46759f.f0546", "name": "авто отключение выключен ручной режим", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1300, "y": 1060, "wires": [] }, { "id": "bab055a9.6010f", "type": "comment", "z": "cb46759f.f0546", "name": "0", "info": "", "x": 70, "y": 100, "wires": [] }, { "id": "95e9afe8.7b56a", "type": "comment", "z": "cb46759f.f0546", "name": "Астраномический рассвет/закат нода импотирована", "info": "", "x": 230, "y": 140, "wires": [] }, { "id": "6ee4adce.60b93c", "type": "comment", "z": "cb46759f.f0546", "name": "эмулятор включить/выключить", "info": "", "x": 1210, "y": 560, "wires": [] }, { "id": "dc4f19e8.b36598", "type": "inject", "z": "cb46759f.f0546", "name": "", "topic": "", "payload": "false", "payloadType": "bool", "repeat": "", "crontab": "00 14 * * *", "once": false, "onceDelay": 0.1, "x": 610, "y": 2140, "wires": [ [ "533c1650.4f8be" ] ] }, { "id": "dec4ecfd.e42578", "type": "comment", "z": "cb46759f.f0546", "name": "затычка - вырубает ручной режим 1 раз в сутки", "info": "", "x": 720, "y": 2100, "wires": [] } ] !
-
****Скрипт автоматизации на Nod-red
при открытии геркона зажигается определенным цветом шлюз xiaomi , потом по таймеру выключается****
В блоках
! ![](<ATTACHMENT )~~[attachment=0]~~Screenshot_20180219_162343.png[/attachment]" />
Код для импорта!
[ { "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": [] } ] !
-
и тут через пол года обнаружилось, что все таки нужно кормить исполнителям в iobroker boolean true или false . Так что буду все свои 1 и 0 переписывать.
!
-
усложненная версия включение света после рассвета/заката от геркона
добавлена кнопка для ручнных действий
изменено включение на boolean правда/ложь
кубик рассвет/закат нужно установить
! ![](<ATTACHMENT )~~[attachment=0]~~Screenshot_20180322_082024.png[/attachment]" />
!
[ { "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": [] } ] !
-
супер простой пример отправки в телеграмм показаний температуры
буквально в 2 клика
в ежедневном использовании не удобен, но демонстрирует легкость использования всей связки
можно на основании примера сделать с сенсором движения и таймером или включением от кнопки - примитивная сигнализация.
!
!
[ { "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": [] } ] !
-
UPD добавлен кубик действия при старте Nod-red
****Управление поливом с помощью Megad
Пример включения и выключения с кнопки
Участвуют, кнопка, датчик тока, тупой насос, клапан полива****
!
!
[ { "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": "500", "extend": true, "units": "ms", "reset": "", "bytopic": "all", "name": "защита от дребезга", "x": 620, "y": 240, "wires": [ [ "99201819.1550f", "c42febb8.9dc128" ] ] }, { "id": "4368c932.80665", "type": "comment", "z": "e3989afe.8977f", "name": "Насос без реле давления, открываем поливочный клапан на XX милисекунд раньше запуска насоса, избегаем гидроудара", "info": "", "x": 520, "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": "100", "extend": true, "units": "ms", "reset": "", "bytopic": "all", "name": "задержка запуска насоса", "x": 1070, "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": "100", "extend": true, "units": "ms", "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": 530, "y": 940, "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": 770, "y": 900, "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": 780, "y": 980, "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", "72891ca6.b9dffc" ] ] }, { "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": "d974ed91.798988", "type": "inject", "z": "e3989afe.8977f", "name": "Эмуляция насос работает", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 230, "y": 1060, "wires": [ [ "1524a368.575175", "1b2112ce.90a1f5" ] ] }, { "id": "3aff6ba2.f636bc", "type": "inject", "z": "e3989afe.8977f", "name": "Эмуляция насос выключен", "topic": "", "payload": "false", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 240, "y": 1140, "wires": [ [ "1524a368.575175", "1b2112ce.90a1f5" ] ] }, { "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": 1590, "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": 1600, "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", "1524a368.575175" ] ] }, { "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", "1524a368.575175" ] ] }, { "id": "283b136.f00c86c", "type": "ioBroker in", "z": "e3989afe.8977f", "name": "P13 насос", "topic": "megad.0.p13_P13_насос", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 250, "y": 940, "wires": [ [ "1524a368.575175", "1b2112ce.90a1f5" ] ] }, { "id": "1b2112ce.90a1f5", "type": "debug", "z": "e3989afe.8977f", "name": "реле насос данные из ioBroker (megad не отдает включение реле, сервер должен помнить сам или переодически опрашивать)", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 530, "y": 860, "wires": [] }, { "id": "8e6acc74.ed836", "type": "ioBroker in", "z": "e3989afe.8977f", "name": "P5 кнопка полива мастерская", "topic": "megad.0.p5_P5_кнопка_полива_мастерская", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 140, "y": 640, "wires": [ [ "434ddec4.2e9d08", "72891ca6.b9dffc" ] ] }, { "id": "434ddec4.2e9d08", "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": 400, "y": 640, "wires": [ [ "ff2dd48a.359b" ] ] }, { "id": "ff2dd48a.359b", "type": "trigger", "z": "e3989afe.8977f", "op1": "", "op2": "true", "op1type": "nul", "op2type": "str", "duration": "500", "extend": true, "units": "ms", "reset": "", "bytopic": "all", "name": "защита от дребезга", "x": 630, "y": 640, "wires": [ [ "9e6ee41e.4fc7c", "ead92695.6d3ba8" ] ] }, { "id": "a45eb843.fcd2a8", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P13 насос", "topic": "megad.0.p13_P13_насос", "ack": "false", "autoCreate": "false", "x": 1340, "y": 560, "wires": [] }, { "id": "c1f3ba47.202498", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P12 клапан полива мастерская", "topic": "megad.0.p12_P12_клапан_полива_мастерская", "ack": "false", "autoCreate": "false", "x": 1330, "y": 500, "wires": [] }, { "id": "7dc16d8b.d5b9a4", "type": "trigger", "z": "e3989afe.8977f", "op1": "", "op2": "true", "op1type": "nul", "op2type": "bool", "duration": "100", "extend": true, "units": "ms", "reset": "", "bytopic": "all", "name": "задержка запуска насоса", "x": 1110, "y": 560, "wires": [ [ "a45eb843.fcd2a8", "a9ce58db.426a88" ] ] }, { "id": "a396b099.312fa8", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P13 насос", "topic": "megad.0.p13_P13_насос", "ack": "false", "autoCreate": "false", "x": 1330, "y": 660, "wires": [] }, { "id": "5d8bda1f.3c1a7c", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P12 клапан полива мастерская", "topic": "megad.0.p12_P12_клапан_полива_мастерская", "ack": "false", "autoCreate": "false", "x": 1350, "y": 800, "wires": [] }, { "id": "8d0f2e6.9fe7fd", "type": "trigger", "z": "e3989afe.8977f", "op1": "", "op2": "false", "op1type": "nul", "op2type": "bool", "duration": "100", "extend": true, "units": "ms", "reset": "", "bytopic": "all", "name": "задержка закрытия клапана", "x": 1140, "y": 740, "wires": [ [ "5d8bda1f.3c1a7c", "209db1eb.ae36ae" ] ] }, { "id": "9e6ee41e.4fc7c", "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": 840, "y": 640, "wires": [ [ "a2a67c83.01ef88", "89f1db01.efa7f" ], [ "89263f3d.cc6a9", "716c5edf.9202c" ] ] }, { "id": "ead92695.6d3ba8", "type": "debug", "z": "e3989afe.8977f", "name": "P0 Кнопка Полива", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 590, "y": 680, "wires": [] }, { "id": "5f6aad79.baa58c", "type": "inject", "z": "e3989afe.8977f", "name": "Эмуляция нажатия кнопки", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 170, "y": 720, "wires": [ [ "434ddec4.2e9d08" ] ] }, { "id": "a2a67c83.01ef88", "type": "debug", "z": "e3989afe.8977f", "name": "включаем воду", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 860, "y": 600, "wires": [] }, { "id": "89263f3d.cc6a9", "type": "debug", "z": "e3989afe.8977f", "name": "выключаем воду", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 860, "y": 680, "wires": [] }, { "id": "a9ce58db.426a88", "type": "debug", "z": "e3989afe.8977f", "name": "Включаем насос", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1590, "y": 560, "wires": [] }, { "id": "9682c6c5.106a3", "type": "debug", "z": "e3989afe.8977f", "name": "Открываем клапан мастерская", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1630, "y": 500, "wires": [] }, { "id": "5a77ed72.b16984", "type": "debug", "z": "e3989afe.8977f", "name": "Выключаем насос", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1590, "y": 660, "wires": [] }, { "id": "209db1eb.ae36ae", "type": "debug", "z": "e3989afe.8977f", "name": "закрываем клапан мастерская", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1630, "y": 800, "wires": [] }, { "id": "89f1db01.efa7f", "type": "change", "z": "e3989afe.8977f", "name": "включаеи воду", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "true", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 600, "wires": [ [ "7dc16d8b.d5b9a4", "c1f3ba47.202498", "9682c6c5.106a3", "1524a368.575175" ] ] }, { "id": "716c5edf.9202c", "type": "change", "z": "e3989afe.8977f", "name": "выключаем воду", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "false", "tot": "bool" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 1100, "y": 660, "wires": [ [ "8d0f2e6.9fe7fd", "a396b099.312fa8", "5a77ed72.b16984", "1524a368.575175" ] ] }, { "id": "67020dac.8aa9bc", "type": "comment", "z": "e3989afe.8977f", "name": "полив гараж", "info": "", "x": 610, "y": 180, "wires": [] }, { "id": "f1a07bcf.4b7ea8", "type": "comment", "z": "e3989afe.8977f", "name": "полив мастерская", "info": "", "x": 630, "y": 560, "wires": [] }, { "id": "bdf742bc.c0faf", "type": "inject", "z": "e3989afe.8977f", "name": "", "topic": "", "payload": "false", "payloadType": "bool", "repeat": "", "crontab": "00 06 * * *", "once": false, "onceDelay": 0.1, "x": 290, "y": 1260, "wires": [ [ "9baed0bf.51e3c8", "4a88df3c.90a3f", "6a980aa4.5b3d8c", "2dbfa6ac.06a22a" ] ] }, { "id": "40711fb9.7b1d8", "type": "comment", "z": "e3989afe.8977f", "name": "затычка - вырубает вырубает насос и все выходы насос и все выходы 1 раз в сутки ", "info": "", "x": 440, "y": 1220, "wires": [] }, { "id": "2dbfa6ac.06a22a", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P13 насос", "topic": "megad.0.p13_P13_насос", "ack": "false", "autoCreate": "false", "x": 490, "y": 1380, "wires": [] }, { "id": "4a88df3c.90a3f", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P12 клапан полива мастерская", "topic": "megad.0.p12_P12_клапан_полива_мастерская", "ack": "false", "autoCreate": "false", "x": 550, "y": 1260, "wires": [] }, { "id": "6a980aa4.5b3d8c", "type": "ioBroker out", "z": "e3989afe.8977f", "name": "P7 клапан полива", "topic": "megad.0.p7_P7_клапан_полива", "ack": "false", "autoCreate": "false", "x": 510, "y": 1320, "wires": [] }, { "id": "9baed0bf.51e3c8", "type": "debug", "z": "e3989afe.8977f", "name": "авто выключение в 6 час", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 530, "y": 1440, "wires": [] }, { "id": "72891ca6.b9dffc", "type": "debug", "z": "e3989afe.8977f", "name": "данные с кнопок полива", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 430, "y": 460, "wires": [] }, { "id": "4bf3f9c8.d61c5", "type": "comment", "z": "e3989afe.8977f", "name": "todo water pump status привязать к переменной", "info": "", "x": 270, "y": 160, "wires": [] }, { "id": "5d561bf3.75d1fc", "type": "comment", "z": "e3989afe.8977f", "name": "todo авто выключение если насос включен, а клапана закрыты", "info": "", "x": 320, "y": 200, "wires": [] }, { "id": "e1d353ae.166fa", "type": "config", "z": "e3989afe.8977f", "name": "", "properties": [ { "p": "WATER_PUMP_STATUS", "pt": "flow", "to": "false", "tot": "str" } ], "active": true, "x": 150, "y": 1460, "wires": [] }, { "id": "297260de.80d438", "type": "comment", "z": "e3989afe.8977f", "name": "https://flows.nodered.org/node/node-red-contrib-config", "info": "https://flows.nodered.org/node/node-red-contrib-config", "x": 270, "y": 1500, "wires": [] }, { "id": "b2144cd4.7815c", "type": "comment", "z": "e3989afe.8977f", "name": "WATER_PUMP_STATUS false on start up", "info": "", "x": 240, "y": 1540, "wires": [] } ] !
-
Управление выключателем xiaomi с реле с помощью кнопки xiaomi
однократное - включаем первую нагрузку
двойное - включаем вторую нагрузку
длинное - выключаем все
!
!
[ { "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": [] } ] !
-
Кто поможет реализовать переключение в Node-RED? Нужно чтоб один раз пришел сигнал - реле включилось. Проверка статуса, если второй раз сигнал пришёл, то состояние реле переключилось из true в false. (Сигнал от кнопки - "true").
В JS скриптах в Blockly есть такой готовый функционал, но мне интересно знать как это сделать в Node-RED.
Пааамааагитеее!
-
Кто поможет реализовать переключение в Node-RED? Нужно чтоб один раз пришел сигнал - реле включилось. Проверка статуса, если второй раз сигнал пришёл, то состояние реле переключилось из true в false. (Сигнал от кнопки - "true").
… `
Вот в этом примере Управление поливом с помощью Megad viewtopic.php?f=48&t=11969&p=146339#p146339
Включается и выключается реле с одинакового триггера (события? какой термин лучше?).
Там конечно в связи с железной реализацией статус берется с датчика тока, но можно и статус реле брать из ioBroker.
По сути вы заводите поток, который работает как стрелка у поезда и переводит логику на разные ветки. В примере две ветки завязаны на статус датчика тока. А кнопка одна и сигнал с нее всегда используется один.
Хотя на практике при управлении скажем групповыми объектами это просто физически не удобно. Лучше использовать разные триггеры.
-
Управление устройством https://www.itead.cc/smart-home/sonoff-pow.html с прошивкой https://github.com/arendst/Sonoff-Tasmota с помощью кнопки https://xiaomi-smarthome.ru/xiaomi-smart-wireless-switch/ способом переключателя: оно нажатие - включение, повторное одиночное нажатие - выключение в Node-RED.
! ````
[
{
"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](https://forum.iobroker.net/viewtopic.php?f=48&t=11969&p=146339#p146339)
-
-
спасибо, что выложили.
-
5+ за оформление.
-
-
Пожалуй, приведу ещё примерчик. Вывод даты и времени в нужном формате.
Дата время - это системное время вашего сервера iobroker.
!
[ { "id": "72f2c7dc.bf9298", "type": "function", "z": "ee32e2c4.bc665", "name": "FormatTime", "func": "var now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n//msg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\n//msg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\n//msg.timestamp = hour+'ч'+minute+'м'+second+'c';\nmsg.timestamp = hour+':'+minute+':'+second;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 290, "y": 120, "wires": [ [ "f59066e5.1b1ea8" ] ] }, { "id": "904cda57.320dd8", "type": "inject", "z": "ee32e2c4.bc665", "name": "", "topic": "", "payload": "true", "payloadType": "bool", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 110, "y": 120, "wires": [ [ "72f2c7dc.bf9298" ] ] }, { "id": "f59066e5.1b1ea8", "type": "debug", "z": "ee32e2c4.bc665", "name": "", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "timestamp", "x": 480, "y": 120, "wires": [] } ] !
В блоке function, который я обозвал FormatTime, написан скрипт. В закоментированных строках 23,24,25 примеры вывода.
Если внимательно присмотреться к первому скрину, то видим, что время события в логе и время переданное в сообщении разнится на час. Это потому, что на компьютере в браузере одно время, а в моей Raspberry другой часовой пояс. Устанавливаем корректное время в малине, и снова выводим сообщение:
Теперь всё совпадает.
P.S. Я понимаю, для кого-то это азы, как азбука. Но я новичок, и потратил какое-то время на поиски и доработки этого кода. Думаю не будет лишним для форумчан.
-
Приобрёл я как-то датчики открытия двери Door Sensor Aqara MCCGQ11LM (https://mysku.ru/blog/china-stores/54257.html), установил. Так как мы тут обсуждаем альтернативную систему умного дома, то завёл датчики в NODE-RED iobroker'a. Мне нужно было получать оповещения, когда дверь открывается и закрывается. Отправку этих оповещений я реализовал через WebHook, но Вы можете отправить их куда угодно, например в Telegramm.
! Небольшое отступление:
! У меня есть NAS бренда https://www.synology.com/ru-ru, а для операционной системы https://www.synology.com/ru-ru/dsm/live_demo, которая работает в NAS, есть приложение https://www.synology.com/ru-ru/dsm/feature/chat - это такой чатик, типа WhatsApp или Telegramm, но слегка по проще, поднятый на своём собственном NAS, имеет приложения для Windows, IOS, Android и просто работает через web браузер. Я решил получать оповещения именно в этот чат, так как в семье активно им пользуемся.
! У данного чата есть возможность принимать сообщения WebHook и передавать их определённому пользователю или группе(каналу). Собственно отправку WebHook я и реализовал в NODE-RED. Кроме отправки уведомлений, я отправляю команду камере, камера по этой команде делает серию скринов, которые потом можно просмотреть.
Но вскоре меня ждал сюрприз, о котором нигде я не смог найти информации. Как оказалось Door Sensor постоянно шлёт контрольный сигнал со статусом последнего события. Мои датчики шлют false или true каждые 50 минут 15 сек +/- 10 сек. Если дверь закрыта и состояние false, то каждые 50 минут прилетает false. Если было последнее событие true, то каждые 50 минут присылает true. Таким образом датчик говорит нам, что он тут, он работает, сигнал доходит, всё нормально. Ну раз так, то придётся использовать это во благо. И так, представляю свой алгоритм:
!
[ { "id": "1aeb151d.c59e5b", "type": "debug", "z": "84c517f4.99a9d8", "name": "Door Sensor Status", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1150, "y": 520, "wires": [] }, { "id": "9d4c980c.2ae028", "type": "ioBroker in", "z": "84c517f4.99a9d8", "name": "Дверь: Is opened", "topic": "mihome.0.devices.magnet_158d000204a13f.state", "payloadType": "value", "onlyack": "", "func": "all", "gap": "", "x": 100, "y": 100, "wires": [ [ "ee85c4c6.465928", "cdead55f.15fd68", "8f07a637.ea61d8", "60b595ae.188ecc" ] ] }, { "id": "ee85c4c6.465928", "type": "rbe", "z": "84c517f4.99a9d8", "name": "", "func": "rbe", "gap": "", "start": "", "inout": "out", "property": "payload", "x": 230, "y": 520, "wires": [ [ "bf1f32e6.64566" ] ] }, { "id": "f95f7441.dbefd8", "type": "inject", "z": "84c517f4.99a9d8", "name": "", "topic": "", "payload": "true", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 90, "y": 500, "wires": [ [ "ee85c4c6.465928" ] ] }, { "id": "1fd5e312.859f5d", "type": "inject", "z": "84c517f4.99a9d8", "name": "", "topic": "", "payload": "false", "payloadType": "str", "repeat": "", "crontab": "", "once": false, "onceDelay": 0.1, "x": 90, "y": 540, "wires": [ [ "ee85c4c6.465928" ] ] }, { "id": "c8540540.ae8f58", "type": "debug", "z": "84c517f4.99a9d8", "name": "Alarm!!!", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1180, "y": 140, "wires": [] }, { "id": "cdead55f.15fd68", "type": "trigger", "z": "84c517f4.99a9d8", "op1": "", "op2": "Датчик потерян!!!", "op1type": "nul", "op2type": "str", "duration": "51", "extend": true, "units": "min", "reset": "", "bytopic": "all", "name": "", "x": 310, "y": 160, "wires": [ [ "43366ff3.584b9", "e4dac972.f0da88", "1af60a78.c2b8f6" ] ] }, { "id": "8f07a637.ea61d8", "type": "debug", "z": "84c517f4.99a9d8", "name": "Все статусы двери", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1150, "y": 100, "wires": [] }, { "id": "4af07332.c31ebc", "type": "http request", "z": "84c517f4.99a9d8", "name": "Открыта дверь", "method": "POST", "ret": "txt", "url": "https://mydomen.com/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=mytokenlongmytokenlooong&payload={\"text\": \":negative_squared_cross_mark: Открыта дверь {{{timestamp}}}\"}", "tls": "", "x": 940, "y": 500, "wires": [ [ "1aeb151d.c59e5b" ] ] }, { "id": "e871555e.9092c8", "type": "http request", "z": "84c517f4.99a9d8", "name": "Закрыта дверь", "method": "POST", "ret": "txt", "url": "https://mydomen.com/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=mytokenlongmytokenlooong&payload={\"text\": \":white_check_mark: Закрыта дверь {{{timestamp}}}\"}", "tls": "", "x": 940, "y": 540, "wires": [ [ "1aeb151d.c59e5b" ] ] }, { "id": "d89df571.d12d58", "type": "change", "z": "84c517f4.99a9d8", "name": "Door Opened", "rules": [ { "t": "set", "p": "DOOR_SENSOR_VHOD_STATUS", "pt": "flow", "to": "true", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 580, "y": 500, "wires": [ [ "fc67fce9.c5769", "c0483154.d949" ] ] }, { "id": "9b119486.99ec68", "type": "change", "z": "84c517f4.99a9d8", "name": "Door Closed", "rules": [ { "t": "set", "p": "DOOR_SENSOR_VHOD_STATUS", "pt": "flow", "to": "false", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 590, "y": 540, "wires": [ [ "9adfd17e.42ebe", "c0483154.d949" ] ] }, { "id": "bf1f32e6.64566", "type": "switch", "z": "84c517f4.99a9d8", "name": "Делим состояния", "property": "payload", "propertyType": "msg", "rules": [ { "t": "eq", "v": "true", "vt": "str" }, { "t": "eq", "v": "false", "vt": "str" } ], "checkall": "true", "repair": false, "outputs": 2, "x": 390, "y": 520, "wires": [ [ "d89df571.d12d58" ], [ "9b119486.99ec68" ] ] }, { "id": "8f3fa46.4374758", "type": "http request", "z": "84c517f4.99a9d8", "name": "Тревога!!", "method": "POST", "ret": "txt", "url": "https://mydomen.com/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=mytokenlongmytokenlooong&payload={\"text\": \":warning:\\nДатчик входной двери не отвечает!!!\\nСостояние не будет отображаться.\\nПроверьте датчик!\\n{{{timestamp}}}\\n*****\"}", "tls": "", "x": 960, "y": 140, "wires": [ [ "c8540540.ae8f58" ] ] }, { "id": "43366ff3.584b9", "type": "debug", "z": "84c517f4.99a9d8", "name": "Alarm 1!!!", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1180, "y": 180, "wires": [] }, { "id": "60b595ae.188ecc", "type": "change", "z": "84c517f4.99a9d8", "name": "alarm_reset", "rules": [ { "t": "set", "p": "payload", "pt": "msg", "to": "reset_alarm_message_resend", "tot": "str" } ], "action": "", "property": "", "from": "", "to": "", "reg": false, "x": 350, "y": 400, "wires": [ [ "a140ee35.eb306" ] ] }, { "id": "e4dac972.f0da88", "type": "delay", "z": "84c517f4.99a9d8", "name": "", "pauseType": "delay", "timeout": "2", "timeoutUnits": "hours", "rate": "1", "nbRateUnits": "1", "rateUnits": "second", "randomFirst": "1", "randomLast": "5", "randomUnits": "seconds", "drop": false, "x": 380, "y": 280, "wires": [ [ "a140ee35.eb306" ] ] }, { "id": "a140ee35.eb306", "type": "trigger", "z": "84c517f4.99a9d8", "op1": "", "op2": "Датчик потерян!!!", "op1type": "pay", "op2type": "str", "duration": "-2", "extend": true, "units": "hr", "reset": "reset_alarm_message_resend", "bytopic": "all", "name": "", "x": 570, "y": 280, "wires": [ [ "633cd7fc.a57828" ] ] }, { "id": "c2a947ee.7a9ba8", "type": "debug", "z": "84c517f4.99a9d8", "name": "Повтор сообщения", "active": true, "tosidebar": true, "console": false, "tostatus": false, "complete": "payload", "x": 1140, "y": 280, "wires": [] }, { "id": "93e5590d.d5f328", "type": "comment", "z": "84c517f4.99a9d8", "name": "Если от Door Sensor нет ни одного сообщения в течение 51 минуты, шлём сообщение об аварии", "info": "", "x": 370, "y": 60, "wires": [] }, { "id": "e3926866.fb3ef8", "type": "comment", "z": "84c517f4.99a9d8", "name": "Если после отсылки аварийного сообщения снова нет сообщений от Door Sensor, то повторяем отправку аварийного сообщения через два часа и каждые два часа", "info": "", "x": 560, "y": 240, "wires": [] }, { "id": "74aa47b.7cba4b8", "type": "comment", "z": "84c517f4.99a9d8", "name": "Если какое-либо сообщение от Door Sensor пришло, считаем что всё в порядке и сбрасываем повторную отправку аварийных сообщений", "info": "", "x": 480, "y": 360, "wires": [] }, { "id": "8c3f52d4.a0dd2", "type": "http request", "z": "84c517f4.99a9d8", "name": "Тревога повторно!", "method": "POST", "ret": "txt", "url": "https://mydomen.com/webapi/entry.cgi?api=SYNO.Chat.External&method=incoming&version=2&token=mytokenlongmytokenlooong&payload={\"text\": \":exclamation: :warning: :exclamation:\\nALARM!!!\\nДатчик входной двери не отвечает!!!\\nСостояние не будет отображаться.\\nПроверьте датчик!\\n{{{timestamp}}}\\n*****\"}", "tls": "", "x": 930, "y": 280, "wires": [ [ "c2a947ee.7a9ba8" ] ] }, { "id": "f18c64e0.259e88", "type": "comment", "z": "84c517f4.99a9d8", "name": "При каждом изменении состояния Door Sensor отправляем сообщение ", "info": "", "x": 260, "y": 460, "wires": [] }, { "id": "c0483154.d949", "type": "http request", "z": "84c517f4.99a9d8", "name": "Команда камере", "method": "POST", "ret": "txt", "url": "https://mysurveillancedomen.com/webapi/entry.cgi?api=SYNO.SurveillanceStation.ExternalEvent&method=\"Trigger\"&version=1&eventId=1&eventName=\"This is external event1\"&account=\"root\"&password=\"123456\"", "tls": "", "x": 810, "y": 660, "wires": [ [] ] }, { "id": "1af60a78.c2b8f6", "type": "function", "z": "84c517f4.99a9d8", "name": "FormatTime", "func": "var now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \nmsg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 810, "y": 140, "wires": [ [ "8f3fa46.4374758" ] ] }, { "id": "9adfd17e.42ebe", "type": "function", "z": "84c517f4.99a9d8", "name": "FormatTime", "func": "var now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n//msg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\n//msg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\n//msg.timestamp = hour+'ч'+minute+'м'+second+'c';\nmsg.timestamp = hour+':'+minute+':'+second;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 770, "y": 540, "wires": [ [ "e871555e.9092c8" ] ] }, { "id": "fc67fce9.c5769", "type": "function", "z": "84c517f4.99a9d8", "name": "FormatTime", "func": "var now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \n//msg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\n//msg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\n//msg.timestamp = hour+'ч'+minute+'м'+second+'c';\nmsg.timestamp = hour+':'+minute+':'+second;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 770, "y": 500, "wires": [ [ "4af07332.c31ebc" ] ] }, { "id": "633cd7fc.a57828", "type": "function", "z": "84c517f4.99a9d8", "name": "FormatTime", "func": "var now = new Date(); \nvar year = now.getFullYear();\nvar month = now.getMonth()+1; \nvar day = now.getDate();\nvar hour = now.getHours();\nvar minute = now.getMinutes();\nvar second = now.getSeconds(); \nif(month.toString().length == 1) {\nvar month = '0'+month;\n}\nif(day.toString().length == 1) {\nvar day = '0'+day;\n} \nif(hour.toString().length == 1) {\nvar hour = '0'+hour;\n}\nif(minute.toString().length == 1) {\nvar minute = '0'+minute;\n}\nif(second.toString().length == 1) {\nvar second = '0'+second;\n} \nmsg.timestamp = hour+':'+minute+':'+second+' '+day+'.'+month+'.'+year;\nreturn msg;", "outputs": 1, "noerr": 0, "x": 750, "y": 280, "wires": [ [ "8c3f52d4.a0dd2" ] ] }, { "id": "605ffa0e.d692d4", "type": "comment", "z": "84c517f4.99a9d8", "name": "При открытии\\закрытии двери отправляем камере команду \"делать скриншоты\"", "info": "", "x": 810, "y": 620, "wires": [] } ] !
Как это работает? Так: приходит true или false от датчика открытия двери. Поступает на trigger и на блок rbe. Trigger начинает отсчитывать 51 минуту. Если за это время не поступит ни одного сообщения от датчика - триггер сработает и отправит аварийное сообщение. Блок rbe просто следит за состоянием, если состояние сменилось на противоположное - он передаёт сигнал дальше, если состояние не меняется, например постоянно прилетает false или true - он не реагирует (нужно его так настроить). При изменении состояния сигнал проходит на блок switch, разделяется на два канала, один true, другой false и далее уходит на блок change, на блок function, где привожу дату/время в удобный вид(об этом писал в посту выше) и далее POST запросом отправляется в WebHook.Блок delay делает задержку на 2 часа, а следующий блок resend будет отправлять сообщение об аварии каждые 2 часа, пока от датчика не появится первый сигнал, который через alarm_reset сбросит триггер resend.
! А вот примерно так сообщения выглядят на мобильнике:
Там в примерах, в ссылках WebHook, в полезной нагрузке(сообщении), прописаны коды смайлов. Ну так, чтоб в заблуждение не ввело никого.
Ну как-то так.****<size size="150">________________
Upd</size>.****
1. На текущий момент есть поправки к описанному. Отправка кириллических символов может не работать, тут я написал как переделать: viewtopic.php?f=48&t=11969&p=228313#p228313
2. Вскоре после написания данного топика прилетели обновы, и то, что я считал фитчей приравняли к багу, и устранили его. То есть ранее каждые 51 минуту отсылалось сообщение с последним статусом датчика. Посчитали это не верным и переделали. Теперь сообщение со статусом отсылается только при смене статуса, и никак иначе, что логично. А так называемый https://ru.wikipedia.org/wiki/Heartbeat-%D1%81%D0%BE%D0%BE%D0%B1%D1%89%D0%B5%D0%BD%D0%B8%D0%B5, теперь отправляется всё с тем же интервалом, но не отдельным сигналом, а состоянием батарей. Таким образом, чтобы понять жив ли датчик, нужно мониторить сигнал напряжения батареи или процент заряда батареи. Если эти данные приходят каждые 51 минуту(интервал именно моих датчиков), значит они работоспособны. Если сигнал не пришёл, значит что-то не так.
-
спасибо что отписались.
У меня флоу ловил только состояние открыто от герконов, я как-то и не видел, что пульс жизни от датчиков постоянно идет.
Видимо датчики движения тоже пульс будут слать.
-
Видимо датчики движения тоже пульс будут слать. `
Каждые три минуты. -
Видимо датчики движения тоже пульс будут слать.
Каждые три минуты.
А можно как то изменить для датчика двери интервал отправки статуса например не 50 мин. а 15мин? -
А можно как то изменить для датчика двери интервал отправки статуса например не 50 мин. а 15мин? `
На данный момент, боюсь, что нет. Это нужно менять прошивку датчика. Я даже незнаю как это делается, по воздуху, или же нужно разбирать и подпаявыться к контроллеру. Опять же нужно эту прошивку написать. Я пока не встречал такого. -
Добрый день, прошу сильно не пинать новичка
Есть управление поливом.
В адаптере Wrapper создана логическая переменная которая хранит состояния включен или нет полив оп расписанию.
!
В визуализации есть переключатель который управляет этой логической переменной.
!
В Node-Red создаем расписание для запуска полива и проверяем включен или нет автоматический полив.
!
Проблема в том что в Node-Red через какое то небольшое время теряется состояние переменной "автоматический полив", соответственно результат логического сложения получается вот таким :
!
В самой визуализации переменная читается, а в вот в Node-Red нет.
Что делаю не правильно ? Ее нужно принудительно читать еще раз ?
Если поклацать переключатель на визуализации - она оживает (переменная)
-
Если поклацать переключатель на визуализации - она оживает (переменная) `
Точно сказать не могу. Но из опыта роботы с Node-RED - он сам нифига не считывает, ему надо это принудительно сделать. После того как обновили состояние переменных - он их помнит всегда, пока работает.Если на какой-либо страничке (вкладке, Flow) Вы нажали "Deploy" - вся node-red сбрасывается(перезагружается) и состояния переменных и сенсоров снова становятся неопределёнными. У меня, например перестаёт работать логика, пока вручную не по щёлкаю сенсоры.А если отладить, запустить, и потом ничего не трогать, не перезагружать систему, не выключать систему, то всё работает бесконечно долго, включая статусы переменных, пока не произойдёт какой-либо аварийный сбой.
Так что когда отладите полностью систему и запустите в постоянную работу, обновите состояние всех нужных переменных и кусков кода, и потом оно будет всегда работать, пока что-то не перезапустите сами.