{"id":474451,"date":"2025-09-10T09:00:58","date_gmt":"2025-09-10T09:00:58","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=474451"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=474451","title":{"rendered":"<span>\u00ab\u042f \u0438\u0433\u0440\u0430\u044e, \u043c\u0435\u043d\u044f \u043d\u0435 \u0431\u0435\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c!\u00bb. \u041a\u0430\u043a \u044f \u0441\u0442\u0430\u043b \u0437\u0430\u0436\u0438\u0433\u0430\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u0431\u043b\u043e On Air \u043f\u0440\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043a TeamSpeak<\/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<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ab4\/98a\/96f\/ab498a96f696bf8777f5044509b53d06.png\" width=\"940\" height=\"529\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ab4\/98a\/96f\/ab498a96f696bf8777f5044509b53d06.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ab4\/98a\/96f\/ab498a96f696bf8777f5044509b53d06.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043c\u044b \u0441 \u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0430\u043c\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0431\u0435\u0433\u043e\u0432 \u0432 \u0438\u0433\u0440\u0435 PUBG: Battlegrounds. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0441\u043a\u0432\u0430\u0434\u0430) \u0442\u0443\u0442 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0430\u0431\u0441\u043e\u043b\u044e\u0442, \u0438 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u044f \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u0436\u0438\u0432\u0430\u043d\u0438\u044f. \u0412 PUBG \u043d\u0435\u043b\u044c\u0437\u044f \u0440\u0430\u0441\u0441\u043b\u0430\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0438 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0427\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0441\u043b\u0443\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043f\u0435\u0440\u043d\u0438\u043a\u0430. \u041b\u044e\u0431\u043e\u0439 \u043f\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0437\u0432\u0443\u043a \u0432 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u043c\u0430\u0442\u0447 \u0432\u0441\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0438 \u0434\u043e\u043c\u043e\u0447\u0430\u0434\u0446\u044b \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u043c\u043d\u043e\u0439 \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0433\u0440\u044b, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u0431\u043b\u043e ON AIR, \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0442\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043d\u0430 \u0440\u0430\u0434\u0438\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044f\u0445 (\u0438 \u0434\u0430, \u043f\u043e\u0441\u043b\u0435 \u0442\u0430\u043a\u043e\u0439 \u043d\u0430\u0433\u043b\u043e\u0441\u0442\u0438 \u044f \u0434\u0430\u0436\u0435 \u0432\u044b\u0436\u0438\u043b). \u0417\u0430\u0434\u0443\u043c\u043a\u0430 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u0431\u043b\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0436\u0438\u0433\u0430\u043b\u043e\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0445\u043e\u0436\u0443\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 TeamSpeak, \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u0434\u0438\u0441\u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430. \u0427\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u2014 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/34a\/999\/e01\/34a999e01314e7d5237acfd707e4e8ac.png\" alt=\"\u0412\u043e\u0442 \u043e\u043d\u043e \u2014 \u0442\u0430\u0431\u043b\u043e\" title=\"\u0412\u043e\u0442 \u043e\u043d\u043e \u2014 \u0442\u0430\u0431\u043b\u043e\" width=\"940\" height=\"704\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/34a\/999\/e01\/34a999e01314e7d5237acfd707e4e8ac.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/34a\/999\/e01\/34a999e01314e7d5237acfd707e4e8ac.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0412\u043e\u0442 \u043e\u043d\u043e \u2014 \u0442\u0430\u0431\u043b\u043e<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u044f \u0440\u0430\u0437\u0434\u043e\u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u0431\u043b\u043e. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043c\u043e\u0440\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u043d\u043e\u043c, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u043c LED. \u0426\u0435\u043d\u0430 \u043d\u0430 \u0442\u0430\u043a\u0443\u044e \u0448\u0442\u0443\u043a\u0443 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u0435\u043b\u0438\u043a\u0430, \u043d\u043e \u0432\u043e\u0442 \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b, \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u0442\u043e\u043a \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e6\/5c8\/fbb\/5e65c8fbb01f33c35fb04df800ef8bd2.png\" alt=\"\u0422\u0435\u0441\u0442\u0435\u0440 \u0414\u044f\u0434\u044e\u0448\u043a\u0438 \u041b\u044f\u043e\" title=\"\u0422\u0435\u0441\u0442\u0435\u0440 \u0414\u044f\u0434\u044e\u0448\u043a\u0438 \u041b\u044f\u043e\" width=\"940\" height=\"704\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/5e6\/5c8\/fbb\/5e65c8fbb01f33c35fb04df800ef8bd2.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/5e6\/5c8\/fbb\/5e65c8fbb01f33c35fb04df800ef8bd2.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>\u0422\u0435\u0441\u0442\u0435\u0440 \u0414\u044f\u0434\u044e\u0448\u043a\u0438 \u041b\u044f\u043e<\/em><\/figcaption><\/div>\n<\/figure>\n<p>1,44 \u0410 \u2014 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u0440\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 RPI. \u0417\u0430\u043f\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0443\u0434\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u043b\u0435. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043b\u044e\u0434\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043a\u0443\u043f\u0430\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043d\u043e \u0436\u0434\u0430\u0442\u044c \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u0441 \u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u0430 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u041f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u0436\u0435 \u043b\u0435\u0436\u0430\u043b\u043e \u0440\u0435\u043b\u0435 TRJ-5VDC-SA-CD:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ab\/455\/c67\/2ab455c677f2ad5d133ca6dda74ad906.jpeg\" alt=\"TRJ-5VDC-SA-CD\" title=\"TRJ-5VDC-SA-CD\" width=\"752\" height=\"563\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/2ab\/455\/c67\/2ab455c677f2ad5d133ca6dda74ad906.jpeg 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/2ab\/455\/c67\/2ab455c677f2ad5d133ca6dda74ad906.jpeg 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<div><figcaption><em>TRJ-5VDC-SA-CD<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0430\u0442\u044c \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b 5 \u0412 40 \u043c\u0410 \u2014 \u0438 \u043e\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0434\u0432\u0435: GPIO Raspberry Pi \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c 3,3 V, \u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0434\u0430\u0442\u044c ~16 \u043c\u0410. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u0439 \u0433\u0440\u0435\u0431\u0435\u043d\u043a\u0435 \u0434\u0432\u0430 \u043f\u0438\u043d\u0430 5 V, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0432\u044b\u0434\u0430\u044e\u0442 \u0434\u043e 1\u20132 \u0410 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0431\u043b\u043e\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043b\u0430\u0442\u044b. \u0421\u0430\u043c\u043e \u0440\u0435\u043b\u0435 \u0434\u043b\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c 40\u201370 \u043c\u0410. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440.<\/p>\n<p>\u041f\u043b\u044e\u0441 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u043b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0443\u0448\u043a\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0432\u0430\u0440\u043d\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0435 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043c\u0430\u0433\u043d\u0438\u0442\u043d\u0443\u044e \u044d\u043d\u0435\u0440\u0433\u0438\u044e. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0437\u043a\u043e \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c \u0442\u043e\u043a \u2014 \u0438 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u043f\u043e\u0434\u0441\u043a\u043e\u0447\u0438\u0442\u044c \u0438 \u0432\u044b\u0436\u0435\u0447\u044c \u043d\u0430\u0444\u0438\u0433 \u043d\u0430\u0448 \u043d\u0435\u0436\u043d\u044b\u0439 GPIO (\u043f\u0440\u0438\u0432\u0435\u0442, \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u042d\u0414\u0421). \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0438\u043e\u0434\u0430. <\/p>\n<h2>\u0414\u0435\u043b\u0430\u044e \u0434\u0440\u0430\u0439\u0432\u0435\u0440<\/h2>\n<p>\u041f\u043e\u0440\u044b\u0432\u0448\u0438\u0441\u044c \u0432 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043a\u0430\u0445 \u0441 \u0440\u0430\u0434\u0438\u043e\u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 (\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0443\u0436\u0447\u0438\u043d\u044b \u0442\u0430\u043a\u0430\u044f \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f), \u044f \u043d\u0430\u0448\u0435\u043b NPN-\u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440 \u041a\u04223102 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 TO-92 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0435\u043c\u043d\u0438\u0435\u0432\u044b\u0439 \u0434\u0438\u043e\u0434 1N4148. \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e ~2,6 \u043c\u0410, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u0432\u0437\u044f\u043b \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440 \u043d\u0430 1\u043a\u03a9. <\/p>\n<p> \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u043e\u0431\u0440\u0430\u043b \u0441\u0445\u0435\u043c\u0443:<\/p>\n<ul>\n<li>\n<p>+5 V (pin 2) \u2014 \u0430\u043d\u043e\u0434 1N4148;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0442\u043e\u0434 1N4148 \u2014 \u043a\u0430\u0442\u0443\u0448\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0442\u0443\u0448\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u2014 \u044d\u043c\u0438\u0442\u0442\u0435\u0440 \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p>GPIO 17 (pin 11) \u2014 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440 \u2014 \u0431\u0430\u0437\u0430 \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p>GND (pin 6) \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0442\u043e\u0440 \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e5c\/ab0\/1e5\/e5cab01e5518bd330d47e37b6c49f6fc.png\" width=\"1194\" height=\"848\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/e5c\/ab0\/1e5\/e5cab01e5518bd330d47e37b6c49f6fc.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/e5c\/ab0\/1e5\/e5cab01e5518bd330d47e37b6c49f6fc.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0411\u044b\u0441\u0442\u0440\u043e \u0441\u043f\u0430\u044f\u043b \u043d\u0430\u0432\u0435\u0441\u043d\u044b\u043c \u043c\u043e\u043d\u0442\u0430\u0436\u043e\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u043a \u00ab\u043c\u0430\u043b\u0438\u043d\u043a\u0435\u00bb. \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b <a href=\"https:\/\/nodered.org\/\" rel=\"noopener noreferrer nofollow\">Node-Red<\/a> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<p><strong>$ bash &lt;(curl -sL https:\/\/github.com\/node-red\/linux-installers\/releases\/latest\/download\/update-nodejs-and-nodered-deb)<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u0441\u0442\u0430\u0440\u0442\u0430 Node-Red \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b:<br \/><strong>$ sudo systemctl enable nodered.service<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043b\u0435, \u043f\u043e\u0434\u0430\u0432\u0430\u044f 1 \u0438 0 \u043d\u0430 GPIO 17 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0448\u0442\u0430\u0442\u043d\u043e\u0439 \u043d\u043e\u0434\u044b <strong>Inject <\/strong>\u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 <strong>rpi-gpio out<\/strong>:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ee9\/8e6\/5c7\/ee98e65c7f9977caa059db09fcb0cd0d.png\" width=\"635\" height=\"363\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/ee9\/8e6\/5c7\/ee98e65c7f9977caa059db09fcb0cd0d.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/ee9\/8e6\/5c7\/ee98e65c7f9977caa059db09fcb0cd0d.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u043b\u0438\u043d \u043a\u043e\u043c\u043e\u043c \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0442\u0447\u0435\u0442\u043b\u0438\u0432\u043e\u0433\u043e \u0449\u0435\u043b\u0447\u043a\u0430 \u044f \u0443\u0441\u043b\u044b\u0448\u0430\u043b \u0435\u043b\u0435-\u0435\u043b\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0443\u044e \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \u041f\u043e\u043c\u0435\u0440\u044f\u043b \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u0440\u043e\u043c, \u0430 \u0442\u0430\u043c \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 2 V. \u0417\u043d\u0430\u0447\u0438\u0442, \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440 \u043d\u0435 \u0443\u0448\u0435\u043b \u0432 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435 \u0438 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u043b\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u043d\u043e\u043c\u0438\u043d\u0430\u043b \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u0430 (\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b 470\u03a9 \u0432\u043c\u0435\u0441\u0442\u043e 1\u043a\u03a9). \u0422\u043e\u043a \u0441 GPIO-\u043f\u0438\u043d\u0430 \u0432\u044b\u0440\u043e\u0441 \u0434\u043e ~5,6 \u043c\u0410 \u2014 \u0432\u043f\u043e\u043b\u043d\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u2014 \u0440\u0435\u043b\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h2>MQTT<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u0430 \u043f\u043e\u0440\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0440\u043e\u043a\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 Mosquitto \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e:<\/p>\n<p><strong>$ sudo apt install -y mosquitto mosquitto-clients<\/strong><\/p>\n<p>\u041a\u0430\u043a \u0438 Node-Red, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Mosquitto \u0432 \u0430\u0432\u0442\u043e\u0441\u0442\u0430\u0440\u0442:<\/p>\n<p><strong>$ sudo systemctl enable mosquitto<\/strong><\/p>\n<p>\u0412 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p><strong>$ sudo mosquitto_passwd -c \/etc\/mosquitto\/passwd nodered<\/strong><\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Mosquitto \u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <strong>\/etc\/mosquitto\/conf.d\/<\/strong>:<\/p>\n<p><strong>$ sudo nano \/etc\/mosquitto\/conf.d\/local.conf<\/strong><\/p>\n<p>\u041f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u043f\u043e\u0440\u0442, \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043c, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0444\u0430\u0439\u043b \u0441 \u0445\u0435\u0448\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044f:<\/p>\n<p><strong>listener 1883<\/strong><br \/><strong>allow_anonymous false<\/strong><br \/><strong>password_file \/etc\/mosquitto\/passwd<\/strong><\/p>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u0440\u043e\u043a\u0435\u0440:<\/p>\n<p><strong>$ sudo systemctl restart mosquitto<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Node-Red \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 MQTT. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u043d\u0430 Raspberry, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 <strong>127.0.0.1<\/strong> (\u0438\u043b\u0438 <a href=\"http:\/\/localhost\" rel=\"noopener noreferrer nofollow\">localhost<\/a>):<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/08b\/809\/3a8\/08b8093a870090ff878c1820b9aa3b10.png\" width=\"965\" height=\"515\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/08b\/809\/3a8\/08b8093a870090ff878c1820b9aa3b10.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/08b\/809\/3a8\/08b8093a870090ff878c1820b9aa3b10.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 <strong>Security<\/strong> \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0430\u0440\u043e\u043b\u044c <strong>nodered \/ password<\/strong>:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6a4\/87e\/2ae\/6a487e2ae09d4e81777fbf864887dcfe.png\" width=\"961\" height=\"516\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/6a4\/87e\/2ae\/6a487e2ae09d4e81777fbf864887dcfe.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/6a4\/87e\/2ae\/6a487e2ae09d4e81777fbf864887dcfe.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u0421\u043b\u0443\u0448\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043f\u0438\u043a. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 <strong>state<\/strong>:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa6\/6c1\/cce\/aa66c1ccee0b7c92decd21f957fd1f07.png\" width=\"831\" height=\"511\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/aa6\/6c1\/cce\/aa66c1ccee0b7c92decd21f957fd1f07.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/aa6\/6c1\/cce\/aa66c1ccee0b7c92decd21f957fd1f07.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0434\u044b MQTT \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438 <strong>Deploy <\/strong>\u0441\u043d\u0438\u0437\u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u044c connected:<\/p>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/182\/b00\/dde\/182b00dde5a84778d79c5c5930202415.png\" width=\"722\" height=\"331\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/182\/b00\/dde\/182b00dde5a84778d79c5c5930202415.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/182\/b00\/dde\/182b00dde5a84778d79c5c5930202415.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0435\u0449\u0435 \u0440\u0430\u0437, \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u043b\u0435, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u044b <strong>COM <\/strong>\u0438 <strong>NO <\/strong>(Normally Open) \u0432 \u0440\u0430\u0437\u0440\u044b\u0432 \u0436\u0438\u043b\u044b +5 V USB-\u043a\u0430\u0431\u0435\u043b\u044f. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 USB-\u0443\u0434\u043b\u0438\u043d\u0438\u0442\u0435\u043b\u044c \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0440\u0435\u0437\u0430\u0442\u044c \u0436\u0438\u043b\u0443. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0430\u043a \u043b\u044e\u0431\u044b\u043c USB-\u043f\u0440\u0438\u0431\u043e\u0440\u043e\u043c, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0442\u0430\u0431\u043b\u043e.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430. \u041f\u043e\u0434\u043d\u044f\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 Node-Red \u0441 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u043c Mosquitto, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0442\u043e\u043f\u0438\u043a\u0435 state \u0441 1 \u0438\u043b\u0438 0 \u0438 \u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0440\u0435\u043b\u0435 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 TeamSpeak \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 MQTT.<\/p>\n<h2>Soft<\/h2>\n<p>\u0423 TeamSpeak \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 ServerQuery:<\/p>\n<ol>\n<li>\n<p><strong>RAW <\/strong>(\u0447\u0438\u0442\u0430\u0439 Telnet) \u043d\u0430 10011.<\/p>\n<\/li>\n<li>\n<p><strong>SSH <\/strong>(\u0434\u0430-\u0434\u0430, \u043e\u043d \u0441\u0430\u043c\u044b\u0439) \u043d\u0430 10022.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0445\u043e\u0440\u043e\u0448 \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043e\u043a\u0435\u0442\u043e\u043c, \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u043f\u0440\u043e\u0447\u0438\u0435 \u0431\u0435\u0437\u0443\u043c\u0441\u0442\u0432\u0430. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u2014 SSH. \u0412\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 Python 3.11, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e \u043f\u0430\u0440\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 SSH (<a href=\"https:\/\/www.paramiko.org\/\" rel=\"noopener noreferrer nofollow\">paramiko<\/a>) \u0438 MQTT (<a href=\"https:\/\/pypi.org\/project\/paho-mqtt\/\" rel=\"noopener noreferrer nofollow\">paho-mqtt<\/a>).<\/p>\n<p><strong>$ sudo apt install python3-paho-mqtt python3-paramiko<\/strong><\/p>\n<p>\u041a\u043e\u0434, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 IDE, \u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u043c nano:<\/p>\n<p><strong>$ sudo nano ts3_presence_to_mqtt.py<\/strong><\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>import socket, time, sys from typing import Optional, Tuple import paho.mqtt.client as mqtt import paramiko  # ================== \u041d\u0410\u0421\u0422\u0420\u041e\u0419\u041a\u0418 ================== TS3_HOST = \"192.168.88.105\" TS3_PROTOCOL = \"ssh\" TS3_QUERY_PORT = 10022 TS3_LOGIN = \"serveradmin\" TS3_PASSWORD = \"CHANGE_ME\" TS3_SID = 1 TS3_TARGET_NICK = \"Test\"  MQTT_HOST = \"192.168.88.27\" MQTT_PORT = 1883 MQTT_USERNAME = \"nodered\" MQTT_PASSWORD = \"password\" MQTT_TOPIC = \"state\" MQTT_QOS = 1  CHECK_PERIOD_SEC = 1.0 CONNECT_TIMEOUT = 5.0 RECONNECT_DELAY_SEC = 3.0 # ===============================================  def ts3_unescape(s: str) -&gt; str:     rep = {r\"\\\\s\":\" \", r\"\\\\p\":\"|\", r\"\\\\\/\":\"\/\", r\"\\\\n\":\"\\n\", r\"\\\\r\":\"\\r\", r\"\\\\t\":\"\\t\", r\"\\\\v\":\"\\v\", r\"\\\\\\\\\":\"\\\\\"}     for k,v in rep.items(): s = s.replace(k,v)     return s  def parse_presence(payload: str, target_nick: str) -&gt; bool:     if not payload: return False     for rec in payload.split(\"|\"):         kv = {}         for part in rec.split():             if \"=\" in part:                 k,v = part.split(\"=\",1)                 kv[k] = ts3_unescape(v)         if kv.get(\"client_nickname\") == target_nick:             return True     return False  class TS3Raw:     def __init__(self, host, port, user, password, sid):         self.host, self.port, self.user, self.password, self.sid = host, port, user, password, sid         self.sock: Optional[socket.socket] = None      def _send(self, cmd: str):         self.sock.sendall((cmd.strip()+\"\\n\").encode())      def _read_until_ok(self) -&gt; Tuple[str, dict]:         self.sock.settimeout(CONNECT_TIMEOUT)         buf = b\"\"         while True:             chunk = self.sock.recv(4096)             if not chunk: raise ConnectionError(\"TS3 socket closed\")             buf += chunk             text = buf.decode(\"utf-8\",\"replace\")             if \"\\nerror \" in text or text.endswith(\"error \"):                 lines = text.strip().splitlines()                 if not lines or not lines[-1].startswith(\"error \"): continue                 err_line = lines[-1][6:]                 err = {}                 for p in err_line.split():                     if \"=\" in p:                         k,v = p.split(\"=\",1)                         err[k] = ts3_unescape(v)                 payload = \"\\n\".join(lines[:-1])                 return payload, err      def connect(self):         self.sock = socket.create_connection((self.host, self.port), timeout=CONNECT_TIMEOUT)         self.sock.settimeout(1.0)         try: _ = self.sock.recv(4096)         except Exception: pass         self._send(f\"login client_login_name={self.user} client_login_password={self.password}\")         _, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise PermissionError(f\"login failed: {err}\")         self._send(f\"use sid={self.sid}\")         _, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise RuntimeError(f\"use failed: {err}\")      def clientlist(self) -&gt; str:         self._send(\"clientlist\")         payload, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise RuntimeError(f\"clientlist failed: {err}\")         return payload      def close(self):         try:             if self.sock:                 try: self._send(\"quit\")                 except Exception: pass                 self.sock.close()         finally:             self.sock = None  class TS3SSH:     def __init__(self, host, port, user, password, sid):         self.host, self.port, self.user, self.password, self.sid = host, port, user, password, sid         self.ssh: Optional[paramiko.SSHClient] = None         self.chan: Optional[paramiko.Channel] = None         self.buf = \"\"      def connect(self):         self.ssh = paramiko.SSHClient()         self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())         self.ssh.connect(self.host, port=self.port, username=self.user, password=self.password, timeout=CONNECT_TIMEOUT, allow_agent=False, look_for_keys=False)         self.chan = self.ssh.invoke_shell(width=160, height=24)         self.chan.settimeout(CONNECT_TIMEOUT)         time.sleep(0.2)         self._drain()         self._send(f\"use sid={self.sid}\")         self._read_until_ok()      def _send(self, cmd: str):         self.chan.send((cmd.strip()+\"\\n\").encode())      def _drain(self):         try:             while self.chan.recv_ready():                 self.buf += self.chan.recv(4096).decode(\"utf-8\",\"replace\")         except Exception:             pass      def _read_until_ok(self) -&gt; Tuple[str, dict]:         deadline = time.time() + CONNECT_TIMEOUT         while time.time() &lt; deadline:             self._drain()             if \"\\nerror \" in self.buf:                 text = self.buf                 self.buf = \"\"                 lines = text.strip().splitlines()                 if not lines: continue                 idx = None                 for i in range(len(lines)-1, -1, -1):                     if lines[i].startswith(\"error \"):                         idx = i; break                 if idx is None: continue                 err_line = lines[idx][6:]                 err = {}                 for p in err_line.split():                     if \"=\" in p:                         k,v = p.split(\"=\",1)                         err[k] = ts3_unescape(v)                 payload = \"\\n\".join(lines[:idx])                 return payload, err             time.sleep(0.05)         raise TimeoutError(\"TS3 SSH read timeout\")      def clientlist(self) -&gt; str:         self._send(\"clientlist\")         payload, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise RuntimeError(f\"clientlist failed: {err}\")         return payload      def close(self):         try:             if self.chan:                  try: self._send(\"quit\")                 except Exception: pass                 self.chan.close()         finally:             if self.ssh:                 self.ssh.close()             self.chan = None             self.ssh = None  class MqttPublisher:     def __init__(self, host, port, username, password, topic, qos=1):         self.client = mqtt.Client()         if username: self.client.username_pw_set(username, password)         self.topic, self.qos = topic, qos         self.client.connect_async(host, port, keepalive=30)         self.client.loop_start()     def publish_state(self, v:int): self.client.publish(self.topic, str(v), qos=self.qos, retain=True)  def make_ts3():     if TS3_PROTOCOL == \"ssh\":         return TS3SSH(TS3_HOST, TS3_QUERY_PORT, TS3_LOGIN, TS3_PASSWORD, TS3_SID)     else:         return TS3Raw(TS3_HOST, TS3_QUERY_PORT, TS3_LOGIN, TS3_PASSWORD, TS3_SID)  def main():     ts3 = make_ts3()     mqtt_pub = MqttPublisher(MQTT_HOST, MQTT_PORT, MQTT_USERNAME, MQTT_PASSWORD, MQTT_TOPIC, MQTT_QOS)     last = None     while True:         try:             if isinstance(ts3, TS3Raw) and ts3.sock is None: ts3.connect()             if isinstance(ts3, TS3SSH) and ts3.chan is None: ts3.connect()             payload = ts3.clientlist()             value = 1 if parse_presence(payload, TS3_TARGET_NICK) else 0         except Exception as e:             sys.stderr.write(f\"[WARN] TS3 check failed: {e}\\n\")             value = 0             try: ts3.close()             except Exception: pass             time.sleep(RECONNECT_DELAY_SEC)         if value != last:             mqtt_pub.publish_state(value)             last = value         time.sleep(CHECK_PERIOD_SEC)  if __name__ == \"__main__\":     try: main()     except KeyboardInterrupt: pass<\/code><\/pre>\n<\/div>\n<\/details>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0444\u043e\u043d\u043e\u0432\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u043e\u0439:<\/p>\n<p><strong>$ python ts3_presence_to_mqtt.py &amp;<\/strong><\/p>\n<p>\u041a\u0430\u043a \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u0441\u044c \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 TeamSpeak \u0441 \u0438\u043c\u0435\u043d\u0435\u043c <strong>Test<\/strong>, \u0440\u0435\u043b\u0435 \u0449\u0435\u043b\u043a\u043d\u0435\u0442 \u0438 \u0442\u0430\u0431\u043b\u043e \u043d\u0435\u0437\u0430\u043c\u0435\u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0433\u043e\u0440\u0438\u0442\u0441\u044f. \u041d\u0443 \u0430 \u043f\u0440\u0438 \u0434\u0438\u0441\u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0435 \u2014 \u043f\u043e\u0442\u0443\u0445\u043d\u0435\u0442. \u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u0437\u043e\u0432\u043e, \u0430 \u0434\u0430\u043b\u0435\u0435 \u043e\u043d\u043e \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442 \u0441\u0442\u0430\u0442\u0443\u0441 \u043a\u0430\u0436\u0434\u0443\u044e \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c, \u0437\u0430\u043c\u0435\u043d\u0438\u0432 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <strong>CHECK_PERIOD_SEC<\/strong>.<\/p>\n<h2>\u0427\u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c<\/h2>\n<p>\u042d\u0442\u043e\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 DIY-\u043f\u0440\u043e\u0435\u043a\u0442 \u043e\u043a\u0430\u0437\u0430\u043b\u0441\u044f \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u043c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0449\u0435 \u0432\u0437\u044f\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0441 \u043e\u0434\u043d\u0438\u043c \u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u0440\u0435\u043b\u0435, \u043d\u043e \u0438 \u0441\u0430\u043c\u043e\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0431\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u043a\u043e\u0434 \u0432 \u0446\u0435\u043b\u043e\u043c \u0442\u043e\u0436\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u044b\u043c \u2014 \u043d\u0443\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e TS3 Server Query \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u0443\u0435\u0442 \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u044b, \u2014 \u0438 \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u00ab\u0434\u0435\u043a\u043e\u0434\u0435\u0440\u0430\u00bb. \u0414\u043b\u044f \u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e\u0433\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043b\u044e\u0431\u043e\u0433\u043e \u043e\u0442\u0432\u0435\u0442\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043f\u0430\u0440\u0441\u0438\u043d\u0433 \u0434\u043e \u0441\u0442\u0440\u043e\u043a\u0438 \u0432\u0438\u0434\u0430 <strong>error id=[\u043a\u043e\u0434] msg=[\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435]<\/strong>.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u0444\u043e\u0440\u0442\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a \u0441\u0435\u0440\u0432\u0435\u0440\u0443, \u0431\u044b\u043b \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u0432\u0441\u0435\u043c \u2014 \u043e\u0442 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0441 \u0447\u0442\u0435\u043d\u0438\u044f \u0431\u0430\u043d\u043d\u0435\u0440\u0430 \u043f\u0440\u0438\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u044f (\u043f\u0440\u0438 \u0435\u0433\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0438) \u0434\u043e \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e\u0433\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u0441 \u0437\u0430\u043a\u0440\u044b\u0442\u0438\u0435\u043c \u0441\u043e\u043a\u0435\u0442\u0430. \u0415\u0449\u0435 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 \u2014 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u0430\u044f \u043e\u0431\u0435\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 paho-mqtt \u0441 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435\u043c \u043a \u0431\u0440\u043e\u043a\u0435\u0440\u0443 \u0438 \u0444\u043e\u043d\u043e\u0432\u044b\u043c <strong>loop_start()<\/strong>, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043a\u043b\u0438\u0435\u043d\u0442 \u0441\u0430\u043c \u0434\u0435\u0440\u0436\u0438\u0442 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435 \u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 <strong>keepalive<\/strong>.<\/p>\n<p>\u041e\u0442 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043f\u043e\u043b\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 <strong>clientlist<\/strong>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0430\u0440\u0441\u0438\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <strong>parse_presence<\/strong>.<strong> <\/strong>\u0417\u0430\u043f\u0438\u0441\u0438 \u0442\u0430\u043c \u0438\u0434\u0443\u0442 \u0441 \u0440\u0430\u0437\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u00ab<strong>|<\/strong>\u00bb, \u0430 \u043a\u0430\u0436\u0434\u0430\u044f \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u043f\u0430\u0440\u0430 \u00ab<strong>\u043a\u043b\u044e\u0447=\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong>\u00bb \u0447\u0435\u0440\u0435\u0437 \u043f\u0440\u043e\u0431\u0435\u043b. \u0412 \u0438\u0442\u043e\u0433\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u0441\u043b\u043e\u0432\u0430\u0440\u044c \u043f\u043e\u043b\u0435\u0439, \u0441\u043d\u044f\u0442\u044c \u044d\u043a\u0440\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u043f\u0435\u0446\u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0435 \u043d\u0438\u043a\u043d\u0435\u0439\u043c\u0430 \u0438\u0437 \u00ab\u041d\u0430\u0441\u0442\u0440\u043e\u0435\u043a\u00bb \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u043c\u0443 \u043e\u0442\u0432\u0435\u0442\u0443. \u041d\u0430 \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u0438\u0438 \u044d\u0442\u043e\u0433\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c <strong>1<\/strong> \u0438\u043b\u0438 <strong>0<\/strong> \u043f\u043e MQTT.<\/p>\n<p><strong><em>\u041d\u0443 \u0447\u0442\u043e, \u043a\u0430\u043a \u0432\u0430\u043c \u0441\u0430\u043c\u043e\u0434\u0435\u043b\u043a\u0430? <\/em><\/strong><\/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\/945564\/\"> https:\/\/habr.com\/ru\/articles\/945564\/<\/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<figure class=\"full-width\"><\/figure>\n<p>\u0418\u043d\u043e\u0433\u0434\u0430 \u043c\u044b \u0441 \u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0430\u043c\u0438 \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0441\u044b\u0433\u0440\u0430\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0431\u0435\u0433\u043e\u0432 \u0432 \u0438\u0433\u0440\u0435 PUBG: Battlegrounds. \u0412\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u0430\u043c\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b (\u0441\u043a\u0432\u0430\u0434\u0430) \u0442\u0443\u0442 \u0432\u043e\u0437\u0432\u0435\u0434\u0435\u043d\u043e \u0432 \u0430\u0431\u0441\u043e\u043b\u044e\u0442, \u0438 \u0433\u043e\u043b\u043e\u0441\u043e\u0432\u0430\u044f \u043a\u043e\u043c\u043c\u0443\u043d\u0438\u043a\u0430\u0446\u0438\u044f \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u0430 \u0434\u043b\u044f \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u0433\u043e \u0432\u044b\u0436\u0438\u0432\u0430\u043d\u0438\u044f. \u0412 PUBG \u043d\u0435\u043b\u044c\u0437\u044f \u0440\u0430\u0441\u0441\u043b\u0430\u0431\u043b\u044f\u0442\u044c\u0441\u044f \u043d\u0438 \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443. \u0427\u0430\u0441\u0442\u0435\u043d\u044c\u043a\u043e \u0431\u044b\u0432\u0430\u044e\u0442 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0441\u043b\u0443\u0445 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043e\u043f\u0435\u0440\u043d\u0438\u043a\u0430. \u041b\u044e\u0431\u043e\u0439 \u043f\u043e\u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439 \u0437\u0432\u0443\u043a \u0432 \u0442\u0430\u043a\u043e\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0441\u043f\u043e\u0441\u043e\u0431\u0435\u043d \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442\u044c \u043c\u0430\u0442\u0447 \u0432\u0441\u0435\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u0435.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u043c\u0438\u043d\u0438\u043c\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u043a\u043e\u0433\u0434\u0430 \u043c\u043e\u0438 \u0434\u043e\u043c\u043e\u0447\u0430\u0434\u0446\u044b \u043f\u044b\u0442\u0430\u044e\u0442\u0441\u044f \u0441\u043e \u043c\u043d\u043e\u0439 \u0437\u0430\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0438\u0433\u0440\u044b, \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0441\u0432\u0435\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u0431\u043b\u043e ON AIR, \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u0442\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u043d\u0430 \u0440\u0430\u0434\u0438\u043e\u0441\u0442\u0430\u043d\u0446\u0438\u044f\u0445 (\u0438 \u0434\u0430, \u043f\u043e\u0441\u043b\u0435 \u0442\u0430\u043a\u043e\u0439 \u043d\u0430\u0433\u043b\u043e\u0441\u0442\u0438 \u044f \u0434\u0430\u0436\u0435 \u0432\u044b\u0436\u0438\u043b). \u0417\u0430\u0434\u0443\u043c\u043a\u0430 \u0431\u044b\u043b\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e\u0431\u044b \u0442\u0430\u0431\u043b\u043e \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0436\u0438\u0433\u0430\u043b\u043e\u0441\u044c, \u043a\u043e\u0433\u0434\u0430 \u044f \u043d\u0430\u0445\u043e\u0436\u0443\u0441\u044c \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435 TeamSpeak, \u0438 \u043e\u0442\u043a\u043b\u044e\u0447\u0430\u043b\u043e\u0441\u044c \u043f\u043e\u0441\u043b\u0435 \u0434\u0438\u0441\u043a\u043e\u043d\u043d\u0435\u043a\u0442\u0430. \u0427\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0443 \u043c\u0435\u043d\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u2014 \u0447\u0438\u0442\u0430\u0439\u0442\u0435 \u0434\u0430\u043b\u044c\u0448\u0435.<\/p>\n<figure class=\"full-width\">\n<div><figcaption><em>\u0412\u043e\u0442 \u043e\u043d\u043e \u2014 \u0442\u0430\u0431\u043b\u043e<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u044f \u0440\u0430\u0437\u0434\u043e\u0431\u044b\u043b \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0442\u0430\u0431\u043b\u043e. \u0420\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043c\u043e\u0440\u043e\u0447\u0438\u0442\u044c\u0441\u044f \u0441 \u043d\u0435\u043e\u043d\u043e\u043c, \u043d\u043e \u044f \u0440\u0435\u0448\u0438\u043b \u043e\u0431\u043e\u0439\u0442\u0438\u0441\u044c \u043e\u0431\u044b\u0447\u043d\u044b\u043c LED. \u0426\u0435\u043d\u0430 \u043d\u0430 \u0442\u0430\u043a\u0443\u044e \u0448\u0442\u0443\u043a\u0443 \u043d\u0435 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0432\u0435\u043b\u0438\u043a\u0430, \u043d\u043e \u0432\u043e\u0442 \u0441 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u043e\u0432\u043e\u0437\u0438\u0442\u044c\u0441\u044f. \u041f\u0435\u0440\u0432\u043e\u0435, \u0447\u0442\u043e \u044f \u0441\u0434\u0435\u043b\u0430\u043b, \u2014 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u0442\u043e\u043a \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u0435\u043d\u0438\u044f:<\/p>\n<figure class=\"full-width\">\n<div><figcaption><em>\u0422\u0435\u0441\u0442\u0435\u0440 \u0414\u044f\u0434\u044e\u0448\u043a\u0438 \u041b\u044f\u043e<\/em><\/figcaption><\/div>\n<\/figure>\n<p>1,44 \u0410 \u2014 \u044d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043c\u043d\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0431\u0440\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0441 RPI. \u0417\u0430\u043f\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043e\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430. \u0423\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0431\u0443\u0434\u0443 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0440\u0435\u043b\u0435. \u041d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u044b\u0435 \u043b\u044e\u0434\u0438 \u043e\u0431\u044b\u0447\u043d\u043e \u043f\u043e\u043a\u0443\u043f\u0430\u044e\u0442 \u0433\u043e\u0442\u043e\u0432\u044b\u0435 \u043c\u043e\u0434\u0443\u043b\u0438, \u043d\u043e \u0436\u0434\u0430\u0442\u044c \u0442\u0440\u0438 \u043d\u0435\u0434\u0435\u043b\u0438 \u0441 \u043c\u0430\u0440\u043a\u0435\u0442\u043f\u043b\u0435\u0439\u0441\u0430 \u043d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c. \u041f\u043e\u0434 \u0440\u0443\u043a\u043e\u0439 \u0436\u0435 \u043b\u0435\u0436\u0430\u043b\u043e \u0440\u0435\u043b\u0435 TRJ-5VDC-SA-CD:<\/p>\n<figure class=\"full-width\">\n<div><figcaption><em>TRJ-5VDC-SA-CD<\/em><\/figcaption><\/div>\n<\/figure>\n<p>\u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u0430\u0442\u044c \u043d\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u044e\u0449\u0438\u0435 \u043a\u043e\u043d\u0442\u0430\u043a\u0442\u044b 5 \u0412 40 \u043c\u0410 \u2014 \u0438 \u043e\u043d\u043e \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0434\u0432\u0435: GPIO Raspberry Pi \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435\u043c 3,3 V, \u0430 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c c \u0442\u0430\u043a\u043e\u0433\u043e \u043f\u0438\u043d\u0430 \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u0434\u0430\u0442\u044c ~16 \u043c\u0410. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043d\u0430 \u0441\u0430\u043c\u043e\u0439 \u0433\u0440\u0435\u0431\u0435\u043d\u043a\u0435 \u0434\u0432\u0430 \u043f\u0438\u043d\u0430 5 V, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e \u0444\u0430\u043a\u0442\u0443 \u0432\u044b\u0434\u0430\u044e\u0442 \u0434\u043e 1\u20132 \u0410 \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0431\u043b\u043e\u043a\u0430 \u043f\u0438\u0442\u0430\u043d\u0438\u044f \u0438 \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u0438 \u043f\u043b\u0430\u0442\u044b. \u0421\u0430\u043c\u043e \u0440\u0435\u043b\u0435 \u0434\u043b\u044f \u0443\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043b\u044f\u0442\u044c 40\u201370 \u043c\u0410. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u0440\u043e\u0441\u0442\u0435\u0439\u0448\u0438\u0439 \u0434\u0440\u0430\u0439\u0432\u0435\u0440.<\/p>\n<p>\u041f\u043b\u044e\u0441 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u0440\u0435\u043b\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u0430\u0442\u0443\u0448\u043a\u043e\u0439, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u043a\u043e\u0432\u0430\u0440\u043d\u043e\u0439 \u0444\u0438\u0437\u0438\u043a\u0435 \u043d\u0430\u043a\u0430\u043f\u043b\u0438\u0432\u0430\u0435\u0442 \u0432 \u0441\u0435\u0431\u0435 \u043c\u0430\u0433\u043d\u0438\u0442\u043d\u0443\u044e \u044d\u043d\u0435\u0440\u0433\u0438\u044e. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0435\u0437\u043a\u043e \u043e\u0431\u043e\u0440\u0432\u0430\u0442\u044c \u0442\u043e\u043a \u2014 \u0438 \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043d\u0430 \u0432\u044b\u0432\u043e\u0434\u0430\u0445 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e \u043f\u043e\u0434\u0441\u043a\u043e\u0447\u0438\u0442\u044c \u0438 \u0432\u044b\u0436\u0435\u0447\u044c \u043d\u0430\u0444\u0438\u0433 \u043d\u0430\u0448 \u043d\u0435\u0436\u043d\u044b\u0439 GPIO (\u043f\u0440\u0438\u0432\u0435\u0442, \u043e\u0431\u0440\u0430\u0442\u043d\u0430\u044f \u042d\u0414\u0421). \u0422\u0430\u043a \u0447\u0442\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u043e \u0437\u0430\u0449\u0438\u0442\u0435 \u0432 \u0432\u0438\u0434\u0435 \u0434\u0438\u043e\u0434\u0430. <\/p>\n<h2>\u0414\u0435\u043b\u0430\u044e \u0434\u0440\u0430\u0439\u0432\u0435\u0440<\/h2>\n<p>\u041f\u043e\u0440\u044b\u0432\u0448\u0438\u0441\u044c \u0432 \u043a\u043e\u0440\u043e\u0431\u043e\u0447\u043a\u0430\u0445 \u0441 \u0440\u0430\u0434\u0438\u043e\u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 (\u0443 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043c\u0443\u0436\u0447\u0438\u043d\u044b \u0442\u0430\u043a\u0430\u044f \u0441\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0435\u043c \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f), \u044f \u043d\u0430\u0448\u0435\u043b NPN-\u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440 \u041a\u04223102 \u0432 \u043a\u043e\u0440\u043f\u0443\u0441\u0435 TO-92 \u0438 \u0441\u0438\u0433\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u0440\u0435\u043c\u043d\u0438\u0435\u0432\u044b\u0439 \u0434\u0438\u043e\u0434 1N4148. \u0412\u043d\u0430\u0447\u0430\u043b\u0435 \u044f \u0440\u0430\u0441\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u043b, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u043b\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u044f \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430 \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e ~2,6 \u043c\u0410, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u043e \u0432\u0437\u044f\u043b \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440 \u043d\u0430 1\u043a\u03a9. <\/p>\n<p> \u0414\u0430\u043b\u044c\u0448\u0435 \u0441\u043e\u0431\u0440\u0430\u043b \u0441\u0445\u0435\u043c\u0443:<\/p>\n<ul>\n<li>\n<p>+5 V (pin 2) \u2014 \u0430\u043d\u043e\u0434 1N4148;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0442\u043e\u0434 1N4148 \u2014 \u043a\u0430\u0442\u0443\u0448\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u043a\u0430\u0442\u0443\u0448\u043a\u0430 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u2014 \u044d\u043c\u0438\u0442\u0442\u0435\u0440 \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p>GPIO 17 (pin 11) \u2014 \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440;<\/p>\n<\/li>\n<li>\n<p>\u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440 \u2014 \u0431\u0430\u0437\u0430 \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430;<\/p>\n<\/li>\n<li>\n<p>GND (pin 6) \u2014 \u043a\u043e\u043b\u043b\u0435\u043a\u0442\u043e\u0440 \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440\u0430.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><\/figure>\n<p>\u0411\u044b\u0441\u0442\u0440\u043e \u0441\u043f\u0430\u044f\u043b \u043d\u0430\u0432\u0435\u0441\u043d\u044b\u043c \u043c\u043e\u043d\u0442\u0430\u0436\u043e\u043c \u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043b \u043a \u00ab\u043c\u0430\u043b\u0438\u043d\u043a\u0435\u00bb. \u0427\u0442\u043e\u0431\u044b \u0431\u044b\u043b\u043e \u043f\u0440\u043e\u0449\u0435, \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043b <a href=\"https:\/\/nodered.org\/\" rel=\"noopener noreferrer nofollow\">Node-Red<\/a> \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u0432\u043e\u043b\u0448\u0435\u0431\u043d\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<p><strong>$ bash &lt;(curl -sL https:\/\/github.com\/node-red\/linux-installers\/releases\/latest\/download\/update-nodejs-and-nodered-deb)<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0430\u0432\u0442\u043e\u0441\u0442\u0430\u0440\u0442\u0430 Node-Red \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043b:<br \/><strong>$ sudo systemctl enable nodered.service<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0440\u0435\u043b\u0435, \u043f\u043e\u0434\u0430\u0432\u0430\u044f 1 \u0438 0 \u043d\u0430 GPIO 17 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0448\u0442\u0430\u0442\u043d\u043e\u0439 \u043d\u043e\u0434\u044b <strong>Inject <\/strong>\u0432 \u0441\u0432\u044f\u0437\u043a\u0435 \u0441 <strong>rpi-gpio out<\/strong>:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0431\u043b\u0438\u043d \u043a\u043e\u043c\u043e\u043c \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0442\u0447\u0435\u0442\u043b\u0438\u0432\u043e\u0433\u043e \u0449\u0435\u043b\u0447\u043a\u0430 \u044f \u0443\u0441\u043b\u044b\u0448\u0430\u043b \u0435\u043b\u0435-\u0435\u043b\u0435 \u0437\u0430\u043c\u0435\u0442\u043d\u0443\u044e \u043f\u043e\u043f\u044b\u0442\u043a\u0443. \u041f\u043e\u043c\u0435\u0440\u044f\u043b \u043d\u0430\u043f\u0440\u044f\u0436\u0435\u043d\u0438\u0435 \u043c\u0443\u043b\u044c\u0442\u0438\u043c\u0435\u0442\u0440\u043e\u043c, \u0430 \u0442\u0430\u043c \u0432\u0441\u0435\u0433\u043e \u043b\u0438\u0448\u044c 2 V. \u0417\u043d\u0430\u0447\u0438\u0442, \u0442\u0440\u0430\u043d\u0437\u0438\u0441\u0442\u043e\u0440 \u043d\u0435 \u0443\u0448\u0435\u043b \u0432 \u043d\u0430\u0441\u044b\u0449\u0435\u043d\u0438\u0435 \u0438 \u043d\u0435 \u043e\u0442\u043a\u0440\u044b\u043b\u0441\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043c\u0435\u043d\u0438\u043b \u043d\u043e\u043c\u0438\u043d\u0430\u043b \u0440\u0435\u0437\u0438\u0441\u0442\u043e\u0440\u0430 (\u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043b 470\u03a9 \u0432\u043c\u0435\u0441\u0442\u043e 1\u043a\u03a9). \u0422\u043e\u043a \u0441 GPIO-\u043f\u0438\u043d\u0430 \u0432\u044b\u0440\u043e\u0441 \u0434\u043e ~5,6 \u043c\u0410 \u2014 \u0432\u043f\u043e\u043b\u043d\u0435 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041f\u0440\u043e\u0432\u0435\u0440\u0438\u043b \u2014 \u0440\u0435\u043b\u0435 \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f.<\/p>\n<h2>MQTT<\/h2>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0448\u043b\u0430 \u043f\u043e\u0440\u0430 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u0431\u0440\u043e\u043a\u0435\u0440 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 Mosquitto \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0431\u0430\u0437\u043e\u0432\u0443\u044e \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e \u043f\u043e \u043b\u043e\u0433\u0438\u043d\u0443 \u0438 \u043f\u0430\u0440\u043e\u043b\u044e:<\/p>\n<p><strong>$ sudo apt install -y mosquitto mosquitto-clients<\/strong><\/p>\n<p>\u041a\u0430\u043a \u0438 Node-Red, \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c Mosquitto \u0432 \u0430\u0432\u0442\u043e\u0441\u0442\u0430\u0440\u0442:<\/p>\n<p><strong>$ sudo systemctl enable mosquitto<\/strong><\/p>\n<p>\u0412 \u043a\u043e\u043c\u043f\u043b\u0435\u043a\u0442\u0435 \u0435\u0441\u0442\u044c \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0442\u0430, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0430\u044f \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u043f\u0430\u0440\u043e\u043b\u044c \u0434\u043b\u044f \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f:<\/p>\n<p><strong>$ sudo mosquitto_passwd -c \/etc\/mosquitto\/passwd nodered<\/strong><\/p>\n<p>\u041f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e Mosquitto \u0447\u0438\u0442\u0430\u0435\u0442 \u043a\u043e\u043d\u0444\u0438\u0433\u0438 \u0432 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 <strong>\/etc\/mosquitto\/conf.d\/<\/strong>:<\/p>\n<p><strong>$ sudo nano \/etc\/mosquitto\/conf.d\/local.conf<\/strong><\/p>\n<p>\u041f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0442\u0443\u0434\u0430 \u043f\u043e\u0440\u0442, \u0437\u0430\u043f\u0440\u0435\u0449\u0430\u0435\u043c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u0431\u0435\u0437 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043c, \u0433\u0434\u0435 \u043b\u0435\u0436\u0438\u0442 \u0444\u0430\u0439\u043b \u0441 \u0445\u0435\u0448\u0435\u043c \u043f\u0430\u0440\u043e\u043b\u044f:<\/p>\n<p><strong>listener 1883<\/strong><br \/><strong>allow_anonymous false<\/strong><br \/><strong>password_file \/etc\/mosquitto\/passwd<\/strong><\/p>\n<p>\u041f\u0435\u0440\u0435\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433 \u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u0440\u043e\u043a\u0435\u0440:<\/p>\n<p><strong>$ sudo systemctl restart mosquitto<\/strong><\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u0432 \u0432\u0435\u0431-\u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Node-Red \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 MQTT. \u0412 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440. \u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043e \u043d\u0430 Raspberry, \u043f\u0440\u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0430\u0434\u0440\u0435\u0441 <strong>127.0.0.1<\/strong> (\u0438\u043b\u0438 <a href=\"http:\/\/localhost\" rel=\"noopener noreferrer nofollow\">localhost<\/a>):<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0432\u043a\u043b\u0430\u0434\u043a\u0443 <strong>Security<\/strong> \u0438 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u0430\u043c \u0440\u0430\u043d\u0435\u0435 \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u043f\u0430\u0440\u043e\u043b\u044c <strong>nodered \/ password<\/strong>:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0421\u043b\u0443\u0448\u0430\u0442\u044c \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u0442\u043e\u043f\u0438\u043a. \u041d\u0430\u0437\u043e\u0432\u0435\u043c \u0435\u0433\u043e \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 <strong>state<\/strong>:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0435\u0440\u0435\u0434\u0435\u043b\u044b\u0432\u0430\u0435\u043c \u0442\u0435\u0441\u0442\u043e\u0432\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u2014 \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0440\u044f\u043c\u043e\u0433\u043e \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u044f \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0434\u044b MQTT \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u043e\u0441\u0440\u0435\u0434\u043d\u0438\u043a\u0430. \u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043a\u043d\u043e\u043f\u043a\u0438 <strong>Deploy <\/strong>\u0441\u043d\u0438\u0437\u0443 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0430\u043a\u0442\u0443\u0430\u043b\u044c\u043d\u044b\u0439 \u0441\u0442\u0430\u0442\u0443\u0441. \u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0430\u0434\u043f\u0438\u0441\u044c connected:<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u0438\u0432 \u0435\u0449\u0435 \u0440\u0430\u0437, \u0447\u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0430 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0440\u0435\u043b\u0435, \u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432\u044b\u0432\u043e\u0434\u044b <strong>COM <\/strong>\u0438 <strong>NO <\/strong>(Normally Open) \u0432 \u0440\u0430\u0437\u0440\u044b\u0432 \u0436\u0438\u043b\u044b +5 V USB-\u043a\u0430\u0431\u0435\u043b\u044f. \u041f\u0440\u043e\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u0437\u044f\u0442\u044c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 USB-\u0443\u0434\u043b\u0438\u043d\u0438\u0442\u0435\u043b\u044c \u0438 \u0438\u043c\u0435\u043d\u043d\u043e \u0443 \u043d\u0435\u0433\u043e \u043f\u0435\u0440\u0435\u0440\u0435\u0437\u0430\u0442\u044c \u0436\u0438\u043b\u0443. \u042d\u0442\u043e \u0434\u0430\u0441\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0442\u0430\u043a \u043b\u044e\u0431\u044b\u043c USB-\u043f\u0440\u0438\u0431\u043e\u0440\u043e\u043c, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0442\u0430\u0431\u043b\u043e.<\/p>\n<p>\u0418\u0442\u0430\u043a, \u043f\u0435\u0440\u0432\u0430\u044f \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0430. \u041f\u043e\u0434\u043d\u044f\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 Node-Red \u0441 \u0431\u0440\u043e\u043a\u0435\u0440\u043e\u043c Mosquitto, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0436\u0438\u0434\u0430\u0435\u0442 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f \u0432 \u0442\u043e\u043f\u0438\u043a\u0435 state \u0441 1 \u0438\u043b\u0438 0 \u0438 \u0434\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u043d\u0430 \u0440\u0435\u043b\u0435 \u0434\u043b\u044f \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u0442\u0430\u0431\u043b\u043e. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0440\u0430 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u0441\u0435\u0440\u0432\u0435\u0440\u0430 TeamSpeak \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 MQTT.<\/p>\n<h2>Soft<\/h2>\n<p>\u0423 TeamSpeak \u0435\u0441\u0442\u044c \u0434\u0432\u0430 \u0440\u0435\u0436\u0438\u043c\u0430 ServerQuery:<\/p>\n<ol>\n<li>\n<p><strong>RAW <\/strong>(\u0447\u0438\u0442\u0430\u0439 Telnet) \u043d\u0430 10011.<\/p>\n<\/li>\n<li>\n<p><strong>SSH <\/strong>(\u0434\u0430-\u0434\u0430, \u043e\u043d \u0441\u0430\u043c\u044b\u0439) \u043d\u0430 10022.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0435\u0440\u0432\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0445\u043e\u0440\u043e\u0448 \u0442\u0435\u043c, \u0447\u0442\u043e \u0442\u0443\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0442\u044c\u0441\u044f \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u0441\u043e\u043a\u0435\u0442\u043e\u043c, \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043f\u0438\u0441\u0430\u0442\u044c \u0441\u0442\u0440\u043e\u043a\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0432\u044b\u0442\u0432\u043e\u0440\u044f\u0442\u044c \u043f\u0440\u043e\u0447\u0438\u0435 \u0431\u0435\u0437\u0443\u043c\u0441\u0442\u0432\u0430. \u0410\u043b\u044c\u0442\u0435\u0440\u043d\u0430\u0442\u0438\u0432\u0430 \u2014 SSH. \u0412\u0441\u0435 \u0442\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u041f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0430 Python 3.11, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e \u043f\u0430\u0440\u0443 \u043f\u0430\u043a\u0435\u0442\u043e\u0432 \u0441 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c\u0438 SSH (<a href=\"https:\/\/www.paramiko.org\/\" rel=\"noopener noreferrer nofollow\">paramiko<\/a>) \u0438 MQTT (<a href=\"https:\/\/pypi.org\/project\/paho-mqtt\/\" rel=\"noopener noreferrer nofollow\">paho-mqtt<\/a>).<\/p>\n<p><strong>$ sudo apt install python3-paho-mqtt python3-paramiko<\/strong><\/p>\n<p>\u041a\u043e\u0434, \u0440\u0430\u0437\u0443\u043c\u0435\u0435\u0442\u0441\u044f, \u043f\u0438\u0441\u0430\u043b\u0441\u044f \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0439 IDE, \u043d\u043e \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u043e\u043c nano:<\/p>\n<p><strong>$ sudo nano ts3_presence_to_mqtt.py<\/strong><\/p>\n<details class=\"spoiler\">\n<summary>\u041f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u0434:<\/summary>\n<div class=\"spoiler__content\">\n<pre><code>import socket, time, sys from typing import Optional, Tuple import paho.mqtt.client as mqtt import paramiko  # ================== \u041d\u0410\u0421\u0422\u0420\u041e\u0419\u041a\u0418 ================== TS3_HOST = \"192.168.88.105\" TS3_PROTOCOL = \"ssh\" TS3_QUERY_PORT = 10022 TS3_LOGIN = \"serveradmin\" TS3_PASSWORD = \"CHANGE_ME\" TS3_SID = 1 TS3_TARGET_NICK = \"Test\"  MQTT_HOST = \"192.168.88.27\" MQTT_PORT = 1883 MQTT_USERNAME = \"nodered\" MQTT_PASSWORD = \"password\" MQTT_TOPIC = \"state\" MQTT_QOS = 1  CHECK_PERIOD_SEC = 1.0 CONNECT_TIMEOUT = 5.0 RECONNECT_DELAY_SEC = 3.0 # ===============================================  def ts3_unescape(s: str) -&gt; str:     rep = {r\"\\\\s\":\" \", r\"\\\\p\":\"|\", r\"\\\\\/\":\"\/\", r\"\\\\n\":\"\\n\", r\"\\\\r\":\"\\r\", r\"\\\\t\":\"\\t\", r\"\\\\v\":\"\\v\", r\"\\\\\\\\\":\"\\\\\"}     for k,v in rep.items(): s = s.replace(k,v)     return s  def parse_presence(payload: str, target_nick: str) -&gt; bool:     if not payload: return False     for rec in payload.split(\"|\"):         kv = {}         for part in rec.split():             if \"=\" in part:                 k,v = part.split(\"=\",1)                 kv[k] = ts3_unescape(v)         if kv.get(\"client_nickname\") == target_nick:             return True     return False  class TS3Raw:     def __init__(self, host, port, user, password, sid):         self.host, self.port, self.user, self.password, self.sid = host, port, user, password, sid         self.sock: Optional[socket.socket] = None      def _send(self, cmd: str):         self.sock.sendall((cmd.strip()+\"\\n\").encode())      def _read_until_ok(self) -&gt; Tuple[str, dict]:         self.sock.settimeout(CONNECT_TIMEOUT)         buf = b\"\"         while True:             chunk = self.sock.recv(4096)             if not chunk: raise ConnectionError(\"TS3 socket closed\")             buf += chunk             text = buf.decode(\"utf-8\",\"replace\")             if \"\\nerror \" in text or text.endswith(\"error \"):                 lines = text.strip().splitlines()                 if not lines or not lines[-1].startswith(\"error \"): continue                 err_line = lines[-1][6:]                 err = {}                 for p in err_line.split():                     if \"=\" in p:                         k,v = p.split(\"=\",1)                         err[k] = ts3_unescape(v)                 payload = \"\\n\".join(lines[:-1])                 return payload, err      def connect(self):         self.sock = socket.create_connection((self.host, self.port), timeout=CONNECT_TIMEOUT)         self.sock.settimeout(1.0)         try: _ = self.sock.recv(4096)         except Exception: pass         self._send(f\"login client_login_name={self.user} client_login_password={self.password}\")         _, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise PermissionError(f\"login failed: {err}\")         self._send(f\"use sid={self.sid}\")         _, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise RuntimeError(f\"use failed: {err}\")      def clientlist(self) -&gt; str:         self._send(\"clientlist\")         payload, err = self._read_until_ok()         if err.get(\"id\") != \"0\": raise RuntimeError(f\"clientlist failed: {err}\")         return payload      def close(self):         try:             if self.sock:                 try: self._send(\"quit\")                 except Exception: pass                 self.sock.close()         finally:             self.sock = None  class TS3SSH:     def __init__(self, host, port, user, password, sid):         self.host, self.port, self.user, self.password, self.sid = host, port, user, password, sid         self.ssh: Optional[paramiko.SSHClient] = None         self.chan: Optional[paramiko.Channel] = None         self.buf = \"\"      def connect(self):         self.ssh = paramiko.SSHClient()         self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())         self.ssh.connect(self.host, port=self.port, username=self.user, password=self.password, timeout=CONNECT_TIMEOUT, allow_agent=False, look_for_keys=False)  <\/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-474451","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/474451","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=474451"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/474451\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=474451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=474451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=474451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}