@jessicaisleep/dsh-mihome 0.0.0-stage → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (186) hide show
  1. package/LICENSE +270 -0
  2. package/README.md +176 -2
  3. package/client.js +3296 -0
  4. package/cordis.patch.yml +17 -0
  5. package/docs/REPAIR-VALIDATION.md +62 -0
  6. package/icon.svg +6 -0
  7. package/lib/bridge.js +301 -0
  8. package/lib/connections.js +46 -0
  9. package/lib/format.js +278 -0
  10. package/lib/index.js +729 -0
  11. package/lib/panel.js +596 -0
  12. package/locale/en.json +6 -0
  13. package/locale/zh.json +6 -0
  14. package/package.json +81 -4
  15. package/python/LICENSE +253 -0
  16. package/python/app/__init__.py +92 -0
  17. package/python/app/core/__init__.py +3 -0
  18. package/python/app/core/_json_store.py +93 -0
  19. package/python/app/core/board_store.py +316 -0
  20. package/python/app/core/cache.py +81 -0
  21. package/python/app/core/icon_store.py +48 -0
  22. package/python/app/core/jobs.py +159 -0
  23. package/python/app/core/models.py +86 -0
  24. package/python/app/core/name_override_store.py +58 -0
  25. package/python/app/core/name_store.py +33 -0
  26. package/python/app/core/net_guard.py +44 -0
  27. package/python/app/core/schedule_store.py +191 -0
  28. package/python/app/core/scheduler.py +73 -0
  29. package/python/app/core/service.py +1255 -0
  30. package/python/app/core/settings_store.py +476 -0
  31. package/python/app/core/spec_zh.py +194 -0
  32. package/python/app/core/spec_zh_ext.py +322 -0
  33. package/python/app/core/tray_store.py +139 -0
  34. package/python/app/core/update_checker.py +98 -0
  35. package/python/app/core/workbench_store.py +53 -0
  36. package/python/app/diagnostics.py +152 -0
  37. package/python/app/siui/__init__.py +8 -0
  38. package/python/app/siui/components/__init__.py +1 -0
  39. package/python/app/siui/components/button.py +2623 -0
  40. package/python/app/siui/components/combobox_.py +348 -0
  41. package/python/app/siui/components/container.py +290 -0
  42. package/python/app/siui/components/editbox.py +976 -0
  43. package/python/app/siui/components/graphic.py +265 -0
  44. package/python/app/siui/components/label.py +632 -0
  45. package/python/app/siui/components/menu/__init__.py +1 -0
  46. package/python/app/siui/components/menu/abstracts/__init__.py +2 -0
  47. package/python/app/siui/components/menu/abstracts/ani_manager.py +157 -0
  48. package/python/app/siui/components/menu/abstracts/menu.py +157 -0
  49. package/python/app/siui/components/menu/menu.py +107 -0
  50. package/python/app/siui/components/menu/option.py +175 -0
  51. package/python/app/siui/components/menu_.py +1019 -0
  52. package/python/app/siui/components/slider/__init__.py +1 -0
  53. package/python/app/siui/components/slider/slider.py +186 -0
  54. package/python/app/siui/components/slider_.py +1506 -0
  55. package/python/app/siui/components/tooltip/__init__.py +1 -0
  56. package/python/app/siui/components/tooltip/tooltip.py +152 -0
  57. package/python/app/siui/components/widgets/__init__.py +6 -0
  58. package/python/app/siui/components/widgets/abstracts/__init__.py +5 -0
  59. package/python/app/siui/components/widgets/abstracts/button.py +390 -0
  60. package/python/app/siui/components/widgets/abstracts/container.py +94 -0
  61. package/python/app/siui/components/widgets/abstracts/label.py +331 -0
  62. package/python/app/siui/components/widgets/abstracts/line_edit.py +108 -0
  63. package/python/app/siui/components/widgets/abstracts/widget.py +398 -0
  64. package/python/app/siui/components/widgets/button.py +542 -0
  65. package/python/app/siui/components/widgets/container.py +876 -0
  66. package/python/app/siui/components/widgets/label.py +265 -0
  67. package/python/app/siui/components/widgets/line_edit.py +105 -0
  68. package/python/app/siui/components/widgets/scrollarea.py +159 -0
  69. package/python/app/siui/core/__init__.py +44 -0
  70. package/python/app/siui/core/alignment.py +28 -0
  71. package/python/app/siui/core/animation/abstract.py +112 -0
  72. package/python/app/siui/core/animation.py +556 -0
  73. package/python/app/siui/core/color.py +172 -0
  74. package/python/app/siui/core/effect.py +29 -0
  75. package/python/app/siui/core/enumrates.py +15 -0
  76. package/python/app/siui/core/event_filter.py +152 -0
  77. package/python/app/siui/core/globals.py +139 -0
  78. package/python/app/siui/core/painter.py +231 -0
  79. package/python/app/siui/core/token.py +84 -0
  80. package/python/app/siui/gui/__init__.py +12 -0
  81. package/python/app/siui/gui/color_group/__init__.py +6 -0
  82. package/python/app/siui/gui/color_group/bright.py +93 -0
  83. package/python/app/siui/gui/color_group/color_group.py +60 -0
  84. package/python/app/siui/gui/color_group/dark.py +93 -0
  85. package/python/app/siui/gui/font.py +81 -0
  86. package/python/app/siui/gui/scale.py +26 -0
  87. package/python/app/siui/siui_typing.py +36 -0
  88. package/python/app/ui/__init__.py +3 -0
  89. package/python/app/ui/a11y.py +2203 -0
  90. package/python/app/ui/about_dialog.py +371 -0
  91. package/python/app/ui/add_drawer.py +196 -0
  92. package/python/app/ui/board_manager.py +906 -0
  93. package/python/app/ui/check_box.py +86 -0
  94. package/python/app/ui/device_card.py +421 -0
  95. package/python/app/ui/device_dialog.py +77 -0
  96. package/python/app/ui/icon.ico +0 -0
  97. package/python/app/ui/icon.png +0 -0
  98. package/python/app/ui/login_dialog.py +346 -0
  99. package/python/app/ui/main_window.py +2744 -0
  100. package/python/app/ui/metrics_pick_dialog.py +236 -0
  101. package/python/app/ui/overlay_dialog.py +148 -0
  102. package/python/app/ui/power_button.py +97 -0
  103. package/python/app/ui/prop_widgets.py +738 -0
  104. package/python/app/ui/rename_dialog.py +139 -0
  105. package/python/app/ui/restart.py +48 -0
  106. package/python/app/ui/room_filter.py +170 -0
  107. package/python/app/ui/room_order_dialog.py +431 -0
  108. package/python/app/ui/scene_card.py +223 -0
  109. package/python/app/ui/schedule_dialog.py +464 -0
  110. package/python/app/ui/settings_dialog.py +924 -0
  111. package/python/app/ui/si_theme.py +855 -0
  112. package/python/app/ui/smooth_scroll.py +97 -0
  113. package/python/app/ui/status_panel.py +325 -0
  114. package/python/app/ui/theme_service.py +111 -0
  115. package/python/app/ui/toast.py +65 -0
  116. package/python/app/ui/tooltip.py +133 -0
  117. package/python/app/ui/tray/__init__.py +9 -0
  118. package/python/app/ui/tray/audio_bar.py +501 -0
  119. package/python/app/ui/tray/controller.py +323 -0
  120. package/python/app/ui/tray/draggable_row.py +62 -0
  121. package/python/app/ui/tray/manager_dialog.py +804 -0
  122. package/python/app/ui/tray/quick_window.py +937 -0
  123. package/python/app/ui/tray_icon.png +0 -0
  124. package/python/app/ui/tray_icon_light.png +0 -0
  125. package/python/app/ui/typewriter.py +59 -0
  126. package/python/app/ui/update_dialog.py +200 -0
  127. package/python/app/ui/update_flow.py +48 -0
  128. package/python/app/ui/voice_fab.py +151 -0
  129. package/python/app/ui/widgets_board.py +2191 -0
  130. package/python/app/ui/workbench_item.py +238 -0
  131. package/python/app/ui/workbench_panel.py +1055 -0
  132. package/python/mihome_bridge.py +754 -0
  133. package/python/run.py +286 -0
  134. package/python/smart_home/__init__.py +24 -0
  135. package/python/smart_home/adapters/__init__.py +50 -0
  136. package/python/smart_home/adapters/base.py +143 -0
  137. package/python/smart_home/adapters/ble.py +100 -0
  138. package/python/smart_home/adapters/dlna.py +227 -0
  139. package/python/smart_home/adapters/home_assistant.py +454 -0
  140. package/python/smart_home/adapters/hue.py +225 -0
  141. package/python/smart_home/adapters/kasa.py +239 -0
  142. package/python/smart_home/adapters/mihome.py +342 -0
  143. package/python/smart_home/adapters/network.py +250 -0
  144. package/python/smart_home/adapters/shelly.py +289 -0
  145. package/python/smart_home/adapters/tuya.py +95 -0
  146. package/python/smart_home/adapters/tv.py +26 -0
  147. package/python/smart_home/catalog.py +336 -0
  148. package/python/smart_home/cloud.py +85 -0
  149. package/python/smart_home/discovery.py +934 -0
  150. package/python/smart_home/localize.py +787 -0
  151. package/python/smart_home/manager.py +672 -0
  152. package/python/smart_home/oui_table.py +40550 -0
  153. package/python/smart_home/scan.py +73 -0
  154. package/python/smart_home/test_discovery_repairs.py +186 -0
  155. package/python/smart_home/test_localization_repairs.py +229 -0
  156. package/python/smart_home/test_offline.py +195 -0
  157. package/python/smart_home/test_repairs.py +107 -0
  158. package/python/smart_home/util.py +320 -0
  159. package/python/tests/__init__.py +1 -0
  160. package/python/tests/_isolate.py +20 -0
  161. package/python/tests/a11y_test.py +1673 -0
  162. package/python/tests/audio_test.py +153 -0
  163. package/python/tests/board_test.py +1414 -0
  164. package/python/tests/dispatch_test.py +115 -0
  165. package/python/tests/latency_test.py +200 -0
  166. package/python/tests/race_test.py +118 -0
  167. package/python/tests/schedule_test.py +311 -0
  168. package/python/tests/smoke_test.py +99 -0
  169. package/python/tests/subdevice_test.py +158 -0
  170. package/python/tests/test_bridge_integration.py +108 -0
  171. package/python/tests/test_ha_discovery.py +260 -0
  172. package/python/tests/test_home_assistant.py +365 -0
  173. package/python/tests/test_manager_integration.py +150 -0
  174. package/python/tests/test_mihome_repairs.py +117 -0
  175. package/python/tests/test_network_read_contract.py +50 -0
  176. package/python/tests/test_power_confirmation.py +95 -0
  177. package/python/tests/test_protocol_repairs.py +369 -0
  178. package/python/tests/test_yeelight_repairs.py +70 -0
  179. package/python/tests/theme_test.py +309 -0
  180. package/python/tests/update_test.py +93 -0
  181. package/python/tools/__init__.py +0 -0
  182. package/python/tools/diag_poll_timing.py +66 -0
  183. package/python/tools/diag_switch.py +106 -0
  184. package/requirements-optional.txt +4 -0
  185. package/requirements.txt +5 -0
  186. package/scripts/update-oui.py +108 -0
package/LICENSE ADDED
@@ -0,0 +1,270 @@
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright © 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+
6
+ Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for software and other kinds of works.
11
+
12
+ The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.
13
+
14
+ When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.
15
+
16
+ To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.
17
+
18
+ For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
19
+
20
+ Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.
21
+
22
+ For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.
23
+
24
+ Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.
25
+
26
+ Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.
27
+
28
+ The precise terms and conditions for copying, distribution and modification follow.
29
+
30
+ TERMS AND CONDITIONS
31
+
32
+ 0. Definitions.
33
+
34
+ “This License” refers to version 3 of the GNU General Public License.
35
+
36
+ “Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.
37
+
38
+ “The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.
39
+
40
+ To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.
41
+
42
+ A “covered work” means either the unmodified Program or a work based on the Program.
43
+
44
+ To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.
45
+
46
+ To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.
47
+
48
+ An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.
49
+
50
+ 1. Source Code.
51
+ The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.
52
+
53
+ A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.
54
+
55
+ The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.
56
+
57
+ The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.
58
+
59
+ The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.
60
+
61
+ The Corresponding Source for a work in source code form is that same work.
62
+
63
+ 2. Basic Permissions.
64
+ All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.
65
+
66
+ You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.
67
+
68
+ Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.
69
+
70
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
71
+ No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.
72
+
73
+ When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.
74
+
75
+ 4. Conveying Verbatim Copies.
76
+ You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.
77
+
78
+ You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.
79
+
80
+ 5. Conveying Modified Source Versions.
81
+ You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:
82
+
83
+ a) The work must carry prominent notices stating that you modified it, and giving a relevant date.
84
+
85
+ b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.
86
+
87
+ c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.
88
+
89
+ d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.
90
+
91
+ A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.
92
+
93
+ 6. Conveying Non-Source Forms.
94
+ You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:
95
+
96
+ a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.
97
+
98
+ b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.
99
+
100
+ c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.
101
+
102
+ d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.
103
+
104
+ e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.
105
+
106
+ A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.
107
+
108
+ A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.
109
+
110
+ “Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.
111
+
112
+ If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).
113
+
114
+ The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.
115
+
116
+ Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.
117
+
118
+ 7. Additional Terms.
119
+ “Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.
120
+
121
+ When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.
122
+
123
+ Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:
124
+
125
+ a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or
126
+
127
+ b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or
128
+
129
+ c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or
130
+
131
+ d) Limiting the use for publicity purposes of names of licensors or authors of the material; or
132
+
133
+ e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or
134
+
135
+ f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.
136
+
137
+ All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.
138
+
139
+ If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.
140
+
141
+ Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.
142
+
143
+ 8. Termination.
144
+ You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).
145
+
146
+ However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.
147
+
148
+ Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.
149
+
150
+ Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.
151
+
152
+ 9. Acceptance Not Required for Having Copies.
153
+ You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.
154
+
155
+ 10. Automatic Licensing of Downstream Recipients.
156
+ Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.
157
+
158
+ An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.
159
+
160
+ You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.
161
+
162
+ 11. Patents.
163
+ A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.
164
+
165
+ A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.
166
+
167
+ Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.
168
+
169
+ In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.
170
+
171
+ If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.
172
+
173
+ If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.
174
+
175
+ A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.
176
+
177
+ Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.
178
+
179
+ 12. No Surrender of Others' Freedom.
180
+ If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.
181
+
182
+ 13. Use with the GNU Affero General Public License.
183
+ Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.
184
+
185
+ 14. Revised Versions of this License.
186
+ The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
187
+
188
+ Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.
189
+
190
+ If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.
191
+
192
+ Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.
193
+
194
+ 15. Disclaimer of Warranty.
195
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
196
+
197
+ 16. Limitation of Liability.
198
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
199
+
200
+ 17. Interpretation of Sections 15 and 16.
201
+ If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.
202
+
203
+ END OF TERMS AND CONDITIONS
204
+
205
+ How to Apply These Terms to Your New Programs
206
+
207
+ If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
208
+
209
+ To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the “copyright” line and a pointer to where the full notice is found.
210
+
211
+ <one line to give the program's name and a brief idea of what it does.>
212
+ Copyright (C) <year> <name of author>
213
+
214
+ This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
215
+
216
+ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
217
+
218
+ You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
219
+
220
+ Also add information on how to contact you by electronic and paper mail.
221
+
222
+ If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode:
223
+
224
+ <program> Copyright (C) <year> <name of author>
225
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
226
+ This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
227
+
228
+ The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an “about box”.
229
+
230
+ You should also get your employer (if you work as a programmer) or school, if any, to sign a “copyright disclaimer” for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <https://www.gnu.org/licenses/>.
231
+
232
+ The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <https://www.gnu.org/philosophy/why-not-lgpl.html>.
233
+
234
+ ===============================================================================
235
+ Third-party Components
236
+ ===============================================================================
237
+
238
+ This project includes the following third-party components:
239
+
240
+ 1. PySide6-SiliconUI
241
+ - Source: https://github.com/H1DDENADM1N/PySide6-SiliconUI
242
+ - License: GPL-3.0
243
+ - Copyright: Copyright (c) 2024-2025 H1DDENADM1N
244
+ - Location: app/siui/
245
+ - Description: A powerful and artistic UI library based on PySide6
246
+
247
+ 2. mijiaAPI
248
+ - Source: https://github.com/Do1e/mijia-api
249
+ - License: GPL-3.0
250
+ - Description: Xiaomi MiHome API wrapper
251
+
252
+ These components are used under the terms of their respective licenses.
253
+ All GPL-3.0 licensed components remain under GPL-3.0 when combined with this project.
254
+
255
+ -------------------------------------------------------------------------------
256
+ dsh-mihome — attribution / 来源说明
257
+
258
+ Copyright (C) 2026 Jessicaisleep
259
+
260
+ This plugin bundles a source copy of MiHome-Windows under python/:
261
+ MiHome-Windows — https://github.com/huanyuejue/MiHome-Windows
262
+ GPL-3.0-or-later
263
+
264
+ Mi Home protocol access goes through mijiaAPI:
265
+ mijiaAPI — https://github.com/Do1e/mijia-api
266
+ MIT
267
+
268
+ The plugin's own code (lib/, client.js, scripts/, python/mihome_bridge.py) is
269
+ released under GPL-3.0-or-later, because python/ is a GPL-3.0-or-later work and
270
+ the two are distributed together.
package/README.md CHANGED
@@ -1,3 +1,177 @@
1
- # Temporary Holding Version
1
+ # dsh-mihome · 全屋智能工作台
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 一个 DSH 插件,在同一工作台发现设备、查看实际能力、执行控制并组合自定义场景。名称沿用 `dsh-mihome`;现提供米家云端、Home Assistant 实体及部分本地协议的统一入口。
4
+
5
+ **推荐接入路径:米家设备直接登录;其他生态优先接入 Home Assistant,再由本插件按实体实际能力控制。** 无需网关的已支持本地协议也可以直接连接。扫描发现不等于已经配对,设备型号和类别也不能证明它支持某项操作。
6
+
7
+ ## 中文
8
+
9
+ ### 当前支持矩阵
10
+
11
+ | 接入方式 | 已实现的控制/读取 | 条件与边界 |
12
+ | --- | --- | --- |
13
+ | 米家云端 | 设备、属性读写、规格动作、米家场景、电源及耗材 | 需要扫码登录;写入需米家设备响应明确 code=0;code=1 仅表示网关接收、执行结果未知 |
14
+ | Home Assistant | 灯、插座/开关、风扇、空调、窗帘、媒体播放器、扫地机、锁、加湿器、选择器、数值、按钮、场景/脚本和传感器 | 需要 HA 地址及长期访问令牌;依实体状态、服务和 feature 标记生成控件;冰箱、洗衣机、烘干机等取决于其 HA 集成实际暴露的实体 |
15
+ | Tuya 局域网 | 显式 DP 映射的读取和写入 | 需要 device ID、本地密钥、协议版本和经过核实的 DP 规格;不把 DP1 猜成开关 |
16
+ | Shelly | Gen2 switch/cover;Gen1 已观察到的 relay,roller 位置只读 | 根据返回的组件生成能力;当前仅默认组件 ID 0,Gen1 需配置 `shelly_gen: 1` |
17
+ | 传统 TP-Link Kasa | 有 `relay_state` 的设备开关 | 传统 9999 协议;新加密 Tapo/Kasa 和插排子设备未覆盖 |
18
+ | Yeelight | 设备报告支持的方法对应的电源、亮度、RGB/色温 | 需要 LAN 控制;能力依 `support` 列表,色温范围需核实配置 |
19
+ | Philips Hue | 指定灯具实际状态对应的开关、亮度、颜色;有范围的色温 | 需要桥接器用户及灯 ID;首次配对返回的用户名需自行保存到私有连接配置 |
20
+ | Tasmota / WLED | 已校准的状态、单继电器/调光;WLED JSON 控制 | 依实际状态字段生成控件;Tasmota 色彩/色温当前只读 |
21
+ | miIO 本地 | 明确映射的读写方法 | UDP 54321、token、显式 `miio_mapping`/`miot_mapping`;不猜型号命令 |
22
+ | ONVIF / DLNA | 部分设备信息和只读媒体信息 | ONVIF 鉴权和完整控制未实现;不提供猜测性重启 |
23
+ | 路由器 / 交换机 / 光猫 / NAS | 公开管理页的标题、文本、表单输入与链接 | 没有通用的登录、超管提权或设置写入实现;不是官网 APP 的完整复刻 |
24
+ | BLE / Matter / HomeKit / Cast / AirPlay / MQTT 等发现线索 | 广播或网络身份识别 | BLE 私有 GATT、Matter/HomeKit 配对、厂商私有控制未实现;可通过合适的 HA 集成补充 |
25
+ | LIFX / Samsung / LG / Vizio 原生接口、ESPHome 伪 REST | 当前仅识别或无直接控制项 | 旧版未经核实的写接口已禁用;优先走 HA 集成 |
26
+
27
+ 本轮协议验证使用离线报文、mock 和本机模拟 HTTP 服务,**没有连接真实家电执行控制**。这证明已覆盖的契约和失败边界,不能替代每个品牌、型号、固件的实机验收。
28
+
29
+ ### 安装与依赖
30
+
31
+ 需要 DSH `>=0.2.2-rc.3 <0.3.0`、Python 3.12,以及可访问家庭网络的 DSH Host。通过 DSH 的插件管理器安装本地目录或发布包;请勿手工改写正在使用的 profile。
32
+
33
+ 在插件目录准备 Python 环境(Windows):
34
+
35
+ ```powershell
36
+ python -m venv .venv
37
+ .\.venv\Scripts\python.exe -m pip install -r requirements.txt
38
+ .\.venv\Scripts\python.exe -m pip install -r requirements-optional.txt
39
+ ```
40
+
41
+ 核心依赖包括 `mijiaAPI`、`qrcode`、`requests` 和 `pycryptodome`。可选依赖 `zeroconf`、`tinytuya`、`bleak` 分别补充 mDNS、Tuya 和 BLE;缺少可选库会跳过对应通道。BLE 还需要可用的蓝牙硬件、系统权限及设备处于广播状态。
42
+
43
+ 插件配置:`pythonPath` 指向该环境的 Python;留空时使用插件目录下的 `.venv`。`dataDir` 留空使用插件数据目录;`requestTimeoutMs` 为普通请求预算,较长的全屋操作另有预算;`loginTimeoutMs` 为米家扫码等待时间。发布包不会携带本机虚拟环境和登录数据。
44
+
45
+ ### 从空列表开始
46
+
47
+ 1. 打开侧栏「全屋智能」,进入全屋页。米家页可扫码登录原有账号。
48
+ 2. 点击扫描,或在「配置连接」添加私有连接。即使自动发现失败,也可以手动添加受支持的终端。
49
+ 3. 推荐先配置 `home_assistant:main`,填入下方 HA 示例,再扫描。HA 的实体会展开为独立设备;多个 HA 实例的同名实体相互隔离。
50
+ 4. 打开设备详情,确认当前状态、可读/可写权限、数值范围、枚举和动作参数后操作。没有控制项表示没有取得经过适配的能力;不要据类别猜命令。
51
+ 5. 连接保存后输入框清空。列表只显示是否已配置,不会回显密钥;编辑时提交完整替换对象,删除只移除本插件保存的连接,不修改远端账号。
52
+
53
+ 连接配置仅通过面板提交,保存在 DSH Host 的凭据记录 `mihome/devices`。不要把 token、密码或 local key 发给聊天工具、写进源码、profile 配置或公开设备字段。
54
+
55
+ Home Assistant 连接 ID:`home_assistant:main`,私有配置:
56
+
57
+ ```json
58
+ {
59
+ "base_url": "http://192.168.1.10:8123",
60
+ "token": "<在面板填写长期访问令牌>",
61
+ "name": "家里的 Home Assistant"
62
+ }
63
+ ```
64
+
65
+ 手动 IP 终端使用 `协议:IP`,并在配置中明确 `ip`,如 `tuya:192.168.1.20`。DP 的类型、权限、范围和枚举必须来自该产品规格,示例值不可套用到未知设备:
66
+
67
+ ```json
68
+ {
69
+ "ip": "192.168.1.20",
70
+ "device_id": "<设备 ID>",
71
+ "local_key": "<本地密钥>",
72
+ "version": 3.3,
73
+ "dps": {
74
+ "1": {"key": "power", "kind": "bool", "writable": true}
75
+ }
76
+ }
77
+ ```
78
+
79
+ 其他已实现连接字段包括 Hue 的 `hue_username`/`hue_light_id`,Yeelight 的 `support`/`color_temp_range`,以及 miIO 的 `token` 和显式方法映射。它们都是私有连接对象字段;不能由名称猜出凭据或设备的写入能力。
80
+
81
+ ### 发现、中文控件与限制
82
+
83
+ 发现包含 ARP、受限 ping、TCP 端口、HTTP 指纹、SSDP、mDNS、Tuya UDP、miIO UDP 和 BLE 广播。支持逗号或空格分隔的子网/端口参数;只接受 IPv4 CIDR 和有效端口,跨 VLAN/访客网隔离、睡眠设备和不广播设备可能不可见。较大网段不会逐地址全量 ping;不能保证列出整个网络中的每台设备。
84
+
85
+ 已观察到的无开放 TCP 端口主机仍可保留;广播发现不依赖 ARP 候选,BLE 地址不需要伪造 IP。扫描缓存按参数区分,刷新会重新发现。设备列表的型号、厂商和类别是线索;控制能力来自规格或适配器确认的字段。
86
+
87
+ 翻译依次使用官方规格中文、协议字典、AliGenie/华为智慧生活等平台术语及通用拆词;未知词保留原名。保留原始属性 key、数值类型、枚举、范围、单位与权限,UI 和工具使用同一 key。平台字典是术语补充,不代表已经接入该平台账号或完整厂商 API。
88
+
89
+ OUI 采用 IEEE MA-L 快照,保留组织原文,不把 MAC 前缀当设备型号。本地管理地址、组播地址、非法 MAC 和歧义前缀不报厂商。更新脚本为 `scripts/update-oui.py`,可传 `--input`、`--output`、`--snapshot-date`、`--sha256`;已记录源快照 SHA-256,生成过程可复现。
90
+
91
+ ### 自定义场景
92
+
93
+ 在面板创建/编辑/删除场景,或使用 `smart_home_scenes`。场景按顺序执行,逐步记录成功和错误,单步失败继续其余步骤,汇总只统计明确成功的步骤。当前是**手动执行场景**;「回家模式」是场景名字,没有自动到家、定时或事件触发引擎。
94
+
95
+ ```json
96
+ {
97
+ "name": "回家模式",
98
+ "actions": [
99
+ {"device": "shelly:192.168.1.21", "mode": "power", "state": true},
100
+ {"device": "home_assistant:main/cover.living_room", "mode": "write", "name": "position", "value": 0}
101
+ ]
102
+ }
103
+ ```
104
+
105
+ 以上设备 ID 和属性 key 仅示例;实际请从详情复制,动作 `params` 按展示的 schema/输入列表填写 JSON。场景文件原子保存,损坏的文件不会被当作空列表覆盖。
106
+
107
+ ### 失败、超时与取消
108
+
109
+ 适配器失败会保留为失败,不再包装成成功;未知电源状态不会显示为关机。米家 `code=1` 只表示网关接收,不作为设备执行成功。HA 等协议的 HTTP 服务确认也不等于物理动作已完成,必要时读取状态确认。
110
+
111
+ Node 超时或取消会结束该共享 Python 桥接进程;同一桥接的其他在途请求标记为中断、结果未知。Python 操作超时会先取消协程,再退出专用桥接进程,防止同步调用或后台线程继续本地执行,也不再处理排队请求。下次请求使用新进程。**已经发送到设备或云端的命令无法撤回**,取消后应先读取状态再决定重试,避免重复动作。登录等待使用独立通道。
112
+
113
+ ### 工具与开发验证
114
+
115
+ 最近一次离线回归为 Node 80/80(约 4.47 秒)、Python 109/109(约 2.13 秒);本机 Home Assistant 模拟端到端用例经过真实 Node/Python 桥接,但不是家中设备验收。另测试了桥接预算超时与设备自身网络超时的区分。fake React 冒烟也不是浏览器验收。详细范围和剩余边界见 `docs/REPAIR-VALIDATION.md`。
116
+
117
+ 保留 `mihome_login`、`mihome_devices`、`mihome_device`、`mihome_control`、`mihome_scenes`、`mihome_sensors`;新增 `smart_home_scan`、`smart_home_devices`、`smart_home_device`、`smart_home_control`、`smart_home_scrape`、`smart_home_scenes`、`smart_home_catalog`。详情输出是控制 key、类型、范围和参数的依据。
118
+
119
+ ```powershell
120
+ node --test
121
+ .\.venv\Scripts\python.exe -m unittest discover -s python/tests -v
122
+ .\.venv\Scripts\python.exe python/smart_home/test_offline.py
123
+ .\.venv\Scripts\python.exe python/smart_home/test_repairs.py
124
+ .\.venv\Scripts\python.exe python/smart_home/test_discovery_repairs.py
125
+ .\.venv\Scripts\python.exe python/smart_home/test_localization_repairs.py
126
+ node scripts/check-i18n.mjs client.js
127
+ node scripts/render-smoke.mjs client.js
128
+ ```
129
+
130
+ 测试覆盖失败传播、场景/凭据、取消/进程重启、发现输入与合并、HA 多实例、能力与协议报文等。`node --test tests/whole-home-e2e.test.js` 另用本机模拟 HA REST 服务跑真实 Node→JSON-Lines Python→manager→适配器调用链,并在子进程禁止非回环网络;不访问真实网关或家电。模拟界面测试不等于真实浏览器视觉验收。项目为 Node Cordis Host + Python JSON-Lines 桥接;入口在 `lib/index.js`、`lib/panel.js`、`python/mihome_bridge.py`,全屋实现位于 `python/smart_home/`。
131
+
132
+ ### 资料来源与许可
133
+
134
+ 协议采用官方资料优先、维护中的社区实现补充;并非所有品牌公开完整控制 API。
135
+
136
+ - [Home Assistant REST](https://developers.home-assistant.io/docs/api/rest/) / [实例发现](https://raw.githubusercontent.com/home-assistant/developers.home-assistant/master/docs/api/instance_discovery.md)
137
+ - [MIoT 规格](https://miot-spec.org/miot-spec-v2/) / [mijiaAPI](https://github.com/Do1e/mijia-api) / [miIO 协议社区文档](https://github.com/OpenMiHome/mihome-binary-protocol/blob/master/doc/PROTOCOL.md)
138
+ - [Shelly Gen2](https://shelly-api-docs.shelly.cloud/gen2/) / [TinyTuya](https://github.com/jasonacox/tinytuya) / [python-kasa](https://github.com/python-kasa/python-kasa)
139
+ - [Yeelight](https://www.yeelight.com/en_US/developer) / [Hue](https://developers.meethue.com/develop/hue-api/)
140
+ - [Tasmota 状态](https://tasmota.github.io/docs/JSON-Status-Responses/) / [WLED JSON API](https://kno.wled.ge/interfaces/json-api/) / [ONVIF](https://www.onvif.org/profiles/)
141
+ - [zeroconf](https://python-zeroconf.readthedocs.io/) / [Bleak](https://bleak.readthedocs.io/) / [IEEE OUI](https://standards-oui.ieee.org/oui/oui.txt)
142
+
143
+ 本项目 GPL-3.0-or-later;沿用的上游 Python 代码保留相应许可。参考外部协议文档不表示厂商背书。
144
+
145
+ ---
146
+
147
+ ## English
148
+
149
+ ### Purpose and support
150
+
151
+ One DSH workbench for discovery, capability-based controls, private device connections and manually executed scenes. Mi Home devices use the existing cloud login. For other ecosystems, **Home Assistant is the recommended broad integration path**; supported local protocols can also connect directly.
152
+
153
+ Implemented direct paths include Mi Home specifications/actions, explicit Tuya DP mappings, Shelly switch/cover components, legacy Kasa relays, supported Yeelight methods, Hue lights, calibrated Tasmota/WLED operations, and explicitly configured miIO methods. Home Assistant entities expose controls based on their states, available services and feature flags: lights, switches, fans, climate, covers, media players, vacuums, locks, humidifiers, selects, numbers, buttons, scenes/scripts and sensors. Appliance coverage depends on the upstream integration's entities.
154
+
155
+ Routers, switches, ONTs and NAS currently provide public management-page information, not a universal authenticated settings editor or super-admin bypass. BLE, Matter, HomeKit and other discovery clues do not imply pairing or control. Unverified native LIFX/TV/ESPHome write paths are disabled; use suitable HA integrations. ONVIF/DLNA support is partial and read-only. The Chinese matrix above records protocol-specific limits.
156
+
157
+ ### Installation and connection
158
+
159
+ Requires DSH `>=0.2.2-rc.3 <0.3.0`, Python 3.12, and a Host that can reach the devices. Install through DSH Plugin Manager. Create a virtual environment and install `requirements.txt`; install `requirements-optional.txt` for mDNS, Tuya and BLE. Set `pythonPath` when the environment is outside the plugin directory. Virtual environments, credentials and runtime data are not shipped in the package.
160
+
161
+ Open the smart-home tab, scan, or add a private connection even when the list is empty. To connect HA, use ID `home_assistant:main` with a JSON object containing `base_url` and a long-lived `token`, then scan. Its entities appear independently; identical entity names on different hubs remain separate. Other endpoints use `protocol:IP` with an explicit `ip` and verified protocol credentials/mappings.
162
+
163
+ Connection payloads are stored only in the DSH Host credential record `mihome/devices`. Lists return IDs/configured flags, never secret values; saving clears the input. Editing replaces the full payload. Do not send tokens through the chat tools or put them in public fields, source or profile configuration.
164
+
165
+ ### Discovery, controls and scenes
166
+
167
+ Discovery combines ARP, bounded ping/port probes, HTTP, SSDP, mDNS, Tuya/miIO UDP and BLE advertisements. It accepts IPv4 CIDRs and valid ports, preserves observed hosts without open TCP ports, and keeps BLE addresses without inventing IPs. It cannot enumerate every sleeping, isolated or non-advertising device. Translation preserves original keys, value types, enumerations, ranges, units and access flags; unknown terms keep their original names.
168
+
169
+ Scenes run sequentially and record each step. Failed steps do not prevent later steps; only explicitly successful results count as success. There is no arrival, timer or event trigger engine. Use actual device IDs/keys from the detail view and follow the action's JSON parameter schema. Corrupt scene files are not silently overwritten.
170
+
171
+ Failures stay failures, unknown power stays unknown, and Mi Home gateway acceptance (`code=1`) is not a confirmed device write. On timeout/abort, including a Python operation timeout, the shared Python bridge is terminated before accepting queued work; other pending operations report interrupted/unknown outcomes. A later request starts a fresh process. Commands already sent to a device/cloud cannot be recalled. Read state before retrying.
172
+
173
+ ### Verification and license
174
+
175
+ Run the Node and Python commands in the Chinese development section. Regression coverage uses offline packets, mocks and localhost servers; it does not establish compatibility with every real model/firmware. Mock UI tests do not establish live rendering. IEEE MA-L data can be regenerated with `scripts/update-oui.py`; organization names remain verbatim and ambiguous/local/multicast prefixes do not produce guessed vendors.
176
+
177
+ GPL-3.0-or-later, with upstream Python license notices retained. Protocol references are linked above; use of those documents does not imply vendor endorsement.