{"id":350337,"date":"2023-07-16T21:00:51","date_gmt":"2023-07-16T21:00:51","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=350337"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=350337","title":{"rendered":"<span>\u0423\u043c\u043d\u044b\u0439 \u0418\u0411\u041f \u0434\u043b\u044f \u0443\u043c\u043d\u043e\u0433\u043e \u0434\u043e\u043c\u0430<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0416\u0438\u0432\u0443 \u0432 \u043d\u043e\u0432\u043e\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0438 \u043f\u043e\u043a\u0430 \u0442\u0443\u0442 \u0438\u0434\u0443\u0442 \u0440\u0435\u043c\u043e\u043d\u0442\u044b, \u0438\u0437\u0440\u0435\u0434\u043a\u0430, \u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0427\u0442\u043e\u0431\u044b \u0443\u043c\u043d\u044b\u0439 \u0434\u043e\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c (\u0430 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0438\u043c \u0438 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442), \u043a\u0443\u043f\u0438\u043b \u0441\u0435\u0431\u0435 <a href=\"https:\/\/aliexpress.ru\/item\/1005005823329746.html\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 UPS \u043d\u0430 AliExpress<\/a> \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0435\u0433\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/092\/1ca\/6e8\/0921ca6e8f79f59111c96102edb42a4a.png\" width=\"800\" height=\"599\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/092\/1ca\/6e8\/0921ca6e8f79f59111c96102edb42a4a.png\"\/><\/figure>\n<p>\u0423 \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u0443 \u043c\u0435\u043d\u044f 18 \u0432\u0430\u0442\u0442\u043d\u0430\u044f \u043c\u043b\u0430\u0434\u0448\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c) \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u0415\u043c\u043a\u043e\u0441\u0442\u044c: 10400\u00a0\u043c\u0410\u0447 <\/p>\n<\/li>\n<li>\n<p>\u0412\u0445\u043e\u0434\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435: AC85\u2013265\u0412 50\/60\u00a0\u0413\u0446 <\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434: USB 5\u0412 2A<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434: 5\u0412 1A, 9\u0412 1A, 12\u0412 1A<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434 POE: 15\u0412 0.6\u0410, 24\u0412 0.6\u0410 <\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0431\u0437\u043e\u0440\u044b \u043d\u0430 \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/youtu.be\/GapNFFRMRWQ\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0439\u0442\u0438 \u0432 \u0441\u0435\u0442\u0438<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e3e\/a6d\/706\/e3ea6d7069973983f4a28d73c7b23992.png\" width=\"627\" height=\"428\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e3e\/a6d\/706\/e3ea6d7069973983f4a28d73c7b23992.png\"\/><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u0420\u043e\u0443\u0442\u0435\u0440 Archer AX53  (\u043f\u0438\u0442\u0430\u043d\u0438\u0435 12\u0412)<\/p>\n<\/li>\n<li>\n<p>\u0410\u0431\u043e\u043d\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b SNR ONU-EPON-1G-mini (\u043f\u0438\u0442\u0430\u043d\u0438\u0435 12\u0412)<\/p>\n<\/li>\n<li>\n<p>Raspberry Pi4 (\u043f\u0438\u0442\u0430\u043d\u0438\u0435 USB)<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u044f \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e\u0442 \u0418\u0411\u041f.<\/p>\n<blockquote>\n<p>\u0412\u0441\u044f \u0441\u043b\u0430\u0431\u043e\u0442\u043e\u0447\u043a\u0430 \u0443 \u043c\u0435\u043d\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0430\u043d\u0442\u0440\u0435\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u043b\u043a\u0435 \u0438 \u0447\u0442\u043e\u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c RPi4 \u0438\u043b\u0438 \u0440\u043e\u0443\u0442\u0435\u0440 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u0435\u043c\u044f\u043d\u043a\u0443, \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. <\/p>\n<\/blockquote>\n<p>\u0420\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e: \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e\u0431\u044b UPS \u0441\u043e\u043e\u0431\u0449\u0430\u043b \u043e <strong>\u0441\u0432\u043e\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u0440\u044f\u0434\u0430<\/strong> \u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0441\u0435\u0442\u0438 220\u0412, \u0432\u0442\u043e\u0440\u043e\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c <strong>\u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c<\/strong> \u043f\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u0443 <strong>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u043a USB<\/strong> \u0432\u044b\u0445\u043e\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; Raspberry Pi4 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u043d\u0435\u043c \u0443\u043c\u043d\u044b\u043c \u0434\u043e\u043c\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043e\u043d \u0437\u0430\u0432\u0438\u0441\u043d\u0435\u0442.<\/p>\n<p>\u0412 \u0437\u0430\u043d\u0430\u0447\u043a\u0435 \u0443 \u043c\u0435\u043d\u044f \u043d\u0430\u0448\u043b\u043e\u0441\u044c: <a href=\"https:\/\/aliexpress.ru\/item\/32651747570.html\" rel=\"noopener noreferrer nofollow\">wemos d1 mini<\/a> &#8212; \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u043c\u043e\u0437\u0433\u0438, <a href=\"https:\/\/www.pololu.com\/product\/2808\" rel=\"noopener noreferrer nofollow\">Pololu LV<\/a> &#8212; \u043c\u0438\u043a\u0440\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430, <a href=\"https:\/\/aliexpress.ru\/item\/1005001652848697.html\" rel=\"noopener noreferrer nofollow\">hw-384<\/a> &#8212; dc dc \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, DHT11 &#8212; \u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<blockquote>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0443\u044e\u0449\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <strong>\u0443\u0436\u0435\u00a0\u0431\u044b\u043b\u0438 \u0443\u00a0\u043c\u0435\u043d\u044f \u0432\u00a0\u043d\u0430\u043b\u0438\u0447\u0438\u0438<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442\u00a0\u0431\u044b\u0442\u044c \u043d\u0435\u00a0\u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u043c\u0438 (\u0431\u0435\u0437 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u043e\u0432 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440\u043e\u0432). \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0436\u043d\u043e\u00a0\u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0438 \u0440\u0435\u043b\u0435 \u0434\u043b\u044f\u00a0\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f USB, \u0432\u043c\u0435\u0441\u0442\u043e DCDC \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 USB \u0440\u0430\u0437\u044a\u0435\u043c. \u041d\u043e \u0438\u043c\u0435\u0435\u043c, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u043c. <\/p>\n<\/blockquote>\n<figure class=\"float\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1bf\/59a\/881\/1bf59a8818daeec9a49cca0f3ad0f743.png\" width=\"428\" height=\"483\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/1bf\/59a\/881\/1bf59a8818daeec9a49cca0f3ad0f743.png\"\/><\/figure>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u043d\u0430\u0448\u0438\u043c \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u043c \u0434\u0440\u0443\u0437\u044c\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u0440\u0430\u0441\u043f\u0430\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u044a\u0435\u043c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438 \u043e\u0442 UPS (\u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445): \u0417\u0435\u043c\u043b\u044f, \u043f\u0438\u0442\u0430\u043d\u0438\u0435 3.3 \u0412, D25 &#8212; \u0441\u0438\u0433\u043d\u0430\u043b \u0441\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 25%; W50, C75, 100 &#8212; \u0441\u0438\u0433\u043d\u0430\u043b \u0441\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432 50%, 75%, 100% \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. R &#8212; \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434, \u0441\u0438\u0433\u043d\u0430\u043b \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u0435\u0442\u0438 220\u0412, G &#8212;  \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434, \u0441\u0438\u0433\u043d\u0430\u043b \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 220\u0412.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043f\u043b\u0430\u0442\u0443 PoE-\u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u0430 (\u043e\u043d\u0430 \u043c\u043d\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u043d\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432), \u043d\u0430 \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u0441\u0442\u0430\u0435\u0442 wemos d1:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e50\/e3a\/063\/e50e3a06300272b4b0a1c8c995a9f627.png\" width=\"961\" height=\"621\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/e50\/e3a\/063\/e50e3a06300272b4b0a1c8c995a9f627.png\"\/><\/figure>\n<p>\u041f\u0440\u043e\u043f\u0438\u043b\u0438\u043b \u043e\u0442\u0432\u0435\u0440\u0441\u0442\u0438\u0435 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e USB \u0440\u0430\u0437\u044a\u0435\u043c\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/645\/1f0\/ed8\/6451f0ed855ab2e097dfbd479dcce835.png\" width=\"961\" height=\"721\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/645\/1f0\/ed8\/6451f0ed855ab2e097dfbd479dcce835.png\"\/><\/figure>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/139\/c6f\/13c\/139c6f13cc048af636e1297d9567923f.png\" alt=\"\u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043b\u0438\u043b \u0432\u0441\u0435 \u044d\u0442\u043e \u0442\u0435\u0440\u043c\u043e\u043a\u043b\u0435\u0435\u043c\" title=\"\u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043b\u0438\u043b \u0432\u0441\u0435 \u044d\u0442\u043e \u0442\u0435\u0440\u043c\u043e\u043a\u043b\u0435\u0435\u043c\" width=\"961\" height=\"721\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/139\/c6f\/13c\/139c6f13cc048af636e1297d9567923f.png\"\/><\/p>\n<div><figcaption>\u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043b\u0438\u043b \u0432\u0441\u0435 \u044d\u0442\u043e \u0442\u0435\u0440\u043c\u043e\u043a\u043b\u0435\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u043f\u0430\u044f\u043b \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0430 \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5f4\/d88\/51e\/5f4d8851eeef995802dd6fc1f9714575.png\" alt=\"\u043f\u043e\u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0432\u043e\u043b\u044c\u0442\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\" title=\"\u043f\u043e\u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0432\u043e\u043b\u044c\u0442\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438\" width=\"721\" height=\"961\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/5f4\/d88\/51e\/5f4d8851eeef995802dd6fc1f9714575.png\"\/><\/p>\n<div><figcaption>\u043f\u043e\u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0432\u043e\u043b\u044c\u0442\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 \u0441\u0431\u043e\u0440\u043a\u0435:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/149\/b65\/58a\/149b6558a45613077d3c608c83884365.png\" alt=\"\" title=\"\" width=\"961\" height=\"721\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/149\/b65\/58a\/149b6558a45613077d3c608c83884365.png\"\/><\/figure>\n<p>\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043f\u0440\u043e\u0430\u043f\u0433\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/71e\/3a2\/be9\/71e3a2be9b9aeb2af3ca574a58a53106.png\" width=\"1229\" height=\"746\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/71e\/3a2\/be9\/71e3a2be9b9aeb2af3ca574a58a53106.png\"\/><\/figure>\n<p>\u0421\u0445\u0435\u043c\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f: <strong>Wemos<\/strong> \u043f\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u044b \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c 3.3\u0412, \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b 25%-100% \u0438 Red \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u0438\u0442\u0430\u043d\u0438\u0435\u043c 8\u0412 (\u0440\u0430\u043d\u044c\u0448\u0435 \u0442\u0443\u0434\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440 PoE) \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043c\u0438\u043a\u0440\u043e\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f <strong>Pololu LV<\/strong> \u0438 \u0447\u0435\u0440\u0435\u0437 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b Cntrl \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043c\u043e\u0441\u0444\u0435\u0442\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u044f 8\u0412 \u043d\u0430 \u0432\u0445\u043e\u0434 DC-DC \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <strong>hw-384 <\/strong>(\u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 USB \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 5\u0412). \u041d\u0443 \u0438 \u0435\u0449\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438 <strong>DHT11 <\/strong>(\u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u043f\u043e\u0436\u0430\u0440\u043d\u044b\u0439), \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u0449\u0438\u043d\u044b, \u044f \u0441\u043d\u044f\u043b \u043a\u043e\u0440\u043f\u0443\u0441 \u0438 \u043f\u0440\u0438\u043a\u043b\u0435\u0438\u043b \u043f\u043e\u0432\u0435\u0440\u0445 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043f\u043e IP \u0430\u0434\u0440\u0435\u0441\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e &#171;\u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c&#187; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 USB \u0440\u0430\u0437\u044a\u0435\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0422\u0430\u043a \u0436\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 MQTT \u0432 \u0443\u043c\u043d\u044b\u0439 \u0434\u043e\u043c.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/480\/e6f\/44d\/480e6f44d00c0687fa4d03946b676baf.png\" width=\"422\" height=\"305\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/480\/e6f\/44d\/480e6f44d00c0687fa4d03946b676baf.png\"\/><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442.<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/dc2\/05b\/287\/dc205b2878c4c38e1e1c902ea4617388.png\" width=\"291\" height=\"150\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/dc2\/05b\/287\/dc205b2878c4c38e1e1c902ea4617388.png\"\/><\/figure>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/4ca\/e52\/70f\/4cae5270f5faca9ca331ea5193bdd334.png\" width=\"410\" height=\"225\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/4ca\/e52\/70f\/4cae5270f5faca9ca331ea5193bdd334.png\"\/><\/figure>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f UPS<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>#include &lt;ESP8266WiFi.h> #include &lt;ESP8266WebServer.h> #include &lt;PubSubClient.h> #include &lt;Adafruit_Sensor.h> #include &lt;DHT.h> #include &lt;UniversalTelegramBot.h>  const char* ssid = \"\u0412\u0410\u0428\u0410\u0421\u0415\u0422\u042c\";        \/\/ \u0418\u043c\u044f \u0432\u0430\u0448\u0435\u0439 Wi-Fi \u0441\u0435\u0442\u0438 const char* password = \"\u041f\u0410\u0420\u041e\u041b\u042cWIFI\";  \/\/ \u041f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 Wi-Fi \u0441\u0435\u0442\u0438  const char* mqttServer = \"IP\";             \/\/ IP-\u0430\u0434\u0440\u0435\u0441 MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 const char* mqttUsername = \"mqtt\";         \/\/ \u041b\u043e\u0433\u0438\u043d MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 const char* mqttPassword = \"mqtt\";         \/\/ \u041f\u0430\u0440\u043e\u043b\u044c MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 const char* mqttClientID = \"ups\";          \/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 MQTT const char* mqttTopic = \"battery\/charge\";  \/\/ \u0422\u043e\u043f\u0438\u043a MQTT \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0431\u0430\u0442\u0430\u0440\u0435\u0435 const char* mqttTopicH = \"battery\/health\"; \/\/ \u0422\u043e\u043f\u0438\u043a MQTT \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0435 const int mqttPort = 1883;                 \/\/ \u041f\u043e\u0440\u0442 MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430  const char* botToken = \"TOKEN\"; \/\/ \u0422\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430 const char* chatId = \"CHATID\";   \/\/ \u0447\u0430\u0442 \u0431\u043e\u0442\u0430 const unsigned long BOT_MTBS = 1000; \/\/ \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0431\u043e\u0442\u0430 unsigned long botLasttime;  #define DHTPIN D4     \/\/ \u041f\u0438\u043d, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0434\u0430\u0442\u0447\u0438\u043a DHT11 #define DHTTYPE DHT11 \/\/ \u0422\u0438\u043f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 DHT  const int batteryPin1 = D1;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 25% const int batteryPin2 = D2;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 50% const int batteryPin3 = D5;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 70% const int batteryPin4 = D6;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 100% const int noPowerPin = D7;   \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f 220\u0412  const int outputPin = D8;    \/\/ \u041f\u0438\u043d \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0438\u0438 USB  int battery=0; bool noPower=false; unsigned int unsuccessfullAttempts = 0; float humidity; float temperature;  const int maxAttempt = 25; const unsigned long MQTT_SEND_INTERVAL = 8000; unsigned long previousMillis = 0;  X509List cert(TELEGRAM_CERTIFICATE_ROOT); WiFiClientSecure secureClient; WiFiClient espClient; PubSubClient client(espClient); DHT dht(DHTPIN, DHTTYPE); ESP8266WebServer server(80); UniversalTelegramBot bot(botToken, secureClient);  \/\/ \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f USB) \u0447\u0435\u0440\u0435\u0437 Pololu Switch LV void restartUSBdevice() {   String html = \"&lt;html>&lt;head>&lt;meta charset=\\\"utf-8\\\">&lt;\/head>&lt;body>\";   html += \"\u0418\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 USB \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430...&lt;\/body>\";      bot.sendMessage(chatId, \"\u0418\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043a USB\", \"\");    digitalWrite(outputPin, LOW);   delay(2000);   digitalWrite(outputPin, HIGH);      server.sendHeader(\"Location\", String(\"\/\"), true);   server.send( 302, \"text\/html\", html); } \/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430 void handleNewMessages(int numNewMessages) {   for (int i = 0; i &lt; numNewMessages; i++){     String chat_id = bot.messages[i].chat_id;     String text = bot.messages[i].text;     if (bot.messages[i].type == \"callback_query\"){       text = bot.messages[i].text;     }      if (text == \"\/health\") {       String text = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 UPS:\\n\";       if (noPower) text +=\"\u0421\u0435\u0442\u044c 220 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442\\n\";       else text +=\"\u0421\u0435\u0442\u044c 220 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430\\n\";        text +=\"\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0430\u0440\u044f\u0434\u0430 - \"+String(battery)+\"%\\n\";       text +=\"\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 - \"+String(temperature)+\"\\n\";       text +=\"\u0412\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c - \"+String(humidity)+\"%\";              bot.sendMessage(chat_id, text, \"Markdown\");     }     if (text == \"\/rebootUSB\"){       restartUSBdevice();     }       } }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0430 void handleRoot() {   String html = \"&lt;html>&lt;head>&lt;meta charset=\\\"utf-8\\\">&lt;meta http-equiv=\\\"refresh\\\" content=\\\"15\\\">&lt;\/head>&lt;title>\u0423\u043c\u043d\u044b\u0439 UPS&lt;\/title>&lt;body>\";   html += \"&lt;h3>\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0430\u0440\u044f\u0434\u0430:&lt;\/h1>\";   html += \"&lt;p>\" + String(battery) + \"%&lt;\/p>\";   if (noPower){     html += \"&lt;h3 style=\\\"color:red;\\\">\u041d\u0435\u0442 \u0441\u0435\u0442\u0438 220\u0412&lt;\/h3>\";   }   if (unsuccessfullAttempts>0)     html += \"&lt;h3>\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \" + String(unsuccessfullAttempts) + \" \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0441 MQTT&lt;\/h3>\";   else     html += \"&lt;h3>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 MQTT OK&lt;\/h3>\";   html += \"&lt;p>\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430: \" + String(temperature) + \"&lt;\/p>\";   html += \"&lt;p>\u0412\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c: \" + String(humidity) + \"&lt;\/p>\";   html +=\"&lt;form action=\\\"\/restart\\\">\";   html += \"&lt;button type=\\\"submit\\\">\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u043a USB&lt;\/button>\";   html +=\"&lt;\/form>\";   html += \"&lt;\/body>&lt;\/html>\";   server.send(200, \"text\/html\", html); }  void setup() {    pinMode(batteryPin1, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(batteryPin2, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(batteryPin3, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(batteryPin4, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(noPowerPin, INPUT);  \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434      pinMode(outputPin, OUTPUT);         \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0438\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u0430\u043a \u0432\u044b\u0445\u043e\u0434   digitalWrite(outputPin, HIGH);      \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043d\u0430 USB    Serial.begin(115200);   delay(10);    WiFi.begin(ssid, password);  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Wi-Fi \u0441\u0435\u0442\u0438   secureClient.setTrustAnchors(&amp;cert);   while (WiFi.status() != WL_CONNECTED) {     delay(1000);     Serial.print(\".\");   }   Serial.println(\"Connected to WiFi!\");    Serial.print(\"Retrieving time: \");   configTime(0, 0, \"pool.ntp.org\"); \/\/ get UTC time via NTP   time_t now = time(nullptr);   while (now &lt; 24 * 3600)   {     Serial.print(\".\");     delay(100);     now = time(nullptr);   }   Serial.println(now);    server.on(\"\/\", handleRoot);   server.on(\"\/restart\", restartUSBdevice);   server.begin();      client.setServer(mqttServer, mqttPort);    bot.sendMessage(chatId, \"\u0423\u043c\u043d\u044b\u0439 UPS \u0437\u0430\u043f\u0443\u0449\u0435\u043d\", \"\"); }  void loop() {    client.loop();      server.handleClient();    unsigned long currentMillis = millis();    \/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0431\u043e\u0442\u0430   if (currentMillis - botLasttime > BOT_MTBS) {     botLasttime = currentMillis;     int numNewMessages = bot.getUpdates(bot.last_message_received + 1);     while (numNewMessages){       Serial.println(\"got response\");       handleNewMessages(numNewMessages);       numNewMessages = bot.getUpdates(bot.last_message_received + 1);     }   }    \/\/ \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430    if (currentMillis - previousMillis > MQTT_SEND_INTERVAL) {         previousMillis = currentMillis;     if (!client.connected()) {       \/\/ \u041f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f       while (!client.connected()) {         Serial.print(\"Attempting MQTT connection...\");         if (client.connect(mqttClientID, mqttUsername, mqttPassword)) {           Serial.println(\"connected\");           unsuccessfullAttempts=0;         } else {           unsuccessfullAttempts++;           Serial.print(\"failed, rc=\");           Serial.print(client.state());           Serial.println(\" retrying in 5 seconds\");           delay(5000);         }       }     }     \/\/_______________________________________________________________________     \/\/_____________________\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u0440\u043e\u0432\u043d\u044f \u0437\u0430\u0440\u044f\u0434\u0430 UPS________________________     \/\/_______________________________________________________________________     bool charge25 = !digitalRead(batteryPin1);     bool charge50 = !digitalRead(batteryPin2);     bool charge70 = !digitalRead(batteryPin3);     bool charge100 = !digitalRead(batteryPin4);     noPower = !digitalRead(noPowerPin);        char payload[50];      if (charge100) {       battery = 100;     } else if (charge70) {       battery = 70;     } else if (charge50) {       battery = 50;     } else if (charge25) {       battery = 25;     }     snprintf(payload, sizeof(payload), \"{\\\"noPower\\\":\\\"%s\\\",\\\"battery\\\":%d}\",  noPower ? \"true\" : \"false\", battery);  \/\/ \u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 JSON     Serial.println(\"Publishing data to MQTT...\");     client.publish(mqttTopic, payload);  \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 MQTT-\u0441\u0435\u0440\u0432\u0435\u0440     Serial.println(\"Data published to MQTT\");     \/\/_____________________________________________________     \/\/________________\u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b___________________     \/\/_____________________________________________________     humidity = dht.readHumidity();  \/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438     temperature = dht.readTemperature();  \/\/ \u0427\u0442\u0435\u043d\u0438\u0435 \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u043f\u043e \u0426\u0435\u043b\u044c\u0441\u0438\u044e      if (isnan(humidity) || isnan(temperature)) {       Serial.println(\"Failed to read from DHT sensor!\");     }      Serial.println(\"Publishing data to MQTT...\");     snprintf(payload, sizeof(payload), \"{\\\"humidity\\\":%.2f,\\\"temperature\\\":%.2f}\", humidity, temperature);  \/\/ \u0424\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442 JSON     client.publish(mqttTopicH, payload);  \/\/ \u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 MQTT-\u0441\u0435\u0440\u0432\u0435\u0440     Serial.println(\"Data published to MQTT\");      if (unsuccessfullAttempts > maxAttempt){       String keyboardJson = \"[[{ \\\"text\\\" : \\\"\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c USB \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\\\", \\\"callback_data\\\" : \\\"\/rebootUSB\\\" }]]\";       bot.sendMessageWithInlineKeyboard(chatId, \"\u041f\u043e\u0445\u043e\u0436\u0435, \u0447\u0442\u043e HA \u043d\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442\", \"\", keyboardJson);     }    }    }<\/code><\/pre>\n<\/p>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<p> <!----> <!----><\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/748358\/\"> https:\/\/habr.com\/ru\/articles\/748358\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0416\u0438\u0432\u0443 \u0432 \u043d\u043e\u0432\u043e\u0441\u0442\u0440\u043e\u0439\u043a\u0435 \u0438 \u043f\u043e\u043a\u0430 \u0442\u0443\u0442 \u0438\u0434\u0443\u0442 \u0440\u0435\u043c\u043e\u043d\u0442\u044b, \u0438\u0437\u0440\u0435\u0434\u043a\u0430, \u043d\u043e \u0431\u044b\u0432\u0430\u0435\u0442, \u0447\u0442\u043e \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u0438\u0447\u0435\u0441\u0442\u0432\u043e. \u0427\u0442\u043e\u0431\u044b \u0443\u043c\u043d\u044b\u0439 \u0434\u043e\u043c \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u043b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c (\u0430 \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u043d\u0438\u043c \u0438 \u0434\u043e\u043c\u0430\u0448\u043d\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442), \u043a\u0443\u043f\u0438\u043b \u0441\u0435\u0431\u0435 <a href=\"https:\/\/aliexpress.ru\/item\/1005005823329746.html\" rel=\"noopener noreferrer nofollow\">\u043c\u043e\u0431\u0438\u043b\u044c\u043d\u044b\u0439 UPS \u043d\u0430 AliExpress<\/a> \u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0435\u0433\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043b.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0423 \u0431\u0435\u0437\u044b\u043c\u044f\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u0443 \u043c\u0435\u043d\u044f 18 \u0432\u0430\u0442\u0442\u043d\u0430\u044f \u043c\u043b\u0430\u0434\u0448\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c) \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438:<\/p>\n<ul>\n<li>\n<p>\u0415\u043c\u043a\u043e\u0441\u0442\u044c: 10400\u00a0\u043c\u0410\u0447 <\/p>\n<\/li>\n<li>\n<p>\u0412\u0445\u043e\u0434\u043d\u043e\u0435 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435: AC85\u2013265\u0412 50\/60\u00a0\u0413\u0446 <\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434: USB 5\u0412 2A<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434: 5\u0412 1A, 9\u0412 1A, 12\u0412 1A<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0445\u043e\u0434 POE: 15\u0412 0.6\u0410, 24\u0412 0.6\u0410 <\/p>\n<\/li>\n<\/ul>\n<p>\u041e\u0431\u0437\u043e\u0440\u044b \u043d\u0430 \u044d\u0442\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043c\u043e\u0436\u043d\u043e <a href=\"https:\/\/youtu.be\/GapNFFRMRWQ\" rel=\"noopener noreferrer nofollow\">\u043d\u0430\u0439\u0442\u0438 \u0432 \u0441\u0435\u0442\u0438<\/a>.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418\u0442\u0430\u043a, \u0434\u0430\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u0420\u043e\u0443\u0442\u0435\u0440 Archer AX53  (\u043f\u0438\u0442\u0430\u043d\u0438\u0435 12\u0412)<\/p>\n<\/li>\n<li>\n<p>\u0410\u0431\u043e\u043d\u0435\u043d\u0442\u0441\u043a\u0438\u0439 \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b SNR ONU-EPON-1G-mini (\u043f\u0438\u0442\u0430\u043d\u0438\u0435 12\u0412)<\/p>\n<\/li>\n<li>\n<p>Raspberry Pi4 (\u043f\u0438\u0442\u0430\u043d\u0438\u0435 USB)<\/p>\n<\/li>\n<\/ol>\n<p>\u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u0438 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u044f \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u044d\u0442\u043e\u0442 \u0418\u0411\u041f.<\/p>\n<blockquote>\n<p>\u0412\u0441\u044f \u0441\u043b\u0430\u0431\u043e\u0442\u043e\u0447\u043a\u0430 \u0443 \u043c\u0435\u043d\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u043d\u0430 \u0430\u043d\u0442\u0440\u0435\u0441\u043e\u043b\u044c\u043d\u043e\u0439 \u043f\u043e\u043b\u043a\u0435 \u0438 \u0447\u0442\u043e\u0431\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c RPi4 \u0438\u043b\u0438 \u0440\u043e\u0443\u0442\u0435\u0440 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0442\u0440\u0435\u043c\u044f\u043d\u043a\u0443, \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u043e. <\/p>\n<\/blockquote>\n<p>\u0420\u0435\u0448\u0435\u043d\u043e \u0431\u044b\u043b\u043e \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e: \u043f\u0435\u0440\u0432\u043e\u0435 \u0447\u0442\u043e\u0431\u044b UPS \u0441\u043e\u043e\u0431\u0449\u0430\u043b \u043e <strong>\u0441\u0432\u043e\u0435\u043c \u0443\u0440\u043e\u0432\u043d\u0435 \u0437\u0430\u0440\u044f\u0434\u0430<\/strong> \u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0441\u0435\u0442\u0438 220\u0412, \u0432\u0442\u043e\u0440\u043e\u0435 \u044d\u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c <strong>\u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c<\/strong> \u043f\u043e \u0432\u043d\u0435\u0448\u043d\u0435\u043c\u0443 \u0441\u0438\u0433\u043d\u0430\u043b\u0443 <strong>\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u043a USB<\/strong> \u0432\u044b\u0445\u043e\u0434\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e, \u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 &#8212; Raspberry Pi4 \u0441 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u043d\u044b\u043c \u043d\u0430 \u043d\u0435\u043c \u0443\u043c\u043d\u044b\u043c \u0434\u043e\u043c\u043e\u043c, \u0435\u0441\u043b\u0438 \u0432\u0434\u0440\u0443\u0433 \u043e\u043d \u0437\u0430\u0432\u0438\u0441\u043d\u0435\u0442.<\/p>\n<p>\u0412 \u0437\u0430\u043d\u0430\u0447\u043a\u0435 \u0443 \u043c\u0435\u043d\u044f \u043d\u0430\u0448\u043b\u043e\u0441\u044c: <a href=\"https:\/\/aliexpress.ru\/item\/32651747570.html\" rel=\"noopener noreferrer nofollow\">wemos d1 mini<\/a> &#8212; \u0431\u0443\u0434\u0443\u0449\u0438\u0435 \u043c\u043e\u0437\u0433\u0438, <a href=\"https:\/\/www.pololu.com\/product\/2808\" rel=\"noopener noreferrer nofollow\">Pololu LV<\/a> &#8212; \u043c\u0438\u043a\u0440\u043e \u0446\u0438\u0444\u0440\u043e\u0432\u0430\u044f \u043a\u043d\u043e\u043f\u043a\u0430, <a href=\"https:\/\/aliexpress.ru\/item\/1005001652848697.html\" rel=\"noopener noreferrer nofollow\">hw-384<\/a> &#8212; dc dc \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, DHT11 &#8212; \u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438.<\/p>\n<blockquote>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0443\u044e\u0449\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 <strong>\u0443\u0436\u0435\u00a0\u0431\u044b\u043b\u0438 \u0443\u00a0\u043c\u0435\u043d\u044f \u0432\u00a0\u043d\u0430\u043b\u0438\u0447\u0438\u0438<\/strong>, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442\u00a0\u0431\u044b\u0442\u044c \u043d\u0435\u00a0\u0441\u043e\u0432\u0441\u0435\u043c \u0432\u0435\u0440\u043d\u044b\u043c\u0438 (\u0431\u0435\u0437 \u043f\u043e\u0434\u0442\u044f\u0433\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u043e\u0432 \u0438 \u0444\u0438\u043b\u044c\u0442\u0440\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043d\u0434\u0435\u043d\u0441\u0430\u0442\u043e\u0440\u043e\u0432). \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043c\u043e\u0436\u043d\u043e\u00a0\u0431\u044b\u043b\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u0438\u0435 \u0434\u0430\u0442\u0447\u0438\u043a\u0438 \u0438 \u0440\u0435\u043b\u0435 \u0434\u043b\u044f\u00a0\u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f USB, \u0432\u043c\u0435\u0441\u0442\u043e DCDC \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439 USB \u0440\u0430\u0437\u044a\u0435\u043c. \u041d\u043e \u0438\u043c\u0435\u0435\u043c, \u0447\u0442\u043e \u0438\u043c\u0435\u0435\u043c. <\/p>\n<\/blockquote>\n<figure class=\"float\"><\/figure>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u043d\u0430\u0448\u0438\u043c \u043a\u0438\u0442\u0430\u0439\u0441\u043a\u0438\u043c \u0434\u0440\u0443\u0437\u044c\u044f\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0441\u0442\u0430\u0432\u0438\u043b\u0438 \u043d\u0435\u0440\u0430\u0441\u043f\u0430\u0435\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u044a\u0435\u043c \u0441\u043e \u0432\u0441\u0435\u043c\u0438 \u043d\u0443\u0436\u043d\u044b\u043c\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430\u043c\u0438 \u043e\u0442 UPS (\u0441\u043d\u0438\u0437\u0443 \u0432\u0432\u0435\u0440\u0445): \u0417\u0435\u043c\u043b\u044f, \u043f\u0438\u0442\u0430\u043d\u0438\u0435 3.3 \u0412, D25 &#8212; \u0441\u0438\u0433\u043d\u0430\u043b \u0441\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u0430 25%; W50, C75, 100 &#8212; \u0441\u0438\u0433\u043d\u0430\u043b \u0441\u043e \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434\u043e\u0432 50%, 75%, 100% \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e. R &#8212; \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434, \u0441\u0438\u0433\u043d\u0430\u043b \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u0441\u0435\u0442\u0438 220\u0412, G &#8212;  \u0437\u0435\u043b\u0435\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434, \u0441\u0438\u0433\u043d\u0430\u043b \u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438 220\u0412.<\/p>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0432\u044b\u043a\u0438\u0434\u044b\u0432\u0430\u0435\u043c \u043f\u043b\u0430\u0442\u0443 PoE-\u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440\u0430 (\u043e\u043d\u0430 \u043c\u043d\u0435 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043d\u0435 \u043d\u0443\u0436\u043d\u0430, \u043d\u0435\u0442 \u0442\u0430\u043a\u0438\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432), \u043d\u0430 \u0435\u0433\u043e \u043c\u0435\u0441\u0442\u043e \u043e\u0442\u043b\u0438\u0447\u043d\u043e \u0432\u0441\u0442\u0430\u0435\u0442 wemos d1:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u043e\u043f\u0438\u043b\u0438\u043b \u043e\u0442\u0432\u0435\u0440\u0441\u0442\u0438\u0435 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0435\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e USB \u0440\u0430\u0437\u044a\u0435\u043c\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<figure class=\"full-width\">\n<div><figcaption>\u043f\u043e\u0442\u043e\u043c \u0437\u0430\u043b\u0438\u043b \u0432\u0441\u0435 \u044d\u0442\u043e \u0442\u0435\u0440\u043c\u043e\u043a\u043b\u0435\u0435\u043c<\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0438\u043f\u0430\u044f\u043b \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0432\u043e\u0434\u0430 \u043a \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u0435:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>\u043f\u043e\u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u0442 \u0432\u044b\u0441\u043e\u043a\u043e\u0432\u043e\u043b\u044c\u0442\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438<\/figcaption><\/div>\n<\/figure>\n<p>\u0418 \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u0432 \u0441\u0431\u043e\u0440\u043a\u0435:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u043f\u0440\u043e\u0430\u043f\u0433\u0440\u0435\u0436\u0435\u043d\u043d\u043e\u0433\u043e \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u0445\u0435\u043c\u0430 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u0430\u044f: <strong>Wemos<\/strong> \u043f\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0442 \u0433\u043b\u0430\u0432\u043d\u043e\u0439 \u043f\u043b\u0430\u0442\u044b \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c 3.3\u0412, \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441\u0438\u0433\u043d\u0430\u043b\u044b 25%-100% \u0438 Red \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0430 \u0438 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u043d\u043e\u0441\u0442\u044c\u044e. \u041f\u0438\u0442\u0430\u043d\u0438\u0435\u043c 8\u0412 (\u0440\u0430\u043d\u044c\u0448\u0435 \u0442\u0443\u0434\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u043b\u0441\u044f \u0438\u043d\u0436\u0435\u043a\u0442\u043e\u0440 PoE) \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u0435\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0433\u043e \u043c\u0438\u043a\u0440\u043e\u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u0435\u043b\u044f <strong>Pololu LV<\/strong> \u0438 \u0447\u0435\u0440\u0435\u0437 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0439 \u0441\u0438\u0433\u043d\u0430\u043b Cntrl \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0441\u0432\u043e\u0438 \u043c\u043e\u0441\u0444\u0435\u0442\u044b, \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u044f 8\u0412 \u043d\u0430 \u0432\u0445\u043e\u0434 DC-DC \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <strong>hw-384 <\/strong>(\u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 USB \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 5\u0412). \u041d\u0443 \u0438 \u0435\u0449\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0434\u0430\u0442\u0447\u0438\u043a \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u044b \u0438 \u0432\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u0438 <strong>DHT11 <\/strong>(\u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u043f\u043e\u0436\u0430\u0440\u043d\u044b\u0439), \u0443 \u043a\u043e\u0442\u043e\u0440\u043e\u0433\u043e, \u0434\u043b\u044f \u0443\u043c\u0435\u043d\u044c\u0448\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u0449\u0438\u043d\u044b, \u044f \u0441\u043d\u044f\u043b \u043a\u043e\u0440\u043f\u0443\u0441 \u0438 \u043f\u0440\u0438\u043a\u043b\u0435\u0438\u043b \u043f\u043e\u0432\u0435\u0440\u0445 \u0430\u043a\u043a\u0443\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432.<\/p>\n<p>\u041f\u0440\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043f\u043e IP \u0430\u0434\u0440\u0435\u0441\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e &#171;\u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c&#187; \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u043a \u043d\u043e\u0432\u043e\u043c\u0443 USB \u0440\u0430\u0437\u044a\u0435\u043c\u0443 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e. \u0422\u0430\u043a \u0436\u0435 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0443 MQTT \u0432 \u0443\u043c\u043d\u044b\u0439 \u0434\u043e\u043c.<\/p>\n<figure class=\"\"><\/figure>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0447\u0435\u0440\u0435\u0437 \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442.<\/p>\n<figure class=\"\"><\/figure>\n<figure class=\"\"><\/figure>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434 \u0434\u043b\u044f \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f UPS<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>#include &lt;ESP8266WiFi.h> #include &lt;ESP8266WebServer.h> #include &lt;PubSubClient.h> #include &lt;Adafruit_Sensor.h> #include &lt;DHT.h> #include &lt;UniversalTelegramBot.h>  const char* ssid = \"\u0412\u0410\u0428\u0410\u0421\u0415\u0422\u042c\";        \/\/ \u0418\u043c\u044f \u0432\u0430\u0448\u0435\u0439 Wi-Fi \u0441\u0435\u0442\u0438 const char* password = \"\u041f\u0410\u0420\u041e\u041b\u042cWIFI\";  \/\/ \u041f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0432\u0430\u0448\u0435\u0439 Wi-Fi \u0441\u0435\u0442\u0438  const char* mqttServer = \"IP\";             \/\/ IP-\u0430\u0434\u0440\u0435\u0441 MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 const char* mqttUsername = \"mqtt\";         \/\/ \u041b\u043e\u0433\u0438\u043d MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 const char* mqttPassword = \"mqtt\";         \/\/ \u041f\u0430\u0440\u043e\u043b\u044c MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 const char* mqttClientID = \"ups\";          \/\/ \u0418\u0434\u0435\u043d\u0442\u0438\u0444\u0438\u043a\u0430\u0442\u043e\u0440 \u043a\u043b\u0438\u0435\u043d\u0442\u0430 MQTT const char* mqttTopic = \"battery\/charge\";  \/\/ \u0422\u043e\u043f\u0438\u043a MQTT \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0431\u0430\u0442\u0430\u0440\u0435\u0435 const char* mqttTopicH = \"battery\/health\"; \/\/ \u0422\u043e\u043f\u0438\u043a MQTT \u0434\u043b\u044f \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043e \u0442\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0435 const int mqttPort = 1883;                 \/\/ \u041f\u043e\u0440\u0442 MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0430  const char* botToken = \"TOKEN\"; \/\/ \u0422\u043e\u043a\u0435\u043d \u0434\u043b\u044f \u0442\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430 const char* chatId = \"CHATID\";   \/\/ \u0447\u0430\u0442 \u0431\u043e\u0442\u0430 const unsigned long BOT_MTBS = 1000; \/\/ \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0431\u043e\u0442\u0430 unsigned long botLasttime;  #define DHTPIN D4     \/\/ \u041f\u0438\u043d, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u0434\u0430\u0442\u0447\u0438\u043a DHT11 #define DHTTYPE DHT11 \/\/ \u0422\u0438\u043f \u0434\u0430\u0442\u0447\u0438\u043a\u0430 DHT  const int batteryPin1 = D1;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 25% const int batteryPin2 = D2;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 50% const int batteryPin3 = D5;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0442\u0440\u0435\u0442\u044c\u0435\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 70% const int batteryPin4 = D6;  \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0447\u0435\u0442\u0432\u0435\u0440\u0442\u043e\u0433\u043e \u0438\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u0433\u043d\u0430\u043b\u0430 100% const int noPowerPin = D7;   \/\/ \u041f\u0438\u043d \u0432\u0445\u043e\u0434\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0431 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0438 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u044f 220\u0412  const int outputPin = D8;    \/\/ \u041f\u0438\u043d \u0432\u044b\u0432\u043e\u0434\u0430 \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u0430 \u043e\u0442\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043b\u0438\u043d\u0438\u0438 USB  int battery=0; bool noPower=false; unsigned int unsuccessfullAttempts = 0; float humidity; float temperature;  const int maxAttempt = 25; const unsigned long MQTT_SEND_INTERVAL = 8000; unsigned long previousMillis = 0;  X509List cert(TELEGRAM_CERTIFICATE_ROOT); WiFiClientSecure secureClient; WiFiClient espClient; PubSubClient client(espClient); DHT dht(DHTPIN, DHTTYPE); ESP8266WebServer server(80); UniversalTelegramBot bot(botToken, secureClient);  \/\/ \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 (\u043f\u0440\u0435\u0440\u044b\u0432\u0430\u043d\u0438\u0435 \u043f\u0438\u0442\u0430\u043d\u0438\u044f USB) \u0447\u0435\u0440\u0435\u0437 Pololu Switch LV void restartUSBdevice() {   String html = \"&lt;html>&lt;head>&lt;meta charset=\\\"utf-8\\\">&lt;\/head>&lt;body>\";   html += \"\u0418\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 USB \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430...&lt;\/body>\";      bot.sendMessage(chatId, \"\u0418\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0433\u043e \u043a USB\", \"\");    digitalWrite(outputPin, LOW);   delay(2000);   digitalWrite(outputPin, HIGH);      server.sendHeader(\"Location\", String(\"\/\"), true);   server.send( 302, \"text\/html\", html); } \/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u0431\u043e\u0442\u0430 void handleNewMessages(int numNewMessages) {   for (int i = 0; i &lt; numNewMessages; i++){     String chat_id = bot.messages[i].chat_id;     String text = bot.messages[i].text;     if (bot.messages[i].type == \"callback_query\"){       text = bot.messages[i].text;     }      if (text == \"\/health\") {       String text = \"\u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 UPS:\\n\";       if (noPower) text +=\"\u0421\u0435\u0442\u044c 220 \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442\\n\";       else text +=\"\u0421\u0435\u0442\u044c 220 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0430\\n\";        text +=\"\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0430\u0440\u044f\u0434\u0430 - \"+String(battery)+\"%\\n\";       text +=\"\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430 - \"+String(temperature)+\"\\n\";       text +=\"\u0412\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c - \"+String(humidity)+\"%\";              bot.sendMessage(chat_id, text, \"Markdown\");     }     if (text == \"\/rebootUSB\"){       restartUSBdevice();     }       } }  \/\/ \u0424\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 HTTP \u0437\u0430\u043f\u0440\u043e\u0441\u0430 void handleRoot() {   String html = \"&lt;html>&lt;head>&lt;meta charset=\\\"utf-8\\\">&lt;meta http-equiv=\\\"refresh\\\" content=\\\"15\\\">&lt;\/head>&lt;title>\u0423\u043c\u043d\u044b\u0439 UPS&lt;\/title>&lt;body>\";   html += \"&lt;h3>\u0423\u0440\u043e\u0432\u0435\u043d\u044c \u0437\u0430\u0440\u044f\u0434\u0430:&lt;\/h1>\";   html += \"&lt;p>\" + String(battery) + \"%&lt;\/p>\";   if (noPower){     html += \"&lt;h3 style=\\\"color:red;\\\">\u041d\u0435\u0442 \u0441\u0435\u0442\u0438 220\u0412&lt;\/h3>\";   }   if (unsuccessfullAttempts>0)     html += \"&lt;h3>\u041f\u043e\u043f\u044b\u0442\u043a\u0430 \" + String(unsuccessfullAttempts) + \" \u0441\u043e\u0435\u0434\u0438\u043d\u0438\u0442\u044c\u0441\u044f \u0441 MQTT&lt;\/h3>\";   else     html += \"&lt;h3>\u0421\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0441 MQTT OK&lt;\/h3>\";   html += \"&lt;p>\u0422\u0435\u043c\u043f\u0435\u0440\u0430\u0442\u0443\u0440\u0430: \" + String(temperature) + \"&lt;\/p>\";   html += \"&lt;p>\u0412\u043b\u0430\u0436\u043d\u043e\u0441\u0442\u044c: \" + String(humidity) + \"&lt;\/p>\";   html +=\"&lt;form action=\\\"\/restart\\\">\";   html += \"&lt;button type=\\\"submit\\\">\u041f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u043e\u0435 \u043a USB&lt;\/button>\";   html +=\"&lt;\/form>\";   html += \"&lt;\/body>&lt;\/html>\";   server.send(200, \"text\/html\", html); }  void setup() {    pinMode(batteryPin1, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(batteryPin2, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(batteryPin3, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(batteryPin4, INPUT); \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434   pinMode(noPowerPin, INPUT);  \/\/ \u0418\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0432\u0445\u043e\u0434      pinMode(outputPin, OUTPUT);         \/\/ \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0438\u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430 \u043a\u0430\u043a \u0432\u044b\u0445\u043e\u0434   digitalWrite(outputPin, HIGH);      \/\/ \u0412\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u043d\u0430 USB    Serial.begin(115200);   delay(10);    WiFi.begin(ssid, password);  \/\/ \u041f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a Wi-Fi \u0441\u0435\u0442\u0438   secureClient.setTrustAnchors(&amp;cert);   while (WiFi.status() != WL_CONNECTED) {     delay(1000);     Serial.print(\".\");   }   Serial.println(\"Connected to WiFi!\");    Serial.print(\"Retrieving time: \");   configTime(0, 0, \"pool.ntp.org\"); \/\/ get UTC time via NTP   time_t now = time(nullptr);   while (now &lt; 24 * 3600)   {     Serial.print(\".\");     delay(100);     now = time(nullptr);   }   Serial.println(now);    server.on(\"\/\", handleRoot);   server.on(\"\/restart\", restartUSBdevice);   server.begin();      client.setServer(mqttServer, mqttPort);    bot.sendMessage(chatId, \"\u0423\u043c\u043d\u044b\u0439 UPS \u0437\u0430\u043f\u0443\u0449\u0435\u043d\", \"\"); }  void loop() {    client.loop();      server.handleClient();    unsigned long currentMillis = millis();    \/\/ \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0445 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 \u043e\u0442 \u0431\u043e\u0442\u0430   if (currentMillis - botLasttime > BOT_MTBS) {     botLasttime = currentMillis;     int numNewMessages = bot.getUpdates(bot.last_message_received + 1);     while (numNewMessages){       Serial.println(\"got response\");       handleNewMessages(numNewMessages);       numNewMessages = bot.getUpdates(bot.last_message_received + 1);     }   }    \/\/ \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430    if (currentMillis - previousMillis > MQTT_SEND_INTERVAL) {         previousMillis = currentMillis;     if (!client.connected()) {       \/\/ \u041f\u0435\u0440\u0435\u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a MQTT-\u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u0438 \u0440\u0430\u0437\u0440\u044b\u0432\u0435 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f       while (!client.connected()) {         Serial.print(\"Attempting MQTT connection...\");         if (client.connect(mqttClientID, mqttUsername, mqttPassword)) {           Serial.println(\"connected\");           unsuccessfullAttempts=0;         } else {           unsuccessfullAttempts++;           Serial.print(\"failed, rc=\");           Serial.print(client.state());           Serial.println(\" retrying in 5 seconds\");           delay(5000);         }       }     }     \/\/_______________________________________________________________________     \/\/_____________________\u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430<\/code><\/pre>\n<\/div>\n<\/details>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-350337","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350337","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=350337"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/350337\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=350337"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=350337"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=350337"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}