{"id":459130,"date":"2025-05-10T21:00:25","date_gmt":"2025-05-10T21:00:25","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=459130"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=459130","title":{"rendered":"<span>\u041e\u0446\u0438\u0444\u0440\u043e\u0432\u043a\u0430 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0441\u0442\u0440\u0435\u043b\u043e\u0447\u043d\u043e\u0433\u043e \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430 \u0432 Home Assistant<\/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>\u0414\u0430\u0432\u043d\u043e \u043c\u0443\u0447\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u043e \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430 \u0433\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0442\u043b\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u0430 ESP32-CAM \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 Home Assistant \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c ESPHome.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7f6\/101\/ef2\/7f6101ef2a4b7dfa37384839b0526d64.jpg\" width=\"640\" height=\"640\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/7f6\/101\/ef2\/7f6101ef2a4b7dfa37384839b0526d64.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/7f6\/101\/ef2\/7f6101ef2a4b7dfa37384839b0526d64.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041a\u0430\u043c\u0435\u0440\u0443 \u044f \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043c\u043d\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f, \u0438, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u043d \u043f\u043e\u0434\u0430\u0447\u0438 \u0432\u043e\u0434\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 (\u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e).<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b14\/d39\/36d\/b14d3936d8341ecb77b98bdd998a9735.png\" alt=\"\u0428\u0442\u0430\u0442\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 ESP32-CAM \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c \u0448\u043a\u0430\u0444\u0443\" title=\"\u0428\u0442\u0430\u0442\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 ESP32-CAM \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c \u0448\u043a\u0430\u0444\u0443\" width=\"385\" height=\"378\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b14\/d39\/36d\/b14d3936d8341ecb77b98bdd998a9735.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b14\/d39\/36d\/b14d3936d8341ecb77b98bdd998a9735.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u0428\u0442\u0430\u0442\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 ESP32-CAM \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c \u0448\u043a\u0430\u0444\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043e\u0431\u043b\u0430\u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u044d\u0442\u043e\u0442 &#171;\u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0439&#187; \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 Node-RED \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043b\u0430 \u0438 \u043d\u0430\u0441\u043e\u0441\u043e\u0432:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9fc\/62a\/c1a\/9fc62ac1a7990ab72caf604544f6d101.png\" width=\"872\" height=\"407\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/9fc\/62a\/c1a\/9fc62ac1a7990ab72caf604544f6d101.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/9fc\/62a\/c1a\/9fc62ac1a7990ab72caf604544f6d101.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<ol start=\"2\">\n<li>\n<p>\u0412 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043a\u043e\u0442\u043b\u0430;<\/p>\n<\/li>\n<li>\n<p>\u042f \u043b\u0435\u0437\u0443 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 HA \u0438 \u0432 \u043a\u0430\u043c\u0435\u0440\u0435 \u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0430\u043a\u043e\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0438\u0437\u043a\u043e\u0435 &#8212; \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u043a\u0440\u0430\u043d \u043f\u043e\u0434\u043f\u0438\u0442\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0423\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u0440\u0443\u043a\u0438-\u0442\u043e \u0447\u0435\u0448\u0443\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 HA \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043e\u0446\u0438\u0444\u0440\u043e\u0432\u043a\u0438<\/h2>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e Raspberry Pi 4B, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f HA \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0431\u043e\u0440\u043d\u044b\u0439 NAS c Xpenology \u043d\u0430 \u0431\u043e\u0440\u0442\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0433\u043e.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Python \u0432 Xpenology<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0432 Container Manager \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0437 Python 3-10-slim<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b10\/f1e\/cae\/b10f1ecae33b4eb51bc4e7e742574cdb.png\" width=\"1063\" height=\"363\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/b10\/f1e\/cae\/b10f1ecae33b4eb51bc4e7e742574cdb.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/b10\/f1e\/cae\/b10f1ecae33b4eb51bc4e7e742574cdb.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u041e\u0431\u0440\u0430\u0437\u044b, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c python \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u043e\u043c\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \/volume1\/docker\/gauge<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c: \/app<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p> \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0414\u0430\u043b\u0435\u0435, \u043f\u043e\u0442\u043e\u043c \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8f2\/f0c\/70f\/8f2f0c70f54064acde852064ef9f00b8.png\" alt=\"\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\" title=\"\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\" width=\"1066\" height=\"392\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/8f2\/f0c\/70f\/8f2f0c70f54064acde852064ef9f00b8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8f2\/f0c\/70f\/8f2f0c70f54064acde852064ef9f00b8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a NAS \u043f\u043e SSH \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1fd\/e9e\/b3e\/1fde9eb3e78d1a97ff4328bee7c16605.png\" width=\"1061\" height=\"438\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/1fd\/e9e\/b3e\/1fde9eb3e78d1a97ff4328bee7c16605.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/1fd\/e9e\/b3e\/1fde9eb3e78d1a97ff4328bee7c16605.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Putty<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d96\/a43\/14b\/d96a4314b63d6b2f7b6c53542058d9be.png\" width=\"656\" height=\"508\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d96\/a43\/14b\/d96a4314b63d6b2f7b6c53542058d9be.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d96\/a43\/14b\/d96a4314b63d6b2f7b6c53542058d9be.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 root, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c ID \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">docker ps<\/code><\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440:<\/p>\n<pre><code class=\"bash\">docker exec -it ID_\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 bash<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<pre><code class=\"bash\">apt update &amp;&amp; apt install -y python3-pip libgl1 libglib2.0-0 apt-get install -y python3-pip python3-dev apt-get install -y libglib2.0-0 libsm6 libxext6 libxrender-dev apt-get install -y qt5-qmake qtbase5-dev-tools qtchooser apt-get install -y libx11-dev libgl1-mesa-glx libfontconfig1 libxkbcommon0 apt-get install -y libxcb-xinerama0 pip install opencv-python numpy pip3 install opencv-python matplotlib<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 gauge_<a href=\"http:\/\/reader.py\" rel=\"noopener noreferrer nofollow\">reader.py<\/a> \u0438 \u043a\u043b\u0430\u0434\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 docker\\gauge \u043d\u0430 NAS. \u041a \u043d\u0435\u043c\u0443 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Home Assistant<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u044d\u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0430\u043c\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412 HA \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 docker \u043d\u0430 NAS:<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a15\/ff8\/c25\/a15ff8c251f68412a1792db214b2f905.png\" width=\"682\" height=\"1189\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/a15\/ff8\/c25\/a15ff8c251f68412a1792db214b2f905.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a15\/ff8\/c25\/a15ff8c251f68412a1792db214b2f905.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u043d\u0430 ESP32-CAM, \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a, \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 gauge, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0448\u0430\u0433\u043e\u043c \u0432\u044b\u0448\u0435, \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434:<\/p>\n<pre><code class=\"yaml\">alias: ESP Cam snapshot \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441 description: \"\" triggers:   - minutes: 0     trigger: time_pattern actions:   - target:       entity_id: switch.pressure_boiler_flash_led     action: switch.turn_on     data: {}   - delay:       hours: 0       minutes: 0       seconds: 10       milliseconds: 0   - data:       entity_id: camera.pressure_boiler_my_camera       filename: \/media\/gauge\/sample.jpg     action: camera.snapshot   - delay:       hours: 0       minutes: 0       seconds: 10       milliseconds: 0   - target:       entity_id: switch.pressure_boiler_flash_led     action: switch.turn_off     data: {} mode: single <\/code><\/pre>\n<p>\u0418 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u043d\u0441\u043e\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0442\u044c NAS \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"yaml\">sensor:     - name: \"Boiler Pressure\"       state_topic: \"sensors\/boiler\/pressure\"       unit_of_measurement: \"bar\"       device_class: pressure       unique_id: pressure_boiler<\/code><\/pre>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u043e\u0442\u043e<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0434\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c &#8212; \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u043e\u043c. \u0421\u043f\u0443\u0441\u0442\u044f \u043f\u0430\u0440\u0443 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u0441\u0435 \u0443\u0445\u0438\u0449\u0440\u0435\u043d\u0438\u044f, \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e 100% \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u043a\u043b\u0435\u0438\u043b \u0432\u043e\u043a\u0440\u0443\u0433 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0435\u0437\u043a\u0438 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d72\/3aa\/839\/d723aa839fbcbd1a4db169b11daae5d0.jpg\" alt=\"ESP32-CAM \u0432 \u043b\u0435\u0433\u043e-\u043a\u0440\u043e\u043d\u0448\u0442\u0435\u0439\u043d\u0435. \u041d\u0430\u0434 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u0435\u043f\u0438\u043b \u0431\u0435\u043b\u044b\u0439 \u043b\u0438\u0441\u0442 \u0431\u0443\u043c\u0430\u0433\u0438, \u0442.\u043a. \u0440\u0435\u043b\u044c\u0435\u0444 \u043a\u043e\u0440\u043f\u0443\u0441\u0430 \u043a\u043e\u0442\u043b\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043d\u043e\u0441\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0445\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0443\u0433\u043b\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430.\" title=\"ESP32-CAM \u0432 \u043b\u0435\u0433\u043e-\u043a\u0440\u043e\u043d\u0448\u0442\u0435\u0439\u043d\u0435. \u041d\u0430\u0434 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u0435\u043f\u0438\u043b \u0431\u0435\u043b\u044b\u0439 \u043b\u0438\u0441\u0442 \u0431\u0443\u043c\u0430\u0433\u0438, \u0442.\u043a. \u0440\u0435\u043b\u044c\u0435\u0444 \u043a\u043e\u0440\u043f\u0443\u0441\u0430 \u043a\u043e\u0442\u043b\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043d\u043e\u0441\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0445\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0443\u0433\u043b\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430.\" width=\"960\" height=\"1280\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/d72\/3aa\/839\/d723aa839fbcbd1a4db169b11daae5d0.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/d72\/3aa\/839\/d723aa839fbcbd1a4db169b11daae5d0.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>ESP32-CAM \u0432 \u043b\u0435\u0433\u043e-\u043a\u0440\u043e\u043d\u0448\u0442\u0435\u0439\u043d\u0435. \u041d\u0430\u0434 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u0435\u043f\u0438\u043b \u0431\u0435\u043b\u044b\u0439 \u043b\u0438\u0441\u0442 \u0431\u0443\u043c\u0430\u0433\u0438, \u0442.\u043a. \u0440\u0435\u043b\u044c\u0435\u0444 \u043a\u043e\u0440\u043f\u0443\u0441\u0430 \u043a\u043e\u0442\u043b\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043d\u043e\u0441\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0445\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0443\u0433\u043b\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (\u0445\u0432\u0430\u043b\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044f\u043c!)<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443. \u0417\u0430\u0434\u0430\u0447\u0443 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\n<p>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u043e\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0443 &#8212; \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0446\u0435\u043d\u0442\u0440 \u0438 \u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u0440\u044f\u0435\u043c \u0443\u0433\u043e\u043b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0438 \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0443\u0433\u043e\u043b-\u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0432 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u0431\u0430\u0440\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 mqtt HA.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">import cv2 import numpy as np import math import logging import paho.mqtt.client as mqtt from typing import Optional, Tuple, List  # \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__)  # \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f class Config:     MQTT_BROKER = \"192.168.1.****\"     MQTT_PORT = ****     MQTT_TOPIC = \"sensors\/boiler\/pressure\"     MQTT_USER = \"****\"     MQTT_PASS = \"****\"     MQTT_TIMEOUT = 5          CALIBRATION = {         215: 0.0,         155: 1.0,         90: 2.0,         29: 3.0,         327: 4.0     }          OUTPUT_DIR = '\/app\/'     OUTPUT_SIZE = 600     BLUR_SIZE = (5, 5)     ADAPTIVE_THRESH_BLOCK = 11     ADAPTIVE_THRESH_C = 2     HOUGH_CIRCLES_PARAMS = {         'dp': 1,         'minDist': 100,         'param1': 50,         'param2': 30,         'minRadius': 100,         'maxRadius': 200     }     HOUGH_LINES_PARAMS = {         'rho': 1,         'theta': np.pi\/180,         'threshold': 50,         'minLineLength': 150,         'maxLineGap': 10     }  def detect_quadrilateral(image: np.ndarray) -&gt; Tuple[Optional[List[Tuple[int, int]]], np.ndarray]:     \"\"\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432 \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430\"\"\"     gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)     _, thresh = cv2.threshold(gray, 50, 255, cv2.THRESH_BINARY_INV)          kernel = np.ones((5,5), np.uint8)     thresh = cv2.morphologyEx(thresh, cv2.MORPH_CLOSE, kernel)     thresh = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel)          contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)          if not contours:         return None, image.copy()          largest_contour = max(contours, key=cv2.contourArea)     epsilon = 0.03 * cv2.arcLength(largest_contour, True)     approx = cv2.approxPolyDP(largest_contour, epsilon, True)          if len(approx) != 4:         for eps in [0.02, 0.04, 0.05]:             epsilon = eps * cv2.arcLength(largest_contour, True)             approx = cv2.approxPolyDP(largest_contour, epsilon, True)             if len(approx) == 4:                 break         else:             return None, image.copy()          points = np.array([point[0] for point in approx], dtype=np.float32)     center = np.mean(points, axis=0)          def sort_key(point):         return math.atan2(point[1] - center[1], point[0] - center[0])          sorted_points = sorted(points, key=sort_key, reverse=True)     bottom_idx = np.argmax([p[1] for p in sorted_points])     sorted_points = np.roll(sorted_points, -bottom_idx, axis=0)          if bottom_idx == 1:         sorted_points = np.roll(sorted_points, -1, axis=0)          corners = [tuple(map(int, p)) for p in sorted_points]          vis = image.copy()     for i, corner in enumerate(corners):         cv2.circle(vis, corner, 10, (0, 255, 0), -1)         cv2.putText(vis, f\"{i+1}\", (corner[0]+15, corner[1]+15),                     cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2)          for i in range(4):         cv2.line(vis, corners[i], corners[(i+1)%4], (255, 0, 0), 2)          return corners, vis  def correct_perspective(image: np.ndarray, corners: List[Tuple[int, int]]) -&gt; np.ndarray:     \"\"\"\u041a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0443\u0433\u043b\u043e\u0432\"\"\"     size = Config.OUTPUT_SIZE     dst_points = np.array([         [0, size-1],         [size-1, size-1],         [size-1, 0],         [0, 0]     ], dtype=np.float32)          src_points = np.array(corners, dtype=np.float32)     matrix = cv2.getPerspectiveTransform(src_points, dst_points)     corrected = cv2.warpPerspective(image, matrix, (size, size))          return corrected  def enhance_image(image: np.ndarray, roi: Tuple[int, int, int, int]) -&gt; Tuple[np.ndarray, np.ndarray]:     \"\"\"\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438\"\"\"     x, y, w, h = roi     cropped = image[y:y+h, x:x+w]     gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY)     blurred = cv2.GaussianBlur(gray, Config.BLUR_SIZE, 0)     thresh = cv2.adaptiveThreshold(         blurred, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,         cv2.THRESH_BINARY_INV, Config.ADAPTIVE_THRESH_BLOCK, Config.ADAPTIVE_THRESH_C     )     return thresh, cropped  def find_dial_center(image: np.ndarray, roi: Tuple[int, int, int, int]) -&gt; Tuple[Tuple[int, int, int], np.ndarray]:     \"\"\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430 \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0430\"\"\"     x, y, w, h = roi     cropped = image[y:y+h, x:x+w]     gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY)     vis = cropped.copy()          circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, **Config.HOUGH_CIRCLES_PARAMS)          if circles is not None:         circles = np.uint16(np.around(circles))         best = circles[0][0]         cv2.circle(vis, (best[0], best[1]), best[2], (0, 255, 0), 2)         cv2.circle(vis, (best[0], best[1]), 2, (0, 0, 255), 3)         center_vis_path = f\"{Config.OUTPUT_DIR}center_detection.jpg\"         cv2.imwrite(center_vis_path, vis)         return (x + best[0], y + best[1], best[2]), vis          center = (x + w\/\/2, y + h\/\/2, min(w, h)\/\/2)     cv2.circle(vis, (w\/\/2, h\/\/2), min(w, h)\/\/2, (0, 255, 0), 2)     center_vis_path = f\"{Config.OUTPUT_DIR}center_detection.jpg\"     cv2.imwrite(center_vis_path, vis)     return center, vis  def find_arrow_angle(thresh: np.ndarray, original: np.ndarray,                      roi: Tuple[int, int, int, int],                      center_info: Tuple[int, int, int]) -&gt; Tuple[Optional[float], Optional[Tuple[int, int]], np.ndarray]:     \"\"\"\u041f\u043e\u0438\u0441\u043a \u0443\u0433\u043b\u0430 \u0441\u0442\u0440\u0435\u043b\u043a\u0438\"\"\"     x, y, w, h = roi     cX, cY, radius = center_info     cropped = original[y:y+h, x:x+w]     cX_roi, cY_roi = cX - x, cY - y          params = Config.HOUGH_LINES_PARAMS.copy()     params['minLineLength'] = radius * 0.5          edges = cv2.Canny(thresh, 50, 150)     lines = cv2.HoughLinesP(edges, **params)          if lines is not None:         filtered = []         for line in lines:             x1, y1, x2, y2 = line[0]             dist1 = math.hypot(x1 - cX_roi, y1 - cY_roi)             dist2 = math.hypot(x2 - cX_roi, y2 - cY_roi)             if min(dist1, dist2) &lt; radius * 0.3:                 filtered.append(line)                  if filtered:             longest = max(filtered, key=lambda l: math.hypot(l[0][0]-l[0][2], l[0][1]-l[0][3]))             x1, y1, x2, y2 = longest[0]                          tip = (x2, y2) if math.hypot(x1-cX_roi, y1-cY_roi) &lt; math.hypot(x2-cX_roi, y2-cY_roi) else (x1, y1)             angle = math.degrees(math.atan2(cY_roi - tip[1], tip[0] - cX_roi)) % 360                          cv2.line(cropped, (cX_roi, cY_roi), tip, (0, 0, 255), 3)             return angle, (cX, cY), cropped          return None, None, cropped  def setup_mqtt() -&gt; mqtt.Client:     \"\"\"\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 MQTT \u043a\u043b\u0438\u0435\u043d\u0442\u0430\"\"\"     client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2)     client.username_pw_set(Config.MQTT_USER, Config.MQTT_PASS)     client.connect(Config.MQTT_BROKER, Config.MQTT_PORT, Config.MQTT_TIMEOUT)     return client  def calibrate_pressure(angle: float) -&gt; float:     \"\"\"\u041a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0430 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f\"\"\"     angles = np.array(sorted(Config.CALIBRATION.keys()))     pressures = np.array([Config.CALIBRATION[a] for a in angles])     return float(np.interp(angle, angles, pressures))  def send_mqtt(pressure: float) -&gt; bool:     \"\"\"\u041e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0447\u0435\u0440\u0435\u0437 MQTT\"\"\"     try:         client = setup_mqtt()         client.publish(Config.MQTT_TOPIC, f\"{pressure:.2f}\")         client.disconnect()         return True     except Exception as e:         logger.error(f\"\u041e\u0448\u0438\u0431\u043a\u0430 MQTT: {str(e)}\")         return False  def process_image(image_path: str) -&gt; Optional[float]:     \"\"\"\u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\"\"\"     try:         image = cv2.imread(image_path)         if image is None:             raise FileNotFoundError(f\"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435: {image_path}\")                  quad_corners, quad_vis = detect_quadrilateral(image)         if quad_corners is None:             logger.error(\"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0442\u044c \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\")             return None                      cv2.imwrite(f\"{Config.OUTPUT_DIR}quadrilateral_detection.jpg\", quad_vis)         corrected_image = correct_perspective(image, quad_corners)         cv2.imwrite(f\"{Config.OUTPUT_DIR}corrected_perspective.jpg\", corrected_image)                  corrected_roi = (0, 0, Config.OUTPUT_SIZE, Config.OUTPUT_SIZE)         thresh, cropped = enhance_image(corrected_image, corrected_roi)         center, _ = find_dial_center(corrected_image, corrected_roi)         angle, _, processed = find_arrow_angle(thresh, corrected_image, corrected_roi, center)                  if angle is None:             logger.error(\"\u041d\u0435 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u0442\u044c \u0443\u0433\u043e\u043b \u0441\u0442\u0440\u0435\u043b\u043a\u0438\")             return None                  pressure = calibrate_pressure(angle)         cv2.putText(processed, f\"Angle: {angle:.1f}\u00b0\", (20, 40),                     cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)         cv2.putText(processed, f\"Pressure: {pressure:.2f} bar\", (20, 80),                    cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0), 2)                  cv2.imwrite(f\"{Config.OUTPUT_DIR}processed.jpg\", processed)         return pressure              except Exception as e:         logger.error(f\"\u041e\u0448\u0438\u0431\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438: {str(e)}\")         return None  def main():     image_path = '\/app\/sample.jpg'     pressure = process_image(image_path)     if pressure is not None:         send_mqtt(pressure)  if __name__ == \"__main__\":     main()<\/code><\/pre>\n<p>\u041a\u043e\u0434 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0438\u0441\u0430\u043b \u0442\u0440\u0443\u0434\u044f\u0433\u0430 DeepSeek \u043f\u043e\u0434 \u043c\u043e\u0438\u043c \u0447\u0443\u0442\u043a\u0438\u043c \u0440\u0443\u043a\u043e\u0432\u043e\u0434\u0441\u0442\u0432\u043e\u043c. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u044b\u0442\u0430\u043b\u0441\u044f \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432 ChatGPT, \u043d\u043e \u043f\u043e\u0441\u043b\u0435 \u0434\u043e\u0441\u0442\u0438\u0436\u0435\u043d\u0438\u044f \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e\u0433\u043e \u043b\u0438\u043c\u0438\u0442\u0430 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u043d \u0440\u0435\u0437\u043a\u043e &#171;\u0442\u0443\u043f\u0435\u043b&#187; \u0438 \u0434\u0435\u043b\u043e \u0448\u043b\u043e \u0443\u0436\u0435 \u043d\u0435 \u0442\u0430\u043a \u0445\u043e\u0440\u043e\u0448\u043e:)<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/111\/335\/293\/1113352937acfaf580784b4c04ddbd38.jpg\" alt=\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432\" title=\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432\" width=\"1024\" height=\"768\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/111\/335\/293\/1113352937acfaf580784b4c04ddbd38.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/111\/335\/293\/1113352937acfaf580784b4c04ddbd38.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432<\/figcaption><\/div>\n<\/figure>\n<div class=\"floating-image\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f16\/d9d\/281\/f16d9d281e31e2b024bba0817921a12e.jpg\" alt=\"\u041a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u0438 \u043e\u0431\u0440\u0435\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\" title=\"\u041a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u0438 \u043e\u0431\u0440\u0435\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f\" width=\"600\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/f16\/d9d\/281\/f16d9d281e31e2b024bba0817921a12e.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/f16\/d9d\/281\/f16d9d281e31e2b024bba0817921a12e.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u0438 \u043e\u0431\u0440\u0435\u0437\u043a\u0430 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<div class=\"floating-image\">\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5ed\/4b4\/ee5\/5ed4b4ee576e20e51eb77760d2092c97.jpg\" alt=\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430 \u0438 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430\" title=\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430 \u0438 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430\" width=\"600\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5ed\/4b4\/ee5\/5ed4b4ee576e20e51eb77760d2092c97.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5ed\/4b4\/ee5\/5ed4b4ee576e20e51eb77760d2092c97.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430 \u0438 \u043e\u043a\u0440\u0443\u0436\u043d\u043e\u0441\u0442\u0438 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430<\/figcaption><\/div>\n<\/figure>\n<\/div>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e62\/e8a\/f4c\/e62e8af4cfef30f0b6a386641191b998.jpg\" alt=\"\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u0433\u043b\u0443 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0435\u043b\u043a\u0438\" title=\"\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u0433\u043b\u0443 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0435\u043b\u043a\u0438\" width=\"600\" height=\"600\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/e62\/e8a\/f4c\/e62e8af4cfef30f0b6a386641191b998.jpg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e62\/e8a\/f4c\/e62e8af4cfef30f0b6a386641191b998.jpg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption>\u041f\u043e\u0438\u0441\u043a \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u0433\u043b\u0443 \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0435\u043b\u043a\u0438<\/figcaption><\/div>\n<\/figure>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432 Xpenology<\/h2>\n<p>\u041e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0434\u0435\u043b\u043e \u0437\u0430 \u043c\u0430\u043b\u044b\u043c &#8212; \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c \u043d\u0430 NAS \u0430\u0432\u0442\u043e\u0437\u0430\u043f\u0443\u0441\u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u041f\u0430\u043d\u0435\u043b\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f, \u041f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a \u0437\u0430\u0434\u0430\u0447, \u0421\u043e\u0437\u0434\u0430\u0442\u044c, \u0417\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u0421\u043a\u0440\u0438\u043f\u0442 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c.<\/p>\n<p>\u0412\u043e \u0432\u043a\u043b\u0430\u0434\u043a\u0435 \u041e\u0431\u0449\u0438\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u0447\u0442\u043e \u0437\u0430\u0434\u0430\u0447\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f root. \u0420\u0430\u0441\u043f\u0438\u0441\u0430\u043d\u0438\u0435 &#8212; \u0435\u0436\u0435\u0434\u043d\u0435\u0432\u043d\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441. \u0412 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u0437\u0430\u0434\u0430\u0447 \u0432 \u043f\u043e\u043b\u0435 \u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c docker exec ID_\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 python3 \/app\/gauge_<a href=\"http:\/\/reader.py\" rel=\"noopener noreferrer nofollow\">reader.py<\/a>.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/de6\/aa3\/7c4\/de6aa37c44a84c8031ce2c44389aa3cb.png\" width=\"1065\" height=\"925\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/de6\/aa3\/7c4\/de6aa37c44a84c8031ce2c44389aa3cb.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/de6\/aa3\/7c4\/de6aa37c44a84c8031ce2c44389aa3cb.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<h2>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0437 \u0432 \u0447\u0430\u0441 HA \u0434\u0435\u043b\u0430\u0435\u0442 \u0444\u043e\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044e \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430 \u0438 \u043a\u043b\u0430\u0434\u0435\u0442 \u0435\u0435 \u0432 \u043f\u0430\u043f\u043a\u0443 NAS. \u0410 NAS \u0441\u043f\u0443\u0441\u0442\u044f \u043f\u044f\u0442\u044c \u043c\u0438\u043d\u0443\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0435\u0442 \u044d\u0442\u043e \u0434\u0435\u043b\u043e \u0448\u043b\u0451\u0442 \u0432 mqtt \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f.<\/p>\n<figure class=\"\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/954\/f46\/c28\/954f46c289cbc7570005947ff814e1b9.png\" width=\"382\" height=\"469\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/954\/f46\/c28\/954f46c289cbc7570005947ff814e1b9.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/954\/f46\/c28\/954f46c289cbc7570005947ff814e1b9.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0414\u0430, \u044f \u0432 \u043a\u0443\u0440\u0441\u0435, \u0447\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c DIY zigbee \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u044b. \u041c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u044f \u0441\u043e\u0431\u0435\u0440\u0443\u0441\u044c \u0441 \u043c\u044b\u0441\u043b\u044f\u043c\u0438, \u0432\u043e\u0437\u044c\u043c\u0443 \u043f\u0430\u044f\u043b\u044c\u043d\u0438\u043a \u0438 \u0432\u0440\u0435\u0436\u0443\u0441\u044c \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0438 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u0432\u043e\u0434\u043e\u0441\u043d\u0430\u0431\u0436\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u043a\u0440\u0430\u043d\u0430 \u043f\u043e\u0434\u043f\u0438\u0442\u043a\u0438 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043b\u0438\u0447\u0438\u044f \u0445\u043e\u043b\u043e\u0434\u043d\u043e\u0439 \u0432\u043e\u0434\u044b. \u041d\u043e \u043f\u043e\u043a\u0430 \u043f\u0443\u0441\u0442\u044c \u043f\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0442\u0430\u043a.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043d\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0430 Raspberry Pi? \u041f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u0437\u0430\u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c))<\/p>\n<p>\u0421\u0430\u043c\u0430 \u0438\u0434\u0435\u044f \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0434\u0432\u0443\u0445 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432 \u0432 \u0434\u043e\u043c\u0430\u0448\u043d\u0435\u0439 \u0441\u0435\u0442\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0430\u0441\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0439.<\/p>\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\/908238\/\"> https:\/\/habr.com\/ru\/articles\/908238\/<\/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>\u0414\u0430\u0432\u043d\u043e \u043c\u0443\u0447\u0430\u043b \u0432\u043e\u043f\u0440\u043e\u0441 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u0438\u0439 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f \u0441\u043e \u0448\u0442\u0430\u0442\u043d\u043e\u0433\u043e \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430 \u0433\u0430\u0437\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0442\u043b\u0430. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043b\u0435\u0442 \u043d\u0430\u0437\u0430\u0434 \u0431\u044b\u043b\u0430 \u043f\u0440\u0438\u043e\u0431\u0440\u0435\u0442\u0435\u043d\u0430 \u043a\u0430\u043c\u0435\u0440\u0430 ESP32-CAM \u0438 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432 Home Assistant \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c ESPHome.<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041a\u0430\u043c\u0435\u0440\u0443 \u044f \u043d\u0430\u043f\u0440\u0430\u0432\u0438\u043b \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u043b\u043e \u043c\u043d\u0435 \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u043e\u0442\u043e\u043f\u043b\u0435\u043d\u0438\u044f, \u0438, \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438, \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c \u043a\u0440\u0430\u043d \u043f\u043e\u0434\u0430\u0447\u0438 \u0432\u043e\u0434\u044b \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 (\u0442\u0430\u043a\u0436\u0435 \u0443\u0434\u0430\u043b\u0451\u043d\u043d\u043e).<\/p>\n<figure class=\"\">\n<div><figcaption>\u0428\u0442\u0430\u0442\u043d\u044b\u0439 \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 ESP32-CAM \u043f\u043e\u043c\u043e\u0433\u0430\u0435\u0442 \u0440\u0430\u0437\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440 \u0432 \u0437\u0430\u043a\u0440\u044b\u0442\u043e\u043c \u0448\u043a\u0430\u0444\u0443<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0445\u043e\u0442\u044c \u043a\u0430\u043a-\u0442\u043e \u043e\u0431\u043b\u0430\u0433\u043e\u0440\u043e\u0434\u0438\u0442\u044c \u044d\u0442\u043e\u0442 &#171;\u0430\u043d\u0430\u043b\u043e\u0433\u043e\u0432\u044b\u0439&#187; \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432 Node-RED \u0431\u044b\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044f, \u0437\u0430\u0432\u044f\u0437\u0430\u043d\u043d\u0430\u044f \u043d\u0430 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u044d\u043d\u0435\u0440\u0433\u043e\u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f \u043a\u043e\u0442\u043b\u0430 \u0438 \u043d\u0430\u0441\u043e\u0441\u043e\u0432:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u044d\u0442\u043e \u0442\u0430\u043a:<\/p>\n<ol start=\"2\">\n<li>\n<p>\u0412 \u0422\u0435\u043b\u0435\u0433\u0440\u0430\u043c \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u043a\u043e\u0442\u043b\u0430;<\/p>\n<\/li>\n<li>\n<p>\u042f \u043b\u0435\u0437\u0443 \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 HA \u0438 \u0432 \u043a\u0430\u043c\u0435\u0440\u0435 \u0441\u043c\u043e\u0442\u0440\u044e \u043a\u0430\u043a\u043e\u0435 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u0415\u0441\u043b\u0438 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043d\u0438\u0437\u043a\u043e\u0435 &#8212; \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e \u043a\u0440\u0430\u043d \u043f\u043e\u0434\u043f\u0438\u0442\u043a\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0423\u0436\u0435 \u043d\u0435\u043f\u043b\u043e\u0445\u043e, \u043d\u043e \u0440\u0443\u043a\u0438-\u0442\u043e \u0447\u0435\u0448\u0443\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b, \u0447\u0442\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435 \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0438 \u0432\u044b\u0432\u0435\u0441\u0442\u0438 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0432 HA \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0438\u0434\u0435.<\/p>\n<h2>\u0412\u044b\u0431\u043e\u0440 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043e\u0446\u0438\u0444\u0440\u043e\u0432\u043a\u0438<\/h2>\n<p>\u041f\u043e\u043c\u0438\u043c\u043e Raspberry Pi 4B, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0443 \u043c\u0435\u043d\u044f \u043a\u0440\u0443\u0442\u0438\u0442\u0441\u044f HA \u0443 \u043c\u0435\u043d\u044f \u0435\u0441\u0442\u044c \u0441\u0430\u043c\u043e\u0441\u0431\u043e\u0440\u043d\u044b\u0439 NAS c Xpenology \u043d\u0430 \u0431\u043e\u0440\u0442\u0443. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432 \u044d\u0442\u043e\u043c \u0434\u0435\u043b\u0435 \u0435\u0433\u043e.<\/p>\n<h2>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 Python \u0432 Xpenology<\/h2>\n<p>\u041f\u0435\u0440\u0432\u044b\u043c \u0434\u0435\u043b\u043e\u043c \u0432 Container Manager \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0437 Python 3-10-slim<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430:<\/p>\n<ol>\n<li>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c \u0432\u043a\u043b\u0430\u0434\u043a\u0443 \u041e\u0431\u0440\u0430\u0437\u044b, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c python \u0438 \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c;<\/p>\n<\/li>\n<li>\n<p>\u041a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0430 \u044d\u0442\u0430\u043f\u0435 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0442\u043e\u043c\u043e\u0432:<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043f\u0430\u043f\u043a\u0443<\/p>\n<\/li>\n<li>\n<p>\u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \/volume1\/docker\/gauge<\/p>\n<\/li>\n<li>\n<p>\u0412 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0435 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c: \/app<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p> \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u0414\u0430\u043b\u0435\u0435, \u043f\u043e\u0442\u043e\u043c \u041f\u0440\u0438\u043c\u0435\u043d\u0438\u0442\u044c<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\">\n<div><figcaption>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0442\u0430\u043a\u043e\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442<\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0434\u043e\u0441\u0442\u0443\u043f \u043a NAS \u043f\u043e SSH \u0432 \u043f\u0430\u043d\u0435\u043b\u0438 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0418 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043a \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Putty<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0412\u0432\u043e\u0434\u0438\u043c \u043b\u043e\u0433\u0438\u043d, \u043f\u0430\u0440\u043e\u043b\u044c, \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u043d\u0430 root, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c ID \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430:<\/p>\n<pre><code class=\"bash\">docker ps<\/code><\/pre>\n<p>\u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440:<\/p>\n<pre><code class=\"bash\">docker exec -it ID_\u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 bash<\/code><\/pre>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438:<\/p>\n<pre><code class=\"bash\">apt update &amp;&amp; apt install -y python3-pip libgl1 libglib2.0-0 apt-get install -y python3-pip python3-dev apt-get install -y libglib2.0-0 libsm6 libxext6 libxrender-dev apt-get install -y qt5-qmake qtbase5-dev-tools qtchooser apt-get install -y libx11-dev libgl1-mesa-glx libfontconfig1 libxkbcommon0 apt-get install -y libxcb-xinerama0 pip install opencv-python numpy pip3 install opencv-python matplotlib<\/code><\/pre>\n<p>\u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 gauge_<a href=\"http:\/\/reader.py\" rel=\"noopener noreferrer nofollow\">reader.py<\/a> \u0438 \u043a\u043b\u0430\u0434\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 docker\\gauge \u043d\u0430 NAS. \u041a \u043d\u0435\u043c\u0443 \u043c\u044b \u0432\u0435\u0440\u043d\u0435\u043c\u0441\u044f \u0447\u0443\u0442\u044c \u043f\u043e\u0437\u0436\u0435.<\/p>\n<h2>\u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 Home Assistant<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u044c \u0432 \u044d\u0442\u0443 \u0436\u0435 \u043f\u0430\u043f\u043a\u0443, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441\u0430\u043c\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ol>\n<li>\n<p>\u0412 HA \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0425\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0414\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0442\u0435\u0432\u043e\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u043f\u0443\u0442\u044c \u043a \u043f\u0430\u043f\u043a\u0435 docker \u043d\u0430 NAS:<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u044e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441 \u0432\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434 \u043d\u0430 ESP32-CAM, \u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043d\u0438\u043c\u043e\u043a, \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0442\u044c \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 gauge, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043c\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b\u0438 \u0448\u0430\u0433\u043e\u043c \u0432\u044b\u0448\u0435, \u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0434\u0438\u043e\u0434:<\/p>\n<pre><code class=\"yaml\">alias: ESP Cam snapshot \u043a\u0430\u0436\u0434\u044b\u0439 \u0447\u0430\u0441 description: \"\" triggers:   - minutes: 0     trigger: time_pattern actions:   - target:       entity_id: switch.pressure_boiler_flash_led     action: switch.turn_on     data: {}   - delay:       hours: 0       minutes: 0       seconds: 10       milliseconds: 0   - data:       entity_id: camera.pressure_boiler_my_camera       filename: \/media\/gauge\/sample.jpg     action: camera.snapshot   - delay:       hours: 0       minutes: 0       seconds: 10       milliseconds: 0   - target:       entity_id: switch.pressure_boiler_flash_led     action: switch.turn_off     data: {} mode: single <\/code><\/pre>\n<p>\u0418 \u0441\u0440\u0430\u0437\u0443 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0441\u0435\u043d\u0441\u043e\u0440, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u0438\u0441\u044b\u043b\u0430\u0442\u044c NAS \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0432\u0430\u043d\u0438\u044f \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f:<\/p>\n<pre><code class=\"yaml\">sensor:     - name: \"Boiler Pressure\"       state_topic: \"sensors\/boiler\/pressure\"       unit_of_measurement: \"bar\"       device_class: pressure       unique_id: pressure_boiler<\/code><\/pre>\n<h2>\u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430 \u0444\u043e\u0442\u043e<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0434\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u043a\u043e\u043b\u0434\u043e\u0432\u0430\u0442\u044c \u0441 \u0441\u0430\u043c\u0438\u043c \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u043c &#8212; \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u043e\u043c. \u0421\u043f\u0443\u0441\u0442\u044f \u043f\u0430\u0440\u0443 \u0434\u0435\u0441\u044f\u0442\u043a\u043e\u0432 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u043c \u044f \u043f\u0440\u0438\u0448\u0435\u043b \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0432\u0441\u0435 \u0443\u0445\u0438\u0449\u0440\u0435\u043d\u0438\u044f, \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0441\u043e 100% \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0440\u0430\u0441\u043f\u043e\u0437\u043d\u0430\u0442\u044c \u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043d\u0430\u043a\u043b\u0435\u0438\u043b \u0432\u043e\u043a\u0440\u0443\u0433 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0434\u043b\u044f \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e\u0439 \u043e\u0431\u0440\u0435\u0437\u043a\u0438 \u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u0438 \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0442\u0430\u043a:<\/p>\n<figure class=\"full-width\">\n<div><figcaption>ESP32-CAM \u0432 \u043b\u0435\u0433\u043e-\u043a\u0440\u043e\u043d\u0448\u0442\u0435\u0439\u043d\u0435. \u041d\u0430\u0434 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u043f\u0440\u0438\u043b\u0435\u043f\u0438\u043b \u0431\u0435\u043b\u044b\u0439 \u043b\u0438\u0441\u0442 \u0431\u0443\u043c\u0430\u0433\u0438, \u0442.\u043a. \u0440\u0435\u043b\u044c\u0435\u0444 \u043a\u043e\u0440\u043f\u0443\u0441\u0430 \u043a\u043e\u0442\u043b\u0430 \u0438\u043d\u043e\u0433\u0434\u0430 \u0432\u043d\u043e\u0441\u0438\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u043d\u0435\u0440\u0430\u0437\u0431\u0435\u0440\u0438\u0445\u0443 \u0432 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0443\u0433\u043b\u0430 \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u0430.<\/figcaption><\/div>\n<\/figure>\n<h2>\u041d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0441\u043a\u0440\u0438\u043f\u0442\u0430 (\u0445\u0432\u0430\u043b\u0430 \u043d\u0435\u0439\u0440\u043e\u0441\u0435\u0442\u044f\u043c!)<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043a\u0440\u0438\u043f\u0442\u0443. \u0417\u0430\u0434\u0430\u0447\u0443 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044e \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0448\u0430\u0433\u0438:<\/p>\n<ol>\n<li>\n<p>\u041e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0444\u043e\u0442\u043e \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a;<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u0443 &#8212; \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0432 \u043a\u0432\u0430\u0434\u0440\u0430\u0442 \u0438 \u043e\u0431\u0440\u0435\u0437\u0430\u0435\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435;<\/p>\n<\/li>\n<li>\n<p>\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0446\u0435\u043d\u0442\u0440 \u0438 \u0441\u0442\u0440\u0435\u043b\u043a\u0443 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043c\u0435\u0440\u044f\u0435\u043c \u0443\u0433\u043e\u043b \u043e\u0442\u043a\u043b\u043e\u043d\u0435\u043d\u0438\u044f \u0441\u0442\u0440\u0435\u043b\u043a\u0438 \u0438 \u043f\u043e \u0442\u0430\u0431\u043b\u0438\u0446\u0435 \u043a\u0430\u043b\u0438\u0431\u0440\u043e\u0432\u043a\u0438 \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u0438\u043c \u0443\u0433\u043e\u043b-\u0433\u0440\u0430\u0434\u0443\u0441\u044b \u0432 \u0434\u0430\u0432\u043b\u0435\u043d\u0438\u0435-\u0431\u0430\u0440\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0440\u0438\u0441\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u044d\u0442\u0430\u043f\u044b \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0441\u043a\u0440\u0438\u043f\u0442\u0430;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 mqtt HA.<\/p>\n<\/li>\n<\/ol>\n<pre><code class=\"python\">import cv2 import numpy as np import math import logging import paho.mqtt.client as mqtt from typing import Optional, Tuple, List  # \u041d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u043b\u043e\u0433\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__)  # \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f class Config:     MQTT_BROKER = \"192.168.1.****\"     MQTT_PORT = ****     MQTT_TOPIC = \"sensors\/boiler\/pressure\"     MQTT_USER = \"****\"     MQTT_PASS = \"****\"     MQTT_TIMEOUT = 5          CALIBRATION = {         215: 0.0,         155: 1.0,         90: 2.0,         29: 3.0,         327: 4.0     }          OUTPUT_DIR = '\/app\/'     OUTPUT_SIZE = 600     BLUR_SIZE = (5, 5)     ADAPTIVE_THRESH_BLOCK = 11     ADAPTIVE_THRESH_C = 2     HOUGH_CIRCLES_PARAMS = {         'dp': 1,         'minDist': 100,         'param1': 50,         'param2': 30,         'minRadius': 100,         'maxRadius': 200     }     HOUGH_LINES_PARAMS = {         'rho': 1,         'theta': np.pi\/180,         'threshold': 50,         'minLineLength': 150,         'maxLineGap': 10     }  def detect_quadrilateral(image: np.ndarray) -&gt; Tuple[Optional[List[Tuple[int, int]]], np.ndarray]:     \"\"\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u0433\u043b\u043e\u0432 \u0447\u0435\u0442\u044b\u0440\u0435\u0445\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a\u0430 \u0432\u043e\u043a\u0440\u0443\u0433 \u043c\u0430\u043d\u043e\u043c\u0435\u0442\u0440\u0430\"\"\"     gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)     _, thresh = cv2.threshold(gray, 50, 255, cv2.THRESH_BINARY_INV)          kernel = np.ones((5,5), np.uint8)     thresh = cv2.morphologyEx(thresh, cv2.MORPH_CLOSE, kernel)     thresh = cv2.morphologyEx(thresh, cv2.MORPH_OPEN, kernel)          contours, _ = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)          if not contours:         return None, image.copy()          largest_contour = max(contours, key=cv2.contourArea)     epsilon = 0.03 * cv2.arcLength(largest_contour, True)     approx = cv2.approxPolyDP(largest_contour, epsilon, True)          if len(approx) != 4:         for eps in [0.02, 0.04, 0.05]:             epsilon = eps * cv2.arcLength(largest_contour, True)             approx = cv2.approxPolyDP(largest_contour, epsilon, True)             if len(approx) == 4:                 break         else:             return None, image.copy()          points = np.array([point[0] for point in approx], dtype=np.float32)     center = np.mean(points, axis=0)          def sort_key(point):         return math.atan2(point[1] - center[1], point[0] - center[0])          sorted_points = sorted(points, key=sort_key, reverse=True)     bottom_idx = np.argmax([p[1] for p in sorted_points])     sorted_points = np.roll(sorted_points, -bottom_idx, axis=0)          if bottom_idx == 1:         sorted_points = np.roll(sorted_points, -1, axis=0)          corners = [tuple(map(int, p)) for p in sorted_points]          vis = image.copy()     for i, corner in enumerate(corners):         cv2.circle(vis, corner, 10, (0, 255, 0), -1)         cv2.putText(vis, f\"{i+1}\", (corner[0]+15, corner[1]+15),                     cv2.FONT_HERSHEY_SIMPLEX, 0.7, (0, 0, 255), 2)          for i in range(4):         cv2.line(vis, corners[i], corners[(i+1)%4], (255, 0, 0), 2)          return corners, vis  def correct_perspective(image: np.ndarray, corners: List[Tuple[int, int]]) -&gt; np.ndarray:     \"\"\"\u041a\u043e\u0440\u0440\u0435\u043a\u0446\u0438\u044f \u043f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u043d\u0430\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0443\u0433\u043b\u043e\u0432\"\"\"     size = Config.OUTPUT_SIZE     dst_points = np.array([         [0, size-1],         [size-1, size-1],         [size-1, 0],         [0, 0]     ], dtype=np.float32)          src_points = np.array(corners, dtype=np.float32)     matrix = cv2.getPerspectiveTransform(src_points, dst_points)     corrected = cv2.warpPerspective(image, matrix, (size, size))          return corrected  def enhance_image(image: np.ndarray, roi: Tuple[int, int, int, int]) -&gt; Tuple[np.ndarray, np.ndarray]:     \"\"\"\u0423\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0438 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u0440\u0435\u043b\u043a\u0438\"\"\"     x, y, w, h = roi     cropped = image[y:y+h, x:x+w]     gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY)     blurred = cv2.GaussianBlur(gray, Config.BLUR_SIZE, 0)     thresh = cv2.adaptiveThreshold(         blurred, 255, cv2.ADAPTIVE_THRESH_GAUSSIAN_C,         cv2.THRESH_BINARY_INV, Config.ADAPTIVE_THRESH_BLOCK, Config.ADAPTIVE_THRESH_C     )     return thresh, cropped  def find_dial_center(image: np.ndarray, roi: Tuple[int, int, int, int]) -&gt; Tuple[Tuple[int, int, int], np.ndarray]:     \"\"\"\u041e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0446\u0435\u043d\u0442\u0440\u0430 \u0446\u0438\u0444\u0435\u0440\u0431\u043b\u0430\u0442\u0430\"\"\"     x, y, w, h = roi     cropped = image[y:y+h, x:x+w]     gray = cv2.cvtColor(cropped, cv2.COLOR_BGR2GRAY)     vis = cropped.copy()          circles = cv2.HoughCircles(gray, cv2.HOUGH_GRADIENT, **Config.HOUGH_CIRCLES_PARAMS)          if circles is not None:         circles = np.uint16(np.around(circles))         best = circles[0][0]         cv2.circle(vis, (best[0], best[1]), best[2], (0, 255, 0), 2)         cv2.circle(vis, (best[0], best[1]), 2, (0, 0, 255), 3)         center_vis_path = f\"{Config.OUTPUT_DIR}center_detection.jpg\"         cv2.imwrite(center_vis_path, vis)         return (x + best[0], y + best[1], best[2]), vis          center = (x + w\/\/2, y + h\/\/2, min(w, h)\/\/2)     cv2.circle(vis, (w\/\/2, h\/\/2), min(w, h)\/\/2, (0, 255, 0), 2)     center_vis_path = f\"{Config.OUTPUT_DIR}center_detection.jpg\"     cv2.imwrite(center_vis_path, vis)     return center, vis  def find_arrow_angle(thresh: np.ndarray, original: np.ndarray,                      roi: Tuple[int, int, int, int],                      center_info: Tuple[int, int, int]) -&gt;<\/code><\/pre>\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-459130","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459130","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=459130"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/459130\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=459130"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=459130"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=459130"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}