{"id":2176,"date":"2024-12-17T12:23:24","date_gmt":"2024-12-17T12:23:24","guid":{"rendered":"https:\/\/oimi.me\/?p=2176"},"modified":"2024-12-17T12:23:24","modified_gmt":"2024-12-17T12:23:24","slug":"%e5%b0%8f%e7%b1%b3%e5%ae%98%e6%96%b9%e5%8f%91%e5%b8%83%e3%80%8c%e7%b1%b3%e5%ae%b6%e9%9b%86%e6%88%90%e3%80%8d%ef%bc%8c%e5%8f%af%e5%9c%a8-home-assistant-%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%b1%b3-iot","status":"publish","type":"post","link":"https:\/\/myya.net\/index.php\/2024\/12\/17\/%e5%b0%8f%e7%b1%b3%e5%ae%98%e6%96%b9%e5%8f%91%e5%b8%83%e3%80%8c%e7%b1%b3%e5%ae%b6%e9%9b%86%e6%88%90%e3%80%8d%ef%bc%8c%e5%8f%af%e5%9c%a8-home-assistant-%e4%b8%ad%e4%bd%bf%e7%94%a8%e5%b0%8f%e7%b1%b3-iot\/","title":{"rendered":"\u5c0f\u7c73\u5b98\u65b9\u53d1\u5e03\u300c\u7c73\u5bb6\u96c6\u6210\u300d\uff0c\u53ef\u5728 Home Assistant \u4e2d\u4f7f\u7528\u5c0f\u7c73 IoT \u667a\u80fd\u8bbe\u5907"},"content":{"rendered":"<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u662f\u4e00\u4e2a\u7531\u5c0f\u7c73\u5b98\u65b9\u63d0\u4f9b\u652f\u6301\u7684 Home Assistant \u7684\u96c6\u6210\u7ec4\u4ef6\uff0c\u5b83\u53ef\u4ee5\u8ba9\u60a8\u5728 Home Assistant \u4e2d\u4f7f\u7528\u5c0f\u7c73 IoT \u667a\u80fd\u8bbe\u5907\u3002<!--more--><\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u5b89\u88c5<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<blockquote>\n<p dir=\"auto\">Home Assistant \u7248\u672c\u8981\u6c42\uff1a<\/p>\n<ul dir=\"auto\">\n<li>Core \u2265 2024.11.0<\/li>\n<li>Operating System \u2265 13.0<\/li>\n<\/ul>\n<\/blockquote>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u65b9\u6cd5 1\uff1a\u4f7f\u7528 git clone \u547d\u4ee4\u4ece GitHub \u4e0b\u8f7d<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\">\n<pre><span class=\"pl-c1\">cd<\/span> config\ngit clone https:\/\/github.com\/XiaoMi\/ha_xiaomi_home.git\n<span class=\"pl-c1\">cd<\/span> ha_xiaomi_home\n.\/install.sh \/config<\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">\u63a8\u8350\u4f7f\u7528\u6b64\u65b9\u6cd5\u5b89\u88c5\u7c73\u5bb6\u96c6\u6210\u3002\u5f53\u60a8\u60f3\u8981\u66f4\u65b0\u81f3\u7279\u5b9a\u7248\u672c\u65f6\uff0c\u53ea\u9700\u8981\u5207\u6362\u81f3\u76f8\u5e94\u7684 Tag \u3002<\/p>\n<p dir=\"auto\">\u4f8b\u5982\uff0c\u66f4\u65b0\u7c73\u5bb6\u96c6\u6210\u7248\u672c\u81f3 v1.0.0<\/p>\n<div class=\"highlight highlight-source-shell notranslate position-relative overflow-auto\" dir=\"auto\">\n<pre><span class=\"pl-c1\">cd<\/span> config\/ha_xiaomi_home\ngit checkout v1.0.0\n.\/install.sh \/config<\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u65b9\u6cd5 2: <a href=\"https:\/\/hacs.xyz\/\" rel=\"nofollow\">HACS<\/a><\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">HACS &gt; Overflow Menu &gt; Custom repositories &gt; Repository: <a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home.git\">https:\/\/github.com\/XiaoMi\/ha_xiaomi_home.git<\/a> &amp; Category: Integration &gt; ADD<\/p>\n<blockquote>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u6682\u672a\u6dfb\u52a0\u5230 HACS \u5546\u5e97\uff0c\u656c\u8bf7\u671f\u5f85\u3002<\/p>\n<\/blockquote>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u65b9\u6cd5 3\uff1a\u901a\u8fc7 <a href=\"https:\/\/github.com\/home-assistant\/addons\/tree\/master\/samba\">Samba<\/a> \u6216 <a href=\"https:\/\/github.com\/hassio-addons\/addon-ftp\">FTPS<\/a> \u624b\u52a8\u5b89\u88c5<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u4e0b\u8f7d\u5e76\u5c06 <code>custom_components\/xiaomi_home<\/code> \u6587\u4ef6\u5939\u590d\u5236\u5230 Home Assistant \u7684 <code>config\/custom_components<\/code> \u6587\u4ef6\u5939\u4e0b\u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u914d\u7f6e<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u767b\u5f55<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\"><a href=\"https:\/\/my.home-assistant.io\/redirect\/brand\/?brand=xiaomi_home\" rel=\"nofollow\">\u8bbe\u7f6e &gt; \u8bbe\u5907\u4e0e\u670d\u52a1 &gt; \u6dfb\u52a0\u96c6\u6210<\/a> &gt; \u641c\u7d22\u201c<code>Xiaomi Home<\/code>\u201d &gt; \u4e0b\u4e00\u6b65 &gt; \u8bf7\u70b9\u51fb\u6b64\u5904\u8fdb\u884c\u767b\u5f55 &gt; \u4f7f\u7528\u5c0f\u7c73\u8d26\u53f7\u767b\u5f55<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u6dfb\u52a0 MIoT \u8bbe\u5907<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u767b\u5f55\u6210\u529f\u540e\uff0c\u4f1a\u5f39\u51fa\u4f1a\u8bdd\u6846\u201c\u9009\u62e9\u5bb6\u5ead\u4e0e\u8bbe\u5907\u201d\u3002\u60a8\u53ef\u4ee5\u9009\u62e9\u9700\u8981\u6dfb\u52a0\u7684\u7c73\u5bb6\u5bb6\u5ead\uff0c\u8be5\u5bb6\u5ead\u5185\u7684\u6240\u6709\u8bbe\u5907\u5c06\u5bfc\u5165 Home Assistant \u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u591a\u8d26\u53f7\u767b\u5f55<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u7528\u4e00\u4e2a\u5c0f\u7c73\u8d26\u53f7\u767b\u5f55\u5e76\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u60a8\u53ef\u4ee5\u5728 Xiaomi Home Integration \u9875\u9762\u4e2d\u7ee7\u7eed\u6dfb\u52a0\u5176\u4ed6\u5c0f\u7c73\u8d26\u53f7\u3002<\/p>\n<p dir=\"auto\">\u65b9\u6cd5\uff1a<a href=\"https:\/\/my.home-assistant.io\/redirect\/integration\/?domain=xiaomi_home\" rel=\"nofollow\">\u8bbe\u7f6e &gt; \u8bbe\u5907\u4e0e\u670d\u52a1 &gt; \u5df2\u914d\u7f6e &gt; Xiaomi Home<\/a> &gt; \u6dfb\u52a0\u4e2d\u67a2 &gt; \u4e0b\u4e00\u6b65 &gt; \u8bf7\u70b9\u51fb\u6b64\u5904\u8fdb\u884c\u767b\u5f55 &gt; \u4f7f\u7528\u5c0f\u7c73\u8d26\u53f7\u767b\u5f55<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u4fee\u6539\u914d\u7f6e\u9879<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u5728\u4f1a\u8bdd\u6846\u201c\u914d\u7f6e\u9009\u9879\u201d\u4e2d\uff0c\u53ef\u9009\u62e9\u9700\u8981\u53d8\u66f4\u7684\u914d\u7f6e\u9879\u3002\u60a8\u53ef\u4ee5\u4fee\u6539\u7528\u6237\u6635\u79f0\u6216\u66f4\u65b0\u4ece\u7c73\u5bb6 APP \u5bfc\u5165\u7684\u8bbe\u5907\u5217\u8868\u3002<\/p>\n<p dir=\"auto\">\u65b9\u6cd5\uff1a<a href=\"https:\/\/my.home-assistant.io\/redirect\/integration\/?domain=xiaomi_home\" rel=\"nofollow\">\u8bbe\u7f6e &gt; \u8bbe\u5907\u4e0e\u670d\u52a1 &gt; \u5df2\u914d\u7f6e &gt; Xiaomi Home<\/a> &gt; \u914d\u7f6e &gt; \u9009\u62e9\u9700\u8981\u53d8\u66f4\u7684\u914d\u7f6e\u9879<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">Action \u8c03\u8bd5\u6a21\u5f0f<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u5f00\u542f\u8be5\u6a21\u5f0f\u540e\uff0c\u60a8\u53ef\u624b\u52a8\u5411\u8bbe\u5907\u53d1\u9001\u5e26\u53c2\u6570\u7684 Action \u63a7\u5236\u6307\u4ee4\u3002\u53d1\u9001\u5e26\u53c2\u6570\u7684 Action \u63a7\u5236\u6307\u4ee4\u7684\u7528\u6237\u5165\u53e3\u663e\u793a\u4e3a\u4e00\u4e2a\u6587\u672c\u5b9e\u4f53\u3002<\/p>\n<p dir=\"auto\">\u65b9\u6cd5\uff1a<a href=\"https:\/\/my.home-assistant.io\/redirect\/integration\/?domain=xiaomi_home\" rel=\"nofollow\">\u8bbe\u7f6e &gt; \u8bbe\u5907\u4e0e\u670d\u52a1 &gt; \u5df2\u914d\u7f6e &gt; Xiaomi Home<\/a> &gt; \u914d\u7f6e &gt; Action \u8c03\u8bd5\u6a21\u5f0f<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u5b89\u5168\u6027<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u53ca\u5176\u4f7f\u7528\u7684\u4e91\u7aef\u63a5\u53e3\u7531\u5c0f\u7c73\u5b98\u65b9\u63d0\u4f9b\u3002\u60a8\u9700\u8981\u4f7f\u7528\u5c0f\u7c73\u8d26\u53f7\u767b\u5f55\u4ee5\u83b7\u53d6\u8bbe\u5907\u5217\u8868\u3002\u7c73\u5bb6\u96c6\u6210\u4f7f\u7528 OAuth 2.0 \u7684\u767b\u5f55\u65b9\u5f0f\uff0c\u4e0d\u4f1a\u5728 Home Assistant \u4e2d\u4fdd\u5b58\u60a8\u7684\u5c0f\u7c73\u8d26\u53f7\u5bc6\u7801\u3002\u4f46\u7531\u4e8e Home Assistant \u5e73\u53f0\u7684\u9650\u5236\uff0c\u767b\u5f55\u6210\u529f\u540e\uff0c\u60a8\u7684\u5c0f\u7c73\u7528\u6237\u4fe1\u606f\uff08\u5305\u62ec\u8bbe\u5907\u4fe1\u606f\u3001\u8bc1\u4e66\u3001 token \u7b49\uff09\u4f1a\u660e\u6587\u4fdd\u5b58\u5728 Home Assistant \u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002\u56e0\u6b64\uff0c\u60a8\u9700\u8981\u4fdd\u7ba1\u597d\u81ea\u5df1 Home Assistant \u914d\u7f6e\u6587\u4ef6\u3002\u4e00\u65e6\u8be5\u6587\u4ef6\u6cc4\u9732\uff0c\u5176\u4ed6\u4eba\u53ef\u80fd\u4f1a\u5192\u7528\u60a8\u7684\u8eab\u4efd\u767b\u5f55\u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u5e38\u89c1\u95ee\u9898<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<ul dir=\"auto\">\n<li>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u662f\u5426\u652f\u6301\u6240\u6709\u7684\u5c0f\u7c73\u7c73\u5bb6\u8bbe\u5907\uff1f<\/p>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u76ee\u524d\u652f\u6301\u5927\u90e8\u5206\u7c73\u5bb6\u8bbe\u5907\u54c1\u7c7b\uff0c\u4f46\u4ecd\u6709\u4e00\u5c0f\u90e8\u5206\u8bbe\u5907\u54c1\u7c7b\uff08\u84dd\u7259\u3001\u7ea2\u5916\u53ca\u865a\u62df\u8bbe\u5907\uff09\u5e76\u4e0d\u652f\u6301\u3002<\/p>\n<\/li>\n<li>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u662f\u5426\u53ef\u4ee5\u540c\u65f6\u4f7f\u7528\u591a\u4e2a\u5c0f\u7c73\u8d26\u53f7\uff1f<\/p>\n<p dir=\"auto\">\u662f\u7684\uff0c\u7c73\u5bb6\u96c6\u6210\u652f\u6301\u591a\u4e2a\u5c0f\u7c73\u8d26\u53f7\u540c\u65f6\u767b\u5f55\u3002\u53e6\u5916\uff0c\u7c73\u5bb6\u96c6\u6210\u8fd8\u652f\u6301\u4e0d\u540c\u8d26\u53f7\u7684\u7c73\u5bb6\u8bbe\u5907\u6dfb\u52a0\u81f3\u540c\u4e00\u4e2a Home Assistant \u533a\u57df\u3002<\/p>\n<\/li>\n<li>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u662f\u5426\u652f\u6301\u672c\u5730\u5316\u63a7\u5236\uff1f<\/p>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u652f\u6301\u901a\u8fc7<a href=\"https:\/\/www.mi.com\/shop\/buy\/detail?product_id=15755&amp;cfrom=search\" rel=\"nofollow\">\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173<\/a>\uff08\u56fa\u4ef6\u7248\u672c 3.4.0_000 \u4ee5\u4e0a\uff09\u6216\u5185\u7f6e\u4e2d\u67a2\u7f51\u5173\uff08\u8f6f\u4ef6\u7248\u672c 0.8.0 \u4ee5\u4e0a\uff09\u7684\u7c73\u5bb6\u8bbe\u5907\u5b9e\u73b0\u672c\u5730\u5316\u63a7\u5236\u3002\u5982\u679c\u6ca1\u6709\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u6216\u5176\u4ed6\u5e26\u4e2d\u67a2\u7f51\u5173\u529f\u80fd\u7684\u8bbe\u5907\uff0c\u90a3\u4e48\u6240\u6709\u63a7\u5236\u6307\u4ee4\u90fd\u4f1a\u901a\u8fc7\u5c0f\u7c73\u4e91\u53d1\u9001\u3002\u652f\u6301 Home Assistant \u672c\u5730\u5316\u63a7\u5236\u7684\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\uff08\u542b\u5185\u7f6e\u4e2d\u67a2\u7f51\u5173\uff09\u7684\u56fa\u4ef6\u5c1a\u672a\u53d1\u5e03\uff0c\u56fa\u4ef6\u5347\u7ea7\u8ba1\u5212\u8bf7\u53c2\u9605 MIoT \u56e2\u961f\u7684\u901a\u77e5\u3002<\/p>\n<p dir=\"auto\">\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u4ec5\u5728\u4e2d\u56fd\u5927\u9646\u53ef\u7528\uff0c\u5728\u5176\u4ed6\u5730\u533a\u4e0d\u53ef\u7528\u3002<\/p>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u4e5f\u80fd\u901a\u8fc7\u5f00\u542f\u5c0f\u7c73\u5c40\u57df\u7f51\u63a7\u5236\u529f\u80fd\u5b9e\u73b0\u90e8\u5206\u672c\u5730\u5316\u63a7\u5236\u6548\u679c\u3002\u5c0f\u7c73\u5c40\u57df\u7f51\u63a7\u5236\u529f\u80fd\u53ea\u80fd\u63a7\u5236\u4e0e Home Assistant \u5904\u4e8e\u540c\u4e00\u5c40\u57df\u7f51\u5185\u7684 IP \u8bbe\u5907\uff08\u4f7f\u7528 WiFi\u3001\u7f51\u7ebf\u8fde\u63a5\u8def\u7531\u5668\u7684\u8bbe\u5907\uff09\uff0c\u65e0\u6cd5\u63a7\u5236\u84dd\u7259 Mesh\u3001ZigBee \u7b49\u534f\u8bae\u63a5\u5165\u7684\u8bbe\u5907\u3002\u8be5\u529f\u80fd\u53ef\u80fd\u4f1a\u5f15\u8d77\u4e00\u4e9b\u5f02\u5e38\uff0c\u6211\u4eec\u5efa\u8bae\u4e0d\u8981\u4f7f\u7528\u8be5\u529f\u80fd\u3002\u5c0f\u7c73\u5c40\u57df\u7f51\u63a7\u5236\u529f\u80fd\u5f00\u542f\u65b9\u6cd5\uff1a<a href=\"https:\/\/my.home-assistant.io\/redirect\/integration\/?domain=xiaomi_home\" rel=\"nofollow\">\u8bbe\u7f6e &gt; \u8bbe\u5907\u4e0e\u670d\u52a1 &gt; \u5df2\u914d\u7f6e &gt; Xiaomi Home<\/a> &gt; \u914d\u7f6e &gt; \u66f4\u65b0\u5c40\u57df\u7f51\u63a7\u5236\u914d\u7f6e<\/p>\n<p dir=\"auto\">\u5c0f\u7c73\u5c40\u57df\u7f51\u63a7\u5236\u529f\u80fd\u4e0d\u53d7\u5730\u533a\u9650\u5236\uff0c\u5728\u5168\u7403\u8303\u56f4\u5185\u5747\u53ef\u7528\u3002\u5982\u679c Home Assistant \u6240\u5728\u7684\u5c40\u57df\u7f51\u5185\u5b58\u5728\u4e2d\u67a2\u7f51\u5173\uff0c\u90a3\u4e48\u5373\u4fbf\u7c73\u5bb6\u96c6\u6210\u5f00\u542f\u4e86\u5c0f\u7c73\u5c40\u57df\u7f51\u63a7\u5236\u529f\u80fd\uff0c\u8be5\u529f\u80fd\u4e5f\u4e0d\u4f1a\u751f\u6548\u3002<\/p>\n<\/li>\n<li>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u5728\u54ea\u4e9b\u5730\u533a\u53ef\u7528\uff1f<\/p>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u6240\u7528\u7684\u4e91\u670d\u52a1\u63a5\u53e3\u5df2\u90e8\u7f72\u5728\u4e2d\u56fd\u5927\u9646\u3001\u6b27\u6d32\u3001\u5370\u5ea6\u3001\u4fc4\u7f57\u65af\u3001\u65b0\u52a0\u5761\u3001\u7f8e\u56fd\u5171\u516d\u4e2a\u5730\u533a\u7684\u673a\u623f\u3002\u7531\u4e8e\u7528\u6237\u6570\u636e\u5728\u4e0d\u540c\u5730\u533a\u7684\u5c0f\u7c73\u4e91\u4e0a\u76f8\u4e92\u9694\u79bb\uff0c\u60a8\u9700\u8981\u5728\u914d\u7f6e Home Assistant \u65f6\u9009\u62e9\u7528\u6237\u6240\u5728\u5730\u533a\uff0c\u624d\u80fd\u5bfc\u5165\u76f8\u5e94\u7684\u7c73\u5bb6\u8bbe\u5907\u3002\u7c73\u5bb6\u96c6\u6210\u652f\u6301\u5c06\u4e0d\u540c\u5730\u533a\u7684\u7c73\u5bb6\u8bbe\u5907\u6dfb\u52a0\u81f3\u540c\u4e00\u4e2a Home Assistant \u533a\u57df\u3002<\/p>\n<\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u6d88\u606f\u6536\u53d1\u539f\u7406<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u4e91\u7aef\u63a7\u5236<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<div dir=\"auto\" align=\"center\">\n<p><a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home\/blob\/main\/doc\/images\/cloud_control_zh.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2177\" title=\"cloud_control_zh\" src=\"https:\/\/oimi.me\/wp-content\/uploads\/2024\/12\/cloud_control_zh.jpg\" alt=\"cloud_control_zh\" width=\"820\" height=\"814\" \/><\/a><\/p>\n<p dir=\"auto\">\u56fe 1\uff1a\u4e91\u7aef\u63a7\u5236\u67b6\u6784<\/p>\n<\/div>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u5411\u5c0f\u7c73\u4e91 MQTT Broker \u8ba2\u9605\u5173\u6ce8\u7684\u8bbe\u5907\u6d88\u606f\u3002\u5f53\u8bbe\u5907\u5c5e\u6027\u53d1\u751f\u6539\u53d8\u6216\u4ea7\u751f\u8bbe\u5907\u4e8b\u4ef6\u65f6\uff0c\u8bbe\u5907\u5411\u5c0f\u7c73\u4e91\u53d1\u9001\u4e0a\u884c\u6d88\u606f\uff0c MQTT Broker \u5411\u7c73\u5bb6\u96c6\u6210\u63a8\u9001\u8ba2\u9605\u7684\u8bbe\u5907\u6d88\u606f\u3002\u7531\u4e8e\u7c73\u5bb6\u96c6\u6210\u4e0d\u9700\u8981\u5411\u4e91\u7aef\u8f6e\u8be2\u4ee5\u83b7\u53d6\u8bbe\u5907\u5f53\u524d\u7684\u5c5e\u6027\u503c\uff0c\u56e0\u6b64\u7c73\u5bb6\u96c6\u6210\u80fd\u7b2c\u4e00\u65f6\u95f4\u83b7\u77e5\u8bbe\u5907\u5c5e\u6027\u53d8\u5316\u6216\u4e8b\u4ef6\u53d1\u751f\u3002\u5f97\u76ca\u4e8e\u6d88\u606f\u8ba2\u9605\u673a\u5236\uff0c\u7c73\u5bb6\u96c6\u6210\u53ea\u5728\u914d\u7f6e\u5b8c\u6210\u65f6\u5411\u4e91\u7aef\u67e5\u8be2\u4e00\u6b21\u6240\u6709\u7684\u8bbe\u5907\u5c5e\u6027\uff0c\u5bf9\u4e91\u7aef\u4ea7\u751f\u7684\u8bbf\u95ee\u538b\u529b\u5f88\u5c0f\u3002<\/p>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u9700\u8981\u63a7\u5236\u8bbe\u5907\u65f6\uff0c\u901a\u8fc7\u5c0f\u7c73\u4e91 HTTP \u63a5\u53e3\u5411\u8bbe\u5907\u53d1\u9001\u63a7\u5236\u6d88\u606f\u3002\u8bbe\u5907\u6536\u5230\u5c0f\u7c73\u4e91\u53d1\u6765\u7684\u4e0b\u884c\u6d88\u606f\u540e\u505a\u51fa\u54cd\u5e94\u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u672c\u5730\u63a7\u5236<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<div dir=\"auto\" align=\"center\">\n<p><a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home\/blob\/main\/doc\/images\/local_control_zh.jpg\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-2179\" title=\"local_control_zh\" src=\"https:\/\/oimi.me\/wp-content\/uploads\/2024\/12\/local_control_zh.jpg\" alt=\"local_control_zh\" width=\"706\" height=\"734\" \/><\/a><\/p>\n<p dir=\"auto\">\u56fe 2\uff1a\u672c\u5730\u63a7\u5236\u67b6\u6784<\/p>\n<\/div>\n<p dir=\"auto\">\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u5185\u5305\u542b\u4e00\u4e2a\u6807\u51c6\u7684 MQTT Broker \uff0c\u5b9e\u73b0\u4e86\u5b8c\u6574\u7684\u8ba2\u9605\u53d1\u5e03\u673a\u5236\u3002\u7c73\u5bb6\u96c6\u6210\u5411\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u8ba2\u9605\u5173\u6ce8\u7684\u8bbe\u5907\u6d88\u606f\u3002\u5f53\u8bbe\u5907\u5c5e\u6027\u53d1\u751f\u6539\u53d8\u6216\u4ea7\u751f\u8bbe\u5907\u4e8b\u4ef6\u65f6\uff0c\u8bbe\u5907\u5411\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u53d1\u9001\u4e0a\u884c\u6d88\u606f\uff0c MQTT Broker \u5411\u7c73\u5bb6\u96c6\u6210\u63a8\u9001\u8ba2\u9605\u7684\u8bbe\u5907\u6d88\u606f\u3002<\/p>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u9700\u8981\u63a7\u5236\u8bbe\u5907\u65f6\uff0c\u5411 MQTT Broker \u53d1\u5e03\u8bbe\u5907\u63a7\u5236\u6d88\u606f\uff0c\u518d\u7ecf\u7531\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u8f6c\u53d1\u7ed9\u8bbe\u5907\u3002\u8bbe\u5907\u6536\u5230\u5c0f\u7c73\u4e2d\u67a2\u7f51\u5173\u53d1\u6765\u7684\u4e0b\u884c\u6d88\u606f\u540e\u505a\u51fa\u54cd\u5e94\u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">MIoT-Spec-V2 \u4e0e Home Assistant \u5b9e\u4f53\u7684\u6620\u5c04\u5173\u7cfb<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\"><a href=\"https:\/\/iot.mi.com\/v2\/new\/doc\/introduction\/knowledge\/spec\" rel=\"nofollow\">MIoT-Spec-V2<\/a> \u7684\u5168\u79f0\u4e3a MIoT Specification Version 2 \uff0c\u662f\u5c0f\u7c73 IoT \u5e73\u53f0\u5236\u8ba2\u7684\u7269\u8054\u7f51\u534f\u8bae\uff0c\u7528\u4e8e\u5bf9 IoT \u8bbe\u5907\u8fdb\u884c\u89c4\u8303\u5316\u7684\u529f\u80fd\u6027\u63cf\u8ff0\uff0c\u5176\u4e2d\u5305\u542b\u529f\u80fd\u5b9a\u4e49\uff08\u5176\u4ed6 IoT \u5e73\u53f0\u79f0\u4e4b\u4e3a\u7269\u6a21\u578b\uff09\u3001\u4ea4\u4e92\u6a21\u578b\u3001\u6d88\u606f\u683c\u5f0f\u4ee5\u53ca\u7f16\u7801\u3002<\/p>\n<p dir=\"auto\">\u5728 MIoT-Spec-V2 \u4e2d\uff0c\u4e00\u4e2a\u4ea7\u54c1\u5b9a\u4e49\u4e3a\u4e00\u4e2a\u8bbe\u5907\uff0c\u4e00\u4e2a\u8bbe\u5907\u5305\u542b\u82e5\u5e72\u670d\u52a1\uff0c\u4e00\u4e2a\u670d\u52a1\u5305\u542b\u82e5\u5e72\u5c5e\u6027\u3001\u65b9\u6cd5\u548c\u4e8b\u4ef6\u3002\u7c73\u5bb6\u96c6\u6210\u6839\u636e MIoT-Spec-V2 \u751f\u6210\u5bf9\u5e94\u7684 Home Assistant \u5b9e\u4f53\u3002<\/p>\n<p dir=\"auto\">\u5177\u4f53\u7684\u8f6c\u6362\u5173\u7cfb\u5982\u4e0b\uff1a<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u4e00\u822c\u8f6c\u6362\u89c4\u5219<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<ul dir=\"auto\">\n<li>\u5c5e\u6027\uff08Property\uff09<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>access\uff08\u8bbf\u95ee\u65b9\u5f0f\uff09<\/th>\n<th>format\uff08\u6570\u636e\u683c\u5f0f\uff09<\/th>\n<th>value-list\uff08\u53d6\u503c\u5217\u8868\uff09<\/th>\n<th>value-range\uff08\u53d6\u503c\u8303\u56f4\uff09<\/th>\n<th>\u8f6c\u6362\u540e\u7684\u5b9e\u4f53<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u53ef\u5199<\/td>\n<td>string<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>Text<\/td>\n<\/tr>\n<tr>\n<td>\u53ef\u5199<\/td>\n<td>bool<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>Switch<\/td>\n<\/tr>\n<tr>\n<td>\u53ef\u5199<\/td>\n<td>\u975e string\u3001\u975e bool<\/td>\n<td>\u6709<\/td>\n<td>&#8211;<\/td>\n<td>Select<\/td>\n<\/tr>\n<tr>\n<td>\u53ef\u5199<\/td>\n<td>\u975e string\u3001\u975e bool<\/td>\n<td>\u65e0<\/td>\n<td>\u6709<\/td>\n<td>Number<\/td>\n<\/tr>\n<tr>\n<td>\u4e0d\u53ef\u5199<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>&#8211;<\/td>\n<td>Sensor<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ul dir=\"auto\">\n<li>\u4e8b\u4ef6\uff08Event\uff09<\/li>\n<\/ul>\n<p dir=\"auto\">\u8f6c\u6362\u540e\u7684\u5b9e\u4f53\u4e3a Event\uff0c\u4e8b\u4ef6\u53c2\u6570\u540c\u65f6\u4f20\u9012\u7ed9\u5b9e\u4f53\u7684 <code>_trigger_event<\/code> \u3002<\/p>\n<ul dir=\"auto\">\n<li>\u65b9\u6cd5\uff08Action\uff09<\/li>\n<\/ul>\n<table>\n<thead>\n<tr>\n<th>in\uff08\u8f93\u5165\u53c2\u6570\u5217\u8868\uff09<\/th>\n<th>\u8f6c\u6362\u540e\u7684\u5b9e\u4f53<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u7a7a<\/td>\n<td>Button<\/td>\n<\/tr>\n<tr>\n<td>\u975e\u7a7a<\/td>\n<td>Notify<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p dir=\"auto\">\u5982\u679c\u5f00\u542f\u4e86\u201cAction \u8c03\u8bd5\u6a21\u5f0f\u201d\uff0c\u65b9\u6cd5\u7684 in \u5b57\u6bb5\u4e3a\u975e\u7a7a\u65f6\uff0c\u8fd8\u4f1a\u751f\u6210 Text \u5b9e\u4f53\u3002<\/p>\n<p dir=\"auto\">Notify \u5b9e\u4f53\u8be6\u60c5\u9875\u4e2d Attributes \u4f1a\u663e\u793a\u8f93\u5165\u53c2\u6570\u7684\u683c\u5f0f\u3002\u8f93\u5165\u53c2\u6570\u4e3a\u6709\u5e8f\u7684\u5217\u8868\uff0c\u82f1\u6587\u4e2d\u62ec\u53f7[]\u5305\u62ec\u3002\u5b57\u7b26\u4e32\u5143\u7d20\u7531\u82f1\u6587\u53cc\u5f15\u53f7&#8221;&#8221;\u5305\u62ec\u3002<\/p>\n<p dir=\"auto\">\u4f8b\u5982\uff0c xiaomi.wifispeaker.s12 siid=5 aiid=5 \u65b9\u6cd5\uff08 Intelligent Speaker Execute Text Directive \uff09\u5728 Notify \u5b9e\u4f53\u8be6\u60c5\u9875\u663e\u793a\u7684\u8f93\u5165\u53c2\u6570\u683c\u5f0f\u4e3a <code>[Text Content(str), Silent Execution(bool)]<\/code> \uff0c\u4f7f\u7528\u7684\u8f93\u5165\u53c2\u6570\u53ef\u4ee5\u662f <code>[\"Hello\", true]<\/code> \u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u7279\u6b8a\u8f6c\u6362\u89c4\u5219<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">MIoT-Spec-V2 \u5b9a\u4e49\u7c7b\u578b\u4f7f\u7528\u7684 URN \u683c\u5f0f\u4e3a <code>urn:&lt;namespace&gt;:&lt;type&gt;:&lt;name&gt;:&lt;value&gt;[:&lt;vendor-product&gt;:&lt;version&gt;]<\/code>\uff0c\u5176\u4e2d <code>name<\/code> \u662f\u7528\u4e8e\u63cf\u8ff0\u5b9e\u4f8b\uff08\u8bbe\u5907\u3001\u670d\u52a1\u3001\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\uff09\u7684\u6709\u610f\u4e49\u7684\u5355\u8bcd\u6216\u8bcd\u7ec4\u3002\u7c73\u5bb6\u96c6\u6210\u5148\u7528\u5b9e\u4f8b\u540d\u79f0\uff08 name \uff09\u5224\u65ad\u662f\u5426\u5c06 MIoT-Spec-V2 \u5b9e\u4f8b\u8f6c\u6362\u6210\u7279\u5b9a\u7684 Home Assistant \u5b9e\u4f53\u3002\u5bf9\u4e8e\u4e0d\u7b26\u5408\u7279\u6b8a\u8f6c\u6362\u89c4\u5219\u7684 MIoT-Spec-V2 \u5b9e\u4f8b\uff0c\u518d\u4f7f\u7528\u4e00\u822c\u8f6c\u6362\u89c4\u5219\u8fdb\u884c\u8f6c\u6362\u3002<\/p>\n<p dir=\"auto\"><code>namespace<\/code> \u7528\u4e8e\u63cf\u8ff0\u5b9e\u4f8b\u6240\u5c5e\u7684\u547d\u540d\u7a7a\u95f4\uff0c\u53d6\u503c\u4e3a\u201cmiot-spec-v2\u201d\u8868\u793a\u5c0f\u7c73\u5b9a\u4e49\u7684\u89c4\u8303\uff0c \u53d6\u503c\u4e3a\u201cbluetooth-spec\u201d\u8868\u793a\u84dd\u7259\u8054\u76df\u5b9a\u4e49\u7684\u89c4\u8303\uff0c\u5176\u4ed6\u5219\u4e3a\u5382\u5546\u81ea\u5b9a\u4e49\u7684\u89c4\u8303\u3002\u5f53 <code>namespace<\/code> \u4e0d\u662f\u201cmiot-spec-v2\u201d\u65f6\uff0c\u8f6c\u6362\u540e\u7684\u5b9e\u4f53\u540d\u79f0\u524d\u4f1a\u663e\u793a\u4e00\u4e2a\u661f\u53f7*\u3002<\/p>\n<ul dir=\"auto\">\n<li>\u8bbe\u5907\uff08Device\uff09<\/li>\n<\/ul>\n<p dir=\"auto\">\u8f6c\u6362\u89c4\u5219\u4e3a <code>SPEC_DEVICE_TRANS_MAP<\/code> \uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    '&lt;device instance name&gt;':{\n        'required':{\n            '&lt;service instance name&gt;':{\n                'required':{\n                    'properties': {\n                        '&lt;property instance name&gt;': set&lt;property access: str&gt;\n                    },\n                    'events': set&lt;event instance name: str&gt;,\n                    'actions': set&lt;action instance name: str&gt;\n                },\n                'optional':{\n                    'properties': set&lt;property instance name: str&gt;,\n                    'events': set&lt;event instance name: str&gt;,\n                    'actions': set&lt;action instance name: str&gt;\n                }\n            }\n        },\n        'optional':{\n            '&lt;service instance name&gt;':{\n                'required':{\n                    'properties': {\n                        '&lt;property instance name&gt;': set&lt;property access: str&gt;\n                    },\n                    'events': set&lt;event instance name: str&gt;,\n                    'actions': set&lt;action instance name: str&gt;\n                },\n                'optional':{\n                    'properties': set&lt;property instance name: str&gt;,\n                    'events': set&lt;event instance name: str&gt;,\n                    'actions': set&lt;action instance name: str&gt;\n                }\n            }\n        },\n        'entity': str\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">device instance name \u4e0b\u7684 required \u8868\u793a\u5fc5\u987b\u5305\u542b\u7684\u670d\u52a1\uff0c optional \u8868\u793a\u53ef\u9009\u7684\u670d\u52a1\uff0c entity \u8868\u793a\u8f6c\u6362\u540e\u7684\u5b9e\u4f53\u3002 service instance name \u4e0b\u7684 required \u8868\u793a\u5fc5\u987b\u5305\u542b\u7684\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\uff0coptional \u8868\u793a\u53ef\u9009\u7684\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\u3002 required \u3001 properties \u57df\u4e0b\u7684 property instance name \u7684\u503c\u8868\u793a\u5c5e\u6027\u7684\u8bbf\u95ee\u65b9\u5f0f\uff0c\u5339\u914d\u6210\u529f\u7684\u6761\u4ef6\u662f property instance name \u7684\u503c\u662f\u76f8\u5e94 MIoT-Spec-V2 \u5c5e\u6027\u5b9e\u4f8b\u7684\u8bbf\u95ee\u65b9\u5f0f\u7684\u5b50\u96c6\u3002<\/p>\n<p dir=\"auto\">\u5982\u679c MIoT-Spec-V2 \u8bbe\u5907\u5b9e\u4f8b\u7f3a\u5c11\u5fc5\u9009\u7684\u670d\u52a1\u3001\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\uff0c\u5219\u4e0d\u4f1a\u751f\u6210 Home Assistant \u5b9e\u4f53\u3002<\/p>\n<ul dir=\"auto\">\n<li>\u670d\u52a1\uff08Service\uff09<\/li>\n<\/ul>\n<p dir=\"auto\">\u8f6c\u6362\u89c4\u5219\u4e3a <code>SPEC_SERVICE_TRANS_MAP<\/code> \uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    '&lt;service instance name&gt;':{\n        'required':{\n            'properties': {\n                '&lt;property instance name&gt;': set&lt;property access: str&gt;\n            },\n            'events': set&lt;event instance name: str&gt;,\n            'actions': set&lt;action instance name: str&gt;\n        },\n        'optional':{\n            'properties': set&lt;property instance name: str&gt;,\n            'events': set&lt;event instance name: str&gt;,\n            'actions': set&lt;action instance name: str&gt;\n        },\n        'entity': str\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">service instance name \u4e0b\u7684 required \u8868\u793a\u5fc5\u987b\u5305\u542b\u7684\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\uff0coptional \u8868\u793a\u53ef\u9009\u7684\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\uff0c entity \u8868\u793a\u8f6c\u6362\u540e\u7684\u5b9e\u4f53\u3002 required \u3001 properties \u57df\u4e0b\u7684 property instance name \u7684\u503c\u8868\u793a\u5c5e\u6027\u7684\u8bbf\u95ee\u65b9\u5f0f\uff0c\u5339\u914d\u6210\u529f\u7684\u6761\u4ef6\u662f property instance name \u7684\u503c\u662f\u76f8\u5e94 MIoT-Spec-V2 \u5c5e\u6027\u5b9e\u4f8b\u7684\u8bbf\u95ee\u65b9\u5f0f\u7684\u5b50\u96c6\u3002<\/p>\n<p dir=\"auto\">\u5982\u679c MIoT-Spec-V2 \u670d\u52a1\u5b9e\u4f8b\u7f3a\u5c11\u5fc5\u9009\u7684\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\uff0c\u5219\u4e0d\u4f1a\u751f\u6210 Home Assistant \u5b9e\u4f53\u3002<\/p>\n<ul dir=\"auto\">\n<li>\u5c5e\u6027\uff08Property\uff09<\/li>\n<\/ul>\n<p dir=\"auto\">\u8f6c\u6362\u89c4\u5219\u4e3a <code>SPEC_PROP_TRANS_MAP<\/code> \uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    'entities':{\n        '&lt;entity name&gt;':{\n            'format': set&lt;str&gt;,\n            'access': set&lt;str&gt;\n        }\n    },\n    'properties': {\n        '&lt;property instance name&gt;':{\n            'device_class': str,\n            'entity': str\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">entity name \u4e0b\u7684 format \u8868\u793a\u5c5e\u6027\u7684\u6570\u636e\u683c\u5f0f\uff0c\u5339\u914d\u4e0a\u4e00\u4e2a\u503c\u5373\u4e3a\u5339\u914d\u6210\u529f\uff1b access \u8868\u793a\u5c5e\u6027\u7684\u8bbf\u95ee\u65b9\u5f0f\uff0c\u5339\u914d\u4e0a\u6240\u6709\u503c\u624d\u7b97\u5339\u914d\u6210\u529f\u3002<\/p>\n<p dir=\"auto\">property instance name \u4e0b\u7684 entity \u8868\u793a\u8f6c\u6362\u540e\u7684\u5b9e\u4f53\uff0c\u53d6\u503c\u4e3a entities \u4e0b\u7684 entity name \uff1b device_class \u8868\u793a\u8f6c\u6362\u540e\u5b9e\u4f53\u6240\u7528\u7684 <code>_attr_device_class<\/code> \u3002<\/p>\n<ul dir=\"auto\">\n<li>\u4e8b\u4ef6\uff08Event\uff09<\/li>\n<\/ul>\n<p dir=\"auto\">\u8f6c\u6362\u89c4\u5219\u4e3a <code>SPEC_EVENT_TRANS_MAP<\/code> \uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    '&lt;event instance name&gt;': str\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">event instance name \u4e0b\u7684\u503c\u8868\u793a\u8f6c\u6362\u540e\u5b9e\u4f53\u6240\u7528\u7684 <code>_attr_device_class<\/code> \u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h3 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">MIoT-Spec-V2 \u8fc7\u6ee4\u89c4\u5219<\/h3>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\"><code>spec_filter.json<\/code> \u7528\u4e8e\u8fc7\u6ee4\u6389\u4e0d\u9700\u8981\u7684 MIoT-Spec-V2 \u5b9e\u4f8b\uff0c\u8fc7\u6ee4\u6389\u7684\u5b9e\u4f8b\u4e0d\u4f1a\u8f6c\u6362\u6210 Home Assistant \u5b9e\u4f53\u3002<\/p>\n<p dir=\"auto\"><code>spec_filter.json<\/code>\u7684\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    \"&lt;MIoT-Spec-V2 device instance&gt;\":{\n        \"services\": list&lt;service_iid: str&gt;,\n        \"properties\": list&lt;service_iid.property_iid: str&gt;,\n        \"events\": list&lt;service_iid.event_iid: str&gt;,\n        \"actions\": list&lt;service_iid.action_iid: str&gt;,\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\"><code>spec_filter.json<\/code> \u7684\u952e\u503c\u4e3a MIoT-Spec-V2 \u8bbe\u5907\u5b9e\u4f8b\u7684 urn \uff08\u4e0d\u542b\u7248\u672c\u53f7\u201cversion\u201d\u5b57\u6bb5\uff09\u3002\u4e00\u4e2a\u4ea7\u54c1\u7684\u4e0d\u540c\u7248\u672c\u7684\u56fa\u4ef6\u53ef\u80fd\u4f1a\u5173\u8054\u4e0d\u540c\u7248\u672c\u7684 MIoT-Spec-V2 \u8bbe\u5907\u5b9e\u4f8b\u3002 MIoT \u5e73\u53f0\u8981\u6c42\u5382\u5546\u5b9a\u4e49\u4ea7\u54c1\u7684 MIoT-Spec-V2 \u65f6\uff0c\u9ad8\u7248\u672c\u7684 MIoT-Spec-V2 \u5b9e\u4f8b\u5fc5\u987b\u5305\u542b\u5168\u90e8\u4f4e\u7248\u672c\u7684 MIoT-Spec-V2 \u5b9e\u4f8b\u3002\u56e0\u6b64\uff0c <code>spec_filter.json<\/code> \u7684\u952e\u503c\u4e0d\u9700\u8981\u6307\u5b9a\u8bbe\u5907\u5b9e\u4f8b\u7684\u7248\u672c\u53f7\u3002<\/p>\n<p dir=\"auto\">\u8bbe\u5907\u5b9e\u4f8b\u4e0b\u7684 services \u3001 properties \u3001 events \u3001 actions \u57df\u7684\u503c\u8868\u793a\u9700\u8981\u8fc7\u6ee4\u6389\u7684\u670d\u52a1\u3001\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\u7684\u5b9e\u4f8b\u53f7\uff08 iid \uff0c\u5373 instance id \uff09\u3002\u652f\u6301\u901a\u914d\u7b26\u5339\u914d\u3002<\/p>\n<p dir=\"auto\">\u793a\u4f8b\uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    \"urn:miot-spec-v2:device:television:0000A010:xiaomi-rmi1\":{\n        \"services\": [\"*\"]   # Filter out all services. It is equivalent to completely ignoring the device with such MIoT-Spec-V2 device instance.\n    },\n    \"urn:miot-spec-v2:device:gateway:0000A019:xiaomi-hub1\": {\n        \"services\": [\"3\"],  # Filter out the service whose iid=3.\n        \"properties\": [\"4.*\"]   # Filter out all properties in the service whose iid=4.\n        \"events\": [\"4.1\"],  # Filter out the iid=1 event in the iid=4 service.\n        \"actions\": [\"4.1\"]  # Filter out the iid=1 action in the iid=4 service.\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">\u6240\u6709\u8bbe\u5907\u7684\u8bbe\u5907\u4fe1\u606f\u670d\u52a1\uff08 urn:miot-spec-v2:service:device-information:00007801 \uff09\u5747\u4e0d\u4f1a\u751f\u6210 Home Assistant \u5b9e\u4f53\u3002<\/p>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u591a\u8bed\u8a00\u652f\u6301<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<p dir=\"auto\">\u7c73\u5bb6\u96c6\u6210\u914d\u7f6e\u9009\u9879\u4e2d\u53ef\u9009\u62e9\u7684\u96c6\u6210\u4f7f\u7528\u7684\u8bed\u8a00\u6709\u7b80\u4f53\u4e2d\u6587\u3001\u7e41\u4f53\u4e2d\u6587\u3001\u82f1\u6587\u3001\u897f\u73ed\u7259\u8bed\u3001\u4fc4\u8bed\u3001\u6cd5\u8bed\u3001\u5fb7\u8bed\u3001\u65e5\u8bed\u8fd9\u516b\u79cd\u8bed\u8a00\u3002\u76ee\u524d\uff0c\u7c73\u5bb6\u96c6\u6210\u914d\u7f6e\u9875\u9762\u7684\u7b80\u4f53\u4e2d\u6587\u548c\u82f1\u6587\u5df2\u7ecf\u8fc7\u4eba\u5de5\u6821\u5ba1\uff0c\u5176\u4ed6\u8bed\u8a00\u7531\u673a\u5668\u7ffb\u8bd1\u3002\u5982\u679c\u60a8\u5e0c\u671b\u4fee\u6539\u914d\u7f6e\u9875\u9762\u7684\u8bcd\u53e5\uff0c\u5219\u9700\u8981\u4fee\u6539 <code>custom_components\/xiaomi_home\/translations\/<\/code> \u76ee\u5f55\u4e0b\u76f8\u5e94\u8bed\u8a00\u7684 json \u6587\u4ef6\u3002<\/p>\n<p dir=\"auto\">\u5728\u663e\u793a Home Assistant \u5b9e\u4f53\u540d\u79f0\u65f6\uff0c\u7c73\u5bb6\u96c6\u6210\u4f1a\u4ece\u5c0f\u7c73\u4e91\u4e0b\u8f7d\u8bbe\u5907\u5382\u5546\u4e3a\u8bbe\u5907\u914d\u7f6e\u7684\u591a\u8bed\u8a00\u6587\u4ef6\uff0c\u8be5\u6587\u4ef6\u5305\u542b\u8bbe\u5907 MIoT-Spec-V2 \u5b9e\u4f8b\u7684\u591a\u8bed\u8a00\u7ffb\u8bd1\u3002 <code>multi_lang.json<\/code> \u662f\u672c\u5730\u7ef4\u62a4\u7684\u591a\u8bed\u8a00\u914d\u7f6e\u5b57\u5178\uff0c\u5176\u4f18\u5148\u7ea7\u9ad8\u4e8e\u4ece\u4e91\u7aef\u83b7\u53d6\u7684\u591a\u8bed\u8a00\u6587\u4ef6\uff0c\u53ef\u7528\u4e8e\u8865\u5145\u6216\u4fee\u6539\u8bbe\u5907\u7684\u591a\u8bed\u8a00\u7ffb\u8bd1\u3002<\/p>\n<p dir=\"auto\"><code>multi_lang.json<\/code> \u7684\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    \"&lt;MIoT-Spec-V2 device instance&gt;\": {\n        \"&lt;language code&gt;\": {\n            \"&lt;instance code&gt;\": &lt;translation: str&gt;\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\"><code>multi_lang.json<\/code> \u7684\u952e\u503c\u4e3a MIoT-Spec-V2 \u8bbe\u5907\u5b9e\u4f8b\u7684 urn \uff08\u4e0d\u542b\u7248\u672c\u53f7\u201cversion\u201d\u5b57\u6bb5\uff09\u3002<\/p>\n<p dir=\"auto\">language code \u4e3a\u8bed\u8a00\u4ee3\u7801\uff0c\u53d6\u503c\u4e3a zh-Hans\u3001zh-Hant\u3001en\u3001es\u3001ru\u3001fr\u3001de\u3001ja \uff08\u5bf9\u5e94\u4e0a\u8ff0\u7c73\u5bb6\u96c6\u6210\u53ef\u9009\u7684\u516b\u79cd\u8bed\u8a00\uff09\u3002<\/p>\n<p dir=\"auto\">instance code \u4e3a MIoT-Spec-V2 \u5b9e\u4f8b\u4ee3\u7801\uff0c\u683c\u5f0f\u5982\u4e0b\uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>service:&lt;siid&gt;                  # \u670d\u52a1\nservice:&lt;siid&gt;:property:&lt;piid&gt;  # \u5c5e\u6027\nservice:&lt;siid&gt;:property:&lt;piid&gt;:valuelist:&lt;value&gt; # \u5c5e\u6027\u53d6\u503c\u5217\u8868\u7684\u503c\nservice:&lt;siid&gt;:event:&lt;eiid&gt;     # \u4e8b\u4ef6\nservice:&lt;siid&gt;:action:&lt;aiid&gt;    # \u65b9\u6cd5\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<p dir=\"auto\">siid\u3001piid\u3001eiid\u3001aiid\u3001value \u5747\u4e3a\u5341\u8fdb\u5236\u4e09\u4f4d\u6574\u6570\u3002<\/p>\n<p dir=\"auto\">\u793a\u4f8b\uff1a<\/p>\n<div class=\"snippet-clipboard-content notranslate position-relative overflow-auto\">\n<pre class=\"notranslate\"><code>{\n    \"urn:miot-spec-v2:device:health-pot:0000A051:chunmi-a1\": {\n        \"zh-Hant\": {\n            \"service:002\": \"\u990a\u751f\u58fa\",\n            \"service:002:property:001\": \"\u5de5\u4f5c\u72c0\u614b\",\n            \"service:002:property:001:valuelist:000\": \"\u5f85\u6a5f\u4e2d\",\n            \"service:002:action:002\": \"\u505c\u6b62\u70f9\u98ea\",\n            \"service:005:event:001\": \"\u70f9\u98ea\u5b8c\u6210\"\n        }\n    }\n}\n<\/code><\/pre>\n<div class=\"zeroclipboard-container\"><\/div>\n<\/div>\n<blockquote>\n<p dir=\"auto\">\u5728 Home Assistant \u4e2d\u4fee\u6539\u4e86 <code>custom_components\/xiaomi_home\/translations\/<\/code> \u8def\u5f84\u4e0b\u7684 <code>specv2entity.py<\/code>\u3001<code>spec_filter.json<\/code>\u3001<code>multi_lang.json<\/code> \u6587\u4ef6\u7684\u5185\u5bb9\uff0c\u9700\u8981\u5728\u96c6\u6210\u914d\u7f6e\u4e2d\u66f4\u65b0\u5b9e\u4f53\u8f6c\u6362\u89c4\u5219\u624d\u80fd\u751f\u6548\u3002\u65b9\u6cd5\uff1a<a href=\"https:\/\/my.home-assistant.io\/redirect\/integration\/?domain=xiaomi_home\" rel=\"nofollow\">\u8bbe\u7f6e &gt; \u8bbe\u5907\u4e0e\u670d\u52a1 &gt; \u5df2\u914d\u7f6e &gt; Xiaomi Home<\/a> &gt; \u914d\u7f6e &gt; \u66f4\u65b0\u5b9e\u4f53\u8f6c\u6362\u89c4\u5219<\/p>\n<\/blockquote>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u6587\u6863<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<ul dir=\"auto\">\n<li><a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home\/blob\/main\/LICENSE.md\">\u8bb8\u53ef\u8bc1<\/a><\/li>\n<li>\u8d21\u732e\u6307\u5357\uff1a <a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home\/blob\/main\/doc\/CONTRIBUTING.md\">English<\/a> | <a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home\/blob\/main\/doc\/CONTRIBUTING_zh.md\">\u7b80\u4f53\u4e2d\u6587<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/XiaoMi\/ha_xiaomi_home\/blob\/main\/doc\/CHANGELOG.md\">\u66f4\u65b0\u65e5\u5fd7<\/a><\/li>\n<li>\u5f00\u53d1\u6587\u6863\uff1a <a href=\"https:\/\/developers.home-assistant.io\/docs\/creating_component_index\" rel=\"nofollow\">https:\/\/developers.home-assistant.io\/docs\/creating_component_index<\/a><\/li>\n<\/ul>\n<div class=\"markdown-heading\" dir=\"auto\">\n<h2 class=\"heading-element\" dir=\"auto\" tabindex=\"-1\">\u76ee\u5f55\u7ed3\u6784<\/h2>\n<p>&nbsp;<\/p>\n<\/div>\n<ul dir=\"auto\">\n<li>miot\uff1a\u6838\u5fc3\u4ee3\u7801\u3002<\/li>\n<li>miot\/miot_client\uff1a\u6bcf\u6dfb\u52a0\u4e00\u4e2a\u7528\u6237\u9700\u8981\u589e\u52a0\u4e00\u4e2a miot_client \u5b9e\u4f8b\u3002<\/li>\n<li>miot\/miot_cloud\uff1a\u4e91\u670d\u52a1\u76f8\u5173\u529f\u80fd\uff0c\u5305\u62ec OAuth \u767b\u5f55\u3001 HTTP \u63a5\u53e3\u529f\u80fd\uff08\u83b7\u53d6\u7528\u6237\u4fe1\u606f\u3001\u53d1\u9001\u8bbe\u5907\u63a7\u5236\u6307\u4ee4\u7b49\uff09\u3002<\/li>\n<li>miot\/miot_device\uff1a\u8bbe\u5907\u5b9e\u4f53\uff0c\u5305\u542b\u8bbe\u5907\u4fe1\u606f\u4ee5\u53ca\u5c5e\u6027\u3001\u4e8b\u4ef6\u3001\u65b9\u6cd5\u7684\u5904\u7406\u903b\u8f91\u3002<\/li>\n<li>miot\/miot_mips\uff1a\u6d88\u606f\u603b\u7ebf\uff0c\u7528\u4e8e\u8ba2\u9605\u548c\u53d1\u5e03\u6d88\u606f\u3002<\/li>\n<li>miot\/miot_spec\uff1a\u89e3\u6790 MIoT-Spec-V2 \u3002<\/li>\n<li>miot\/miot_lan: \u8bbe\u5907\u5c40\u57df\u7f51\u63a7\u5236\uff0c\u5305\u62ec\u8bbe\u5907\u53d1\u73b0\u3001\u8bbe\u5907\u63a7\u5236\u7b49\u3002<\/li>\n<li>miot\/miot_mdns: \u4e2d\u67a2\u7f51\u5173\u670d\u52a1\u5c40\u57df\u7f51\u53d1\u73b0\u3002<\/li>\n<li>miot\/miot_network\uff1a\u83b7\u53d6\u7f51\u7edc\u72b6\u6001\u548c\u7f51\u7edc\u4fe1\u606f\u3002<\/li>\n<li>miot\/miot_storage: \u96c6\u6210\u6587\u4ef6\u5b58\u50a8\u3002<\/li>\n<li>miot\/test\uff1a\u6d4b\u8bd5\u811a\u672c\u3002<\/li>\n<li>config_flow\uff1a\u914d\u7f6e\u6d41\u7a0b\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>\u7c73\u5bb6\u96c6\u6210\u662f\u4e00\u4e2a\u7531\u5c0f\u7c73\u5b98\u65b9\u63d0\u4f9b\u652f\u6301\u7684 Home Assistant \u7684\u96c6\u6210\u7ec4\u4ef6\uff0c\u5b83\u53ef\u4ee5\u8ba9\u60a8\u5728 Home Assi [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":2179,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,5],"tags":[135],"class_list":["post-2176","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-apple","category-lab","tag-home-assistant"],"_links":{"self":[{"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/posts\/2176","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/comments?post=2176"}],"version-history":[{"count":0,"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/posts\/2176\/revisions"}],"wp:attachment":[{"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/media?parent=2176"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/categories?post=2176"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myya.net\/index.php\/wp-json\/wp\/v2\/tags?post=2176"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}