diff --git a/node-red/flows.json b/node-red/flows.json
index 0df9fc7..c7de9a7 100644
--- a/node-red/flows.json
+++ b/node-red/flows.json
@@ -1,16 +1,16 @@
[
{
- "id": "b6a554cb58b20b89",
+ "id": "b54441ff0e1e1d78",
"type": "tab",
- "label": "Поток 1",
+ "label": "Умная клетка для птиц",
"disabled": false,
"info": "",
"env": []
},
{
- "id": "e2dbb550ecc754bb",
+ "id": "3329b02ba68d5122",
"type": "mqtt in",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "",
"topic": "Bird",
"qos": "2",
@@ -20,104 +20,85 @@
"rap": true,
"rh": 0,
"inputs": 0,
- "x": 230,
- "y": 300,
+ "x": 250,
+ "y": 260,
"wires": [
[
- "2362125992f2f15a",
- "853c51250983534e"
+ "69ab35d16ddcd908"
]
]
},
{
- "id": "2362125992f2f15a",
- "type": "debug",
- "z": "b6a554cb58b20b89",
- "name": "debug 1",
- "active": true,
- "tosidebar": false,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "targetType": "msg",
- "statusVal": "",
- "statusType": "auto",
- "x": 440,
- "y": 240,
- "wires": []
- },
- {
- "id": "853c51250983534e",
+ "id": "69ab35d16ddcd908",
"type": "ui_template",
- "z": "b6a554cb58b20b89",
- "group": "de858d4f14ceb677",
- "name": "",
- "order": 0,
- "width": 0,
- "height": 0,
+ "z": "b54441ff0e1e1d78",
+ "group": "546b157844234b18",
+ "name": "Video",
+ "order": 1,
+ "width": 6,
+ "height": 5,
"format": "
\n

\n
\n\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
- "x": 440,
- "y": 300,
+ "x": 430,
+ "y": 260,
"wires": [
[]
]
},
{
- "id": "f43e5b2d6e86f54d",
+ "id": "7d8023c9457af7b3",
"type": "mqtt in",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "light",
"topic": "esp32/sensors/light",
- "qos": "2",
+ "qos": "0",
"datatype": "auto-detect",
"broker": "77647757300a0f3b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
- "x": 230,
- "y": 400,
+ "x": 250,
+ "y": 340,
"wires": [
[
- "5f6b7a790ede5d26",
- "744d0ca72a8e8df6"
+ "d343a20cb8cc4c3f",
+ "953e9b0817d7888a"
]
]
},
{
- "id": "347db67a62c25780",
+ "id": "98a116d0b230fd5e",
"type": "mqtt in",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "temp",
"topic": "esp32/sensors/temp",
- "qos": "2",
+ "qos": "0",
"datatype": "auto-detect",
"broker": "77647757300a0f3b",
"nl": false,
"rap": true,
"rh": 0,
"inputs": 0,
- "x": 230,
- "y": 520,
+ "x": 250,
+ "y": 420,
"wires": [
[
- "1abf7819982867cb",
- "bade5e5c2073894d"
+ "967917ac6800fba7"
]
]
},
{
- "id": "edacc7ae819555c1",
+ "id": "9f71a077937ffa10",
"type": "mqtt in",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "humidity",
"topic": "esp32/sensors/humidity",
- "qos": "2",
+ "qos": "0",
"datatype": "auto-detect",
"broker": "77647757300a0f3b",
"nl": false,
@@ -125,130 +106,80 @@
"rh": 0,
"inputs": 0,
"x": 240,
- "y": 660,
+ "y": 500,
"wires": [
[
- "56ccdbc50d6e0d65",
- "dc38d7ae67c9b0fa"
+ "a62bb5aa0c518728"
]
]
},
{
- "id": "5f6b7a790ede5d26",
- "type": "debug",
- "z": "b6a554cb58b20b89",
- "name": "debug 2",
- "active": true,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "payload",
- "targetType": "msg",
- "statusVal": "",
- "statusType": "auto",
- "x": 440,
- "y": 400,
- "wires": []
- },
- {
- "id": "1abf7819982867cb",
- "type": "debug",
- "z": "b6a554cb58b20b89",
- "name": "debug 3",
- "active": true,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "statusVal": "",
- "statusType": "auto",
- "x": 440,
- "y": 520,
- "wires": []
- },
- {
- "id": "56ccdbc50d6e0d65",
- "type": "debug",
- "z": "b6a554cb58b20b89",
- "name": "debug 4",
- "active": true,
- "tosidebar": true,
- "console": false,
- "tostatus": false,
- "complete": "false",
- "statusVal": "",
- "statusType": "auto",
- "x": 440,
- "y": 660,
- "wires": []
- },
- {
- "id": "744d0ca72a8e8df6",
+ "id": "d343a20cb8cc4c3f",
"type": "ui_text",
- "z": "b6a554cb58b20b89",
- "group": "de858d4f14ceb677",
- "order": 1,
- "width": 0,
- "height": 0,
- "name": "",
+ "z": "b54441ff0e1e1d78",
+ "group": "546b157844234b18",
+ "order": 20,
+ "width": 4,
+ "height": 1,
+ "name": "Light",
"label": "Освещённость",
- "format": "{{msg.payload}}",
- "layout": "row-left",
+ "format": "{{msg.payload}} lux",
+ "layout": "row-spread",
"className": "",
"style": false,
"font": "",
"fontSize": 16,
"color": "#000000",
- "x": 460,
- "y": 360,
+ "x": 430,
+ "y": 340,
"wires": []
},
{
- "id": "bade5e5c2073894d",
+ "id": "967917ac6800fba7",
"type": "ui_text",
- "z": "b6a554cb58b20b89",
- "group": "de858d4f14ceb677",
- "order": 2,
- "width": 0,
- "height": 0,
- "name": "",
+ "z": "b54441ff0e1e1d78",
+ "group": "546b157844234b18",
+ "order": 23,
+ "width": 4,
+ "height": 1,
+ "name": "Temperature",
"label": "Температура",
- "format": "{{msg.payload}}",
- "layout": "row-left",
- "className": "",
- "style": false,
- "font": "",
- "fontSize": 16,
- "color": "#000000",
- "x": 460,
- "y": 480,
- "wires": []
- },
- {
- "id": "dc38d7ae67c9b0fa",
- "type": "ui_text",
- "z": "b6a554cb58b20b89",
- "group": "de858d4f14ceb677",
- "order": 3,
- "width": 0,
- "height": 0,
- "name": "",
- "label": "Влажность",
- "format": "{{msg.payload}}",
- "layout": "row-left",
+ "format": "{{msg.payload}} °C",
+ "layout": "row-spread",
"className": "",
"style": false,
"font": "",
"fontSize": 16,
"color": "#000000",
"x": 450,
- "y": 620,
+ "y": 420,
"wires": []
},
{
- "id": "0eacb49f1c0dd21a",
+ "id": "a62bb5aa0c518728",
+ "type": "ui_text",
+ "z": "b54441ff0e1e1d78",
+ "group": "546b157844234b18",
+ "order": 26,
+ "width": 4,
+ "height": 1,
+ "name": "Humidity",
+ "label": "Влажность",
+ "format": "{{msg.payload}} %",
+ "layout": "row-spread",
+ "className": "",
+ "style": false,
+ "font": "",
+ "fontSize": 16,
+ "color": "#000000",
+ "x": 440,
+ "y": 500,
+ "wires": []
+ },
+ {
+ "id": "326e3d7cd0711c1a",
"type": "mqtt out",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "",
"topic": "esp32/led",
"qos": "",
@@ -259,17 +190,17 @@
"correl": "",
"expiry": "",
"broker": "77647757300a0f3b",
- "x": 620,
- "y": 780,
+ "x": 660,
+ "y": 860,
"wires": []
},
{
- "id": "dff600700ba8712a",
+ "id": "688951172c116781",
"type": "ui_colour_picker",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "color_led",
- "label": "Настроить освещение",
- "group": "de858d4f14ceb677",
+ "label": "Цвет свечения",
+ "group": "546b157844234b18",
"format": "hex",
"outformat": "string",
"showSwatch": true,
@@ -280,25 +211,25 @@
"showLightness": true,
"square": "false",
"dynOutput": "false",
- "order": 5,
- "width": 0,
- "height": 0,
+ "order": 10,
+ "width": 3,
+ "height": 1,
"passthru": true,
"topic": "topic",
"topicType": "msg",
"className": "",
- "x": 200,
- "y": 840,
+ "x": 240,
+ "y": 860,
"wires": [
[
- "2095de04955e307f"
+ "debe9d9adfca0645"
]
]
},
{
- "id": "2095de04955e307f",
+ "id": "debe9d9adfca0645",
"type": "function",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "function 1",
"func": "let hex = msg.payload;\n\nhex = hex.replace(\"#\", \"\");\n\nlet r = parseInt(hex.substring(0, 2), 16);\nlet g = parseInt(hex.substring(2, 4), 16);\nlet b = parseInt(hex.substring(4, 6), 16);\n\nmsg.payload = `${r},${g},${b}`;\n\nreturn msg;",
"outputs": 1,
@@ -307,25 +238,25 @@
"initialize": "",
"finalize": "",
"libs": [],
- "x": 400,
- "y": 840,
+ "x": 440,
+ "y": 860,
"wires": [
[
- "0eacb49f1c0dd21a"
+ "326e3d7cd0711c1a"
]
]
},
{
- "id": "38796c6012673ea3",
+ "id": "95c5b2f761fe6d30",
"type": "ui_switch",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "led",
"label": "Выкл./Вкл. освещение",
"tooltip": "",
- "group": "de858d4f14ceb677",
+ "group": "546b157844234b18",
"order": 5,
- "width": 0,
- "height": 0,
+ "width": 3,
+ "height": 1,
"passthru": true,
"decouple": "false",
"topic": "esp32/led",
@@ -341,23 +272,24 @@
"offcolor": "",
"animate": false,
"className": "",
- "x": 390,
- "y": 780,
+ "x": 430,
+ "y": 800,
"wires": [
[
- "0eacb49f1c0dd21a"
+ "326e3d7cd0711c1a",
+ "a7a8bbbba6048822"
]
]
},
{
- "id": "56c329c92a8daa3a",
+ "id": "9dd1c7f2d5e42901",
"type": "ui_button",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "day",
- "group": "de858d4f14ceb677",
- "order": 6,
- "width": 0,
- "height": 0,
+ "group": "546b157844234b18",
+ "order": 7,
+ "width": 2,
+ "height": 1,
"passthru": false,
"label": "День",
"tooltip": "",
@@ -369,23 +301,24 @@
"payloadType": "str",
"topic": "esp32/servo",
"topicType": "msg",
- "x": 390,
- "y": 920,
+ "x": 430,
+ "y": 640,
"wires": [
[
- "cb039d5711277422"
+ "aa0c521baa5be283",
+ "018bce1ef78ece19"
]
]
},
{
- "id": "136ce072862c41f7",
+ "id": "3f8af190256a6358",
"type": "ui_button",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "night",
- "group": "de858d4f14ceb677",
- "order": 8,
- "width": 0,
- "height": 0,
+ "group": "546b157844234b18",
+ "order": 15,
+ "width": 2,
+ "height": 1,
"passthru": false,
"label": "Ночь",
"tooltip": "",
@@ -397,23 +330,24 @@
"payloadType": "str",
"topic": "esp32/servo",
"topicType": "msg",
- "x": 390,
- "y": 1000,
+ "x": 430,
+ "y": 720,
"wires": [
[
- "cb039d5711277422"
+ "aa0c521baa5be283",
+ "018bce1ef78ece19"
]
]
},
{
- "id": "39d131b72bf61cc5",
+ "id": "e1b2f26f37b43975",
"type": "ui_button",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "mid",
- "group": "de858d4f14ceb677",
- "order": 7,
- "width": 0,
- "height": 0,
+ "group": "546b157844234b18",
+ "order": 12,
+ "width": 2,
+ "height": 1,
"passthru": false,
"label": "Полдень",
"tooltip": "",
@@ -425,18 +359,19 @@
"payloadType": "str",
"topic": "esp32/servo",
"topicType": "msg",
- "x": 390,
- "y": 960,
+ "x": 430,
+ "y": 680,
"wires": [
[
- "cb039d5711277422"
+ "aa0c521baa5be283",
+ "018bce1ef78ece19"
]
]
},
{
- "id": "cb039d5711277422",
+ "id": "018bce1ef78ece19",
"type": "mqtt out",
- "z": "b6a554cb58b20b89",
+ "z": "b54441ff0e1e1d78",
"name": "",
"topic": "esp32/servo",
"qos": "",
@@ -447,10 +382,296 @@
"correl": "",
"expiry": "",
"broker": "77647757300a0f3b",
- "x": 610,
- "y": 980,
+ "x": 670,
+ "y": 640,
"wires": []
},
+ {
+ "id": "c238963e4e433c07",
+ "type": "ui_text",
+ "z": "b54441ff0e1e1d78",
+ "group": "546b157844234b18",
+ "order": 3,
+ "width": 4,
+ "height": 2,
+ "name": "",
+ "label": "Состояние жалюзи",
+ "format": "{{msg.payload}}",
+ "layout": "col-center",
+ "className": "",
+ "style": false,
+ "font": "",
+ "fontSize": 16,
+ "color": "#000000",
+ "x": 860,
+ "y": 720,
+ "wires": []
+ },
+ {
+ "id": "aa0c521baa5be283",
+ "type": "function",
+ "z": "b54441ff0e1e1d78",
+ "name": "function 2",
+ "func": "let command = msg.payload;\n\nlet status_text = \"\";\nlet status_color = \"\";\n\nswitch(command) {\n case \"DAY\":\n status_text = \"День\";\n status_color = \"green\";\n break;\n case \"MID\":\n status_text = \"Полдень\";\n status_color = \"orange\";\n break;\n case \"NIGHT\":\n status_text = \"Ночь\";\n status_color = \"blue\";\n break;\n default:\n status_text = \"Неизвестное состояние\";\n status_color = \"gray\";\n}\n\nmsg.payload = command;\n\nlet status_msg = {\n payload: status_text,\n topic: \"esp32/servo\"\n};\n\nnode.send([\n [status_msg],\n [msg]\n]);",
+ "outputs": 1,
+ "timeout": 0,
+ "noerr": 0,
+ "initialize": "",
+ "finalize": "",
+ "libs": [],
+ "x": 660,
+ "y": 720,
+ "wires": [
+ [
+ "c238963e4e433c07"
+ ]
+ ]
+ },
+ {
+ "id": "a7a8bbbba6048822",
+ "type": "function",
+ "z": "b54441ff0e1e1d78",
+ "name": "function 3",
+ "func": "let led_value = msg.payload;\n\nlet status_text = \"Освещение выключено\";\nlet status_color = \"\";\n\nif (led_value === \"255,255,255\" || led_value === \"ON\") {\n status_text = \"Освещение включено\";\n status_color = \"green\";\n} else if (led_value === \"OFF\") {\n status_text = \"Освещение выключено\";\n status_color = \"red\";\n} \n\nlet status_msg = {\n payload: status_text,\n color: status_color\n};\n\nnode.send([status_msg]);\n\nlet mqtt_msg = {\n payload: led_value,\n topic: \"esp32/led\"\n};\nnode.send([null, mqtt_msg]);",
+ "outputs": 1,
+ "timeout": 0,
+ "noerr": 0,
+ "initialize": "",
+ "finalize": "",
+ "libs": [],
+ "x": 660,
+ "y": 800,
+ "wires": [
+ [
+ "935423913e479104"
+ ]
+ ]
+ },
+ {
+ "id": "935423913e479104",
+ "type": "ui_text",
+ "z": "b54441ff0e1e1d78",
+ "group": "546b157844234b18",
+ "order": 2,
+ "width": 5,
+ "height": 2,
+ "name": "",
+ "label": "Состояние освещения",
+ "format": "{{msg.payload}}",
+ "layout": "col-center",
+ "className": "",
+ "style": false,
+ "font": "",
+ "fontSize": 16,
+ "color": "#000000",
+ "x": 870,
+ "y": 800,
+ "wires": []
+ },
+ {
+ "id": "953e9b0817d7888a",
+ "type": "ui_chart",
+ "z": "b54441ff0e1e1d78",
+ "name": "",
+ "group": "546b157844234b18",
+ "order": 17,
+ "width": 9,
+ "height": 5,
+ "label": "Изменение освещённости",
+ "chartType": "line",
+ "legend": "false",
+ "xformat": "HH:mm:ss",
+ "interpolate": "linear",
+ "nodata": "",
+ "dot": false,
+ "ymin": "0",
+ "ymax": "500",
+ "removeOlder": "24",
+ "removeOlderPoints": "",
+ "removeOlderUnit": "3600",
+ "cutout": 0,
+ "useOneColor": false,
+ "useUTC": false,
+ "colors": [
+ "#1f77b4",
+ "#aec7e8",
+ "#ff7f0e",
+ "#2ca02c",
+ "#98df8a",
+ "#d62728",
+ "#ff9896",
+ "#9467bd",
+ "#c5b0d5"
+ ],
+ "outputs": 1,
+ "useDifferentColor": false,
+ "className": "",
+ "x": 640,
+ "y": 340,
+ "wires": [
+ []
+ ]
+ },
+ {
+ "id": "f7c54e9ed468ad03",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 4,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "06f9e525bae03d4f",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 6,
+ "width": 2,
+ "height": 1
+ },
+ {
+ "id": "7e39ac586ef75670",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 8,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "eebc2ead2bdc4713",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 9,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "60c5659493f5b1e3",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 11,
+ "width": 2,
+ "height": 1
+ },
+ {
+ "id": "8e200c90a6fe2612",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 13,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "13a88f7bf1f6b955",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 14,
+ "width": 6,
+ "height": 1
+ },
+ {
+ "id": "d8806707892c2923",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 16,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "9a9ebc45643a2504",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 18,
+ "width": 6,
+ "height": 1
+ },
+ {
+ "id": "5e37295a74a08a72",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 19,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "8d65bde5f5fe894d",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 21,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "089a1385b0933a72",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 22,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "8dad06acd8afbd47",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 24,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "f1d14ae70273a27f",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 25,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "2da5e779df30a880",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 27,
+ "width": 1,
+ "height": 1
+ },
+ {
+ "id": "98a43a6570fb548d",
+ "type": "ui_spacer",
+ "z": "b54441ff0e1e1d78",
+ "name": "spacer",
+ "group": "546b157844234b18",
+ "order": 28,
+ "width": 6,
+ "height": 1
+ },
{
"id": "77647757300a0f3b",
"type": "mqtt-broker",
@@ -483,13 +704,14 @@
"sessionExpiry": ""
},
{
- "id": "de858d4f14ceb677",
+ "id": "546b157844234b18",
"type": "ui_group",
- "name": "Default",
+ "z": "b54441ff0e1e1d78",
+ "name": "Мониторинг и управление",
"tab": "8e35d7697e7af77c",
"order": 1,
"disp": true,
- "width": "24",
+ "width": 15,
"collapse": false,
"className": ""
},
@@ -502,7 +724,7 @@
"hidden": false
},
{
- "id": "cfd15ff24e6ffc58",
+ "id": "d21957267aecd6fc",
"type": "global-config",
"env": [],
"modules": {