Repository: XiaoMi/ha_xiaomi_home Branch: main Commit: f290ff17d89d Files: 100 Total size: 1.4 MB Directory structure: gitextract_vsvd5d4t/ ├── .github/ │ ├── ISSUE_TEMPLATE/ │ │ ├── bug_report.yaml │ │ └── config.yml │ └── workflows/ │ ├── release.yaml │ ├── test.yaml │ └── validate.yaml ├── .gitignore ├── .pylintrc ├── CHANGELOG.md ├── CLAUDE.md ├── CONTRIBUTING.md ├── LICENSE.md ├── LegalNotice.md ├── README.md ├── custom_components/ │ └── xiaomi_home/ │ ├── __init__.py │ ├── binary_sensor.py │ ├── button.py │ ├── climate.py │ ├── config_flow.py │ ├── cover.py │ ├── device_tracker.py │ ├── event.py │ ├── fan.py │ ├── humidifier.py │ ├── light.py │ ├── manifest.json │ ├── media_player.py │ ├── miot/ │ │ ├── common.py │ │ ├── const.py │ │ ├── i18n/ │ │ │ ├── de.json │ │ │ ├── en.json │ │ │ ├── es.json │ │ │ ├── fr.json │ │ │ ├── it.json │ │ │ ├── ja.json │ │ │ ├── nl.json │ │ │ ├── pt-BR.json │ │ │ ├── pt.json │ │ │ ├── ru.json │ │ │ ├── tr.json │ │ │ ├── zh-Hans.json │ │ │ └── zh-Hant.json │ │ ├── lan/ │ │ │ └── profile_models.yaml │ │ ├── miot_client.py │ │ ├── miot_cloud.py │ │ ├── miot_device.py │ │ ├── miot_error.py │ │ ├── miot_i18n.py │ │ ├── miot_lan.py │ │ ├── miot_mdns.py │ │ ├── miot_mips.py │ │ ├── miot_network.py │ │ ├── miot_spec.py │ │ ├── miot_storage.py │ │ ├── resource/ │ │ │ └── oauth_redirect_page.html │ │ ├── specs/ │ │ │ ├── bool_trans.yaml │ │ │ ├── multi_lang.json │ │ │ ├── spec_add.json │ │ │ ├── spec_filter.yaml │ │ │ ├── spec_modify.yaml │ │ │ └── specv2entity.py │ │ └── web_pages.py │ ├── notify.py │ ├── number.py │ ├── select.py │ ├── sensor.py │ ├── switch.py │ ├── text.py │ ├── translations/ │ │ ├── de.json │ │ ├── en.json │ │ ├── es.json │ │ ├── fr.json │ │ ├── it.json │ │ ├── ja.json │ │ ├── nl.json │ │ ├── pt-BR.json │ │ ├── pt.json │ │ ├── ru.json │ │ ├── tr.json │ │ ├── zh-Hans.json │ │ └── zh-Hant.json │ ├── vacuum.py │ └── water_heater.py ├── doc/ │ ├── CONTRIBUTING_zh.md │ └── README_zh.md ├── hacs.json ├── install.sh ├── test/ │ ├── .gitignore │ ├── check_rule_format.py │ ├── conftest.py │ ├── pytest.ini │ ├── test_cloud.py │ ├── test_common.py │ ├── test_lan.py │ ├── test_mdns.py │ ├── test_mips.py │ ├── test_network.py │ ├── test_spec.py │ └── test_storage.py └── tools/ ├── common.py └── update_lan_rule.py ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.yaml ================================================ name: Bug Report / 报告问题 description: Create a report to help us improve. / 报告问题以帮助我们改进 body: - type: textarea attributes: label: Describe the Bug / 描述问题 description: | > A clear and concise description of what the bug is. Please include the device model information (Like xiaomi.gateway.hub1 which can be found in Device info page). > 清晰且简明地描述问题。请注明设备 model 信息(例如 xiaomi.gateway.hub1,可在设备详情页查询)。 validations: required: true - type: textarea attributes: label: How to Reproduce / 复现步骤 description: | > If applicable, add screenshots to help explain your problem. You can attach images by clicking this area to highlight it and then dragging files in. Steps to reproduce the behavior: > 如有需要,可添加截图以帮助解释问题。点击此区域以高亮显示并拖动截图文件以上传。请详细描述复现步骤: placeholder: | 1. Go to ... 2. Click on ... 3. Scroll down to ... 4. See error validations: required: true - type: input attributes: label: Expected Behavior / 预期结果 description: | > A clear and concise description of what you expected to happen. > 描述预期结果。 validations: required: true - type: input attributes: label: Reproduce Time / 问题复现的时间点 description: | > Year-month-day, 24-hour time. > 年-月-日,24小时制。 placeholder: "2025-01-01 17:00:00" validations: required: true - type: textarea attributes: label: Home Assistant Logs / 系统日志 description: | > Please [set the log level](https://github.com/XiaoMi/ha_xiaomi_home/blob/main/CONTRIBUTING.md#reporting-bugs) to `debug` and try to reproduce the problem. > [Settings > System > Logs > DOWNLOAD FULL LOG](https://my.home-assistant.io/redirect/logs) > Filter `xiaomi_home` > If you are concerned about privacy, you can send the log to ha_xiaomi_home@xiaomi.com . The mail body should include the link to this issue. > 请将[日志级别设置](https://github.com/XiaoMi/ha_xiaomi_home/blob/main/doc/CONTRIBUTING_zh.md#%E6%88%91%E5%8F%AF%E4%BB%A5%E5%A6%82%E4%BD%95%E8%B4%A1%E7%8C%AE)为 `debug` 并尝试复现问题。 > [设置 > 系统 > 日志 > 下载完整日志](https://my.home-assistant.io/redirect/logs) > 筛选 `xiaomi_home` > 如果您担心隐私问题,可将日志发送至 ha_xiaomi_home@xiaomi.com ,邮件正文附上此问题的链接。 - type: input attributes: label: Log Timezone / 日志时区 description: | > The [timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) of the timestamp in the log. > 日志所用时间戳的[时区](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones)。 placeholder: "Asia/Shanghai" validations: required: true - type: input attributes: label: Home Assistant Core Version / Home Assistant Core 版本 description: | > [Settings > About](https://my.home-assistant.io/redirect/info) > [设置 > 关于 Home Assistant](https://my.home-assistant.io/redirect/info) placeholder: "2024.11.0" validations: required: true - type: input attributes: label: Home Assistant Operation System Version / Home Assistant Operation System 版本 description: | > [Settings > About](https://my.home-assistant.io/redirect/info) > [设置 > 关于 Home Assistant](https://my.home-assistant.io/redirect/info) placeholder: "13.0" validations: required: true - type: input attributes: label: Xiaomi Home Integration Version / 米家集成版本 description: | > [Settings > Devices & services > Configured > `Xiaomi Home`](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home) > [设置 > 设备与服务 > 已配置 > `Xiaomi Home`](https://my.home-assistant.io/redirect/integration/?domain=xiaomi_home) placeholder: "v0.1.0" validations: required: true - type: textarea attributes: label: Additional Context / 其他说明 ================================================ FILE: .github/ISSUE_TEMPLATE/config.yml ================================================ blank_issues_enabled: false contact_links: - name: Feature Suggestion / 功能建议 url: https://github.com/XiaoMi/ha_xiaomi_home/discussions/new?category=ideas about: Share ideas for enhancements or new features. / 建议改进或增加新功能 - name: Support and Help / 支持与帮助 url: https://github.com/XiaoMi/ha_xiaomi_home/discussions/categories/q-a about: Please ask and answer questions here. / 请在这里提问和答疑 ================================================ FILE: .github/workflows/release.yaml ================================================ name: Release on: release: types: [published] jobs: release-zip: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: ZIP Component Dir run: | cd ${{ github.workspace }}/custom_components/xiaomi_home zip -r xiaomi_home.zip ./ - name: Upload zip to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: ${{ github.workspace }}/custom_components/xiaomi_home/xiaomi_home.zip asset_name: xiaomi_home.zip tag: ${{ github.ref }} overwrite: true ================================================ FILE: .github/workflows/test.yaml ================================================ name: Tests on: push: branches: - main pull_request: branches: - main workflow_dispatch: jobs: check-rule-format: runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v4 - name: Install dependencies run: | python -m pip install --upgrade pip pip install pytest pytest-asyncio pytest-dependency zeroconf paho.mqtt psutil cryptography slugify - name: Check rule format with pytest run: | pytest -v -s -m github ./test/check_rule_format.py - name: Unit test with pytest run: | pytest -v -s -m github ./test/ ================================================ FILE: .github/workflows/validate.yaml ================================================ name: Validate on: push: branches: - main pull_request: branches: - main workflow_dispatch: jobs: validate-hassfest: runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v4 - name: Hassfest validation uses: home-assistant/actions/hassfest@master validate-hacs: runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v4 - name: HACS validation uses: hacs/action@main with: category: integration validate-lint: runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v4 - name: Install dependencies run: | python -m pip install --upgrade pip pip install pylint - name: Static analyse the code with pylint run: | pylint $(git ls-files '*.py') validate-setup: runs-on: ubuntu-latest steps: - name: Checkout the repository uses: actions/checkout@v4 - name: Install the integration run: | export config_path=./test_config mkdir $config_path ./install.sh $config_path echo "default_config:" >> $config_path/configuration.yaml echo "logger:" >> $config_path/configuration.yaml echo " default: info" >> $config_path/configuration.yaml echo " logs:" >> $config_path/configuration.yaml echo " custom_components.xiaomi_home: debug" >> $config_path/configuration.yaml - name: Setup Home Assistant id: homeassistant uses: ludeeus/setup-homeassistant@main with: config-dir: ./test_config ================================================ FILE: .gitignore ================================================ __pycache__ .pytest_cache .vscode .idea requirements.txt ================================================ FILE: .pylintrc ================================================ # This Pylint rcfile contains a best-effort configuration to uphold the # best-practices and style described in the Google Python style guide: # https://google.github.io/styleguide/pyguide.html # # Its canonical open-source location is: # https://google.github.io/styleguide/pylintrc [MAIN] # Files or directories to be skipped. They should be base names, not paths. ignore=third_party # Files or directories matching the regex patterns are skipped. The regex # matches against base names, not paths. ignore-patterns= # Pickle collected data for later comparisons. persistent=no # List of plugins (as comma separated values of python modules names) to load, # usually to register additional checkers. load-plugins= # Use multiple processes to speed up Pylint. jobs=4 # Allow loading of arbitrary C extensions. Extensions are imported into the # active Python interpreter and may run arbitrary code. unsafe-load-any-extension=no [MESSAGES CONTROL] # Only show warnings with the listed confidence levels. Leave empty to show # all. Valid levels: HIGH, INFERENCE, INFERENCE_FAILURE, UNDEFINED confidence= # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option # multiple time (only on the command line, not in the configuration file where # it should appear only once). See also the "--disable" option for examples. #enable= # Disable the message, report, category or checker with the given id(s). You # can either give multiple identifiers separated by comma (,) or put this # option multiple times (only on the command line, not in the configuration # file where it should appear only once).You can also use "--disable=all" to # disable everything first and then reenable specific checks. For example, if # you want to run only the similarities checker, you can use "--disable=all # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" disable=R, abstract-method, apply-builtin, arguments-differ, attribute-defined-outside-init, backtick, bad-option-value, basestring-builtin, buffer-builtin, c-extension-no-member, consider-using-enumerate, cmp-builtin, cmp-method, coerce-builtin, coerce-method, delslice-method, div-method, eq-without-hash, execfile-builtin, file-builtin, filter-builtin-not-iterating, fixme, getslice-method, global-statement, hex-method, idiv-method, implicit-str-concat, import-error, import-self, import-star-module-level, input-builtin, intern-builtin, invalid-str-codec, locally-disabled, long-builtin, long-suffix, map-builtin-not-iterating, misplaced-comparison-constant, missing-function-docstring, metaclass-assignment, next-method-called, next-method-defined, no-absolute-import, no-init, # added no-member, no-name-in-module, no-self-use, nonzero-method, oct-method, old-division, old-ne-operator, old-octal-literal, old-raise-syntax, parameter-unpacking, print-statement, raising-string, range-builtin-not-iterating, raw_input-builtin, rdiv-method, reduce-builtin, relative-import, reload-builtin, round-builtin, setslice-method, signature-differs, standarderror-builtin, suppressed-message, sys-max-int, trailing-newlines, unichr-builtin, unicode-builtin, unnecessary-pass, unpacking-in-except, useless-else-on-loop, useless-suppression, using-cmp-argument, wrong-import-order, xrange-builtin, zip-builtin-not-iterating, [REPORTS] # Set the output format. Available formats are text, parseable, colorized, msvs # (visual studio) and html. You can also give a reporter class, eg # mypackage.mymodule.MyReporterClass. output-format=text # Tells whether to display a full report or only the messages reports=no # Python expression which should return a note less than 10 (10 is the highest # note). You have access to the variables errors warning, statement which # respectively contain the number of errors / warnings messages and the total # number of statements analyzed. This is used by the global evaluation report # (RP0004). evaluation=10.0 - ((float(5 * error + warning + refactor + convention) / statement) * 10) # Template used to display messages. This is a python new-style format string # used to format the message information. See doc for all details #msg-template= [BASIC] # Good variable names which should always be accepted, separated by a comma good-names=main,_ # Bad variable names which should always be refused, separated by a comma bad-names= # Colon-delimited sets of names that determine each other's naming style when # the name regexes allow several styles. name-group= # Include a hint for the correct naming format with invalid-name include-naming-hint=no # List of decorators that produce properties, such as abc.abstractproperty. Add # to this list to register other decorators that produce valid properties. property-classes=abc.abstractproperty,cached_property.cached_property,cached_property.threaded_cached_property,cached_property.cached_property_with_ttl,cached_property.threaded_cached_property_with_ttl # Regular expression matching correct function names function-rgx=^(?:(?PsetUp|tearDown|setUpModule|tearDownModule)|(?P_?[A-Z][a-zA-Z0-9]*)|(?P_?[a-z][a-z0-9_]*))$ # Regular expression matching correct variable names variable-rgx=^[a-z][a-z0-9_]*$ # Regular expression matching correct constant names const-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ # Regular expression matching correct attribute names attr-rgx=^_{0,2}[a-z][a-z0-9_]*$ # Regular expression matching correct argument names argument-rgx=^[a-z][a-z0-9_]*$ # Regular expression matching correct class attribute names class-attribute-rgx=^(_?[A-Z][A-Z0-9_]*|__[a-z0-9_]+__|_?[a-z][a-z0-9_]*)$ # Regular expression matching correct inline iteration names inlinevar-rgx=^[a-z][a-z0-9_]*$ # Regular expression matching correct class names class-rgx=^_?[A-Z][a-zA-Z0-9]*$ # Regular expression matching correct module names module-rgx=^(_?[a-z][a-z0-9_]*|__init__)$ # Regular expression matching correct method names method-rgx=(?x)^(?:(?P_[a-z0-9_]+__|runTest|setUp|tearDown|setUpTestCase|tearDownTestCase|setupSelf|tearDownClass|setUpClass|(test|assert)_*[A-Z0-9][a-zA-Z0-9_]*|next)|(?P_{0,2}[A-Z][a-zA-Z0-9_]*)|(?P_{0,2}[a-z][a-z0-9_]*))$ # Regular expression which should only match function or class names that do # not require a docstring. no-docstring-rgx=(__.*__|main|test.*|.*test|.*Test)$ # Minimum line length for functions/classes that require docstrings, shorter # ones are exempt. docstring-min-length=12 [TYPECHECK] # List of decorators that produce context managers, such as # contextlib.contextmanager. Add to this list to register other decorators that # produce valid context managers. contextmanager-decorators=contextlib.contextmanager,contextlib2.contextmanager # List of module names for which member attributes should not be checked # (useful for modules/projects where namespaces are manipulated during runtime # and thus existing member attributes cannot be deduced by static analysis. It # supports qualified module names, as well as Unix pattern matching. ignored-modules= # List of class names for which member attributes should not be checked (useful # for classes with dynamically set attributes). This supports the use of # qualified names. ignored-classes=optparse.Values,thread._local,_thread._local # List of members which are set dynamically and missed by pylint inference # system, and so shouldn't trigger E1101 when accessed. Python regular # expressions are accepted. generated-members= [FORMAT] # Maximum number of characters on a single line. max-line-length=80 # TODO(https://github.com/pylint-dev/pylint/issues/3352): Direct pylint to exempt # lines made too long by directives to pytype. # Regexp for a line that is allowed to be longer than the limit. ignore-long-lines=(?x)( ^\s*(\#\ )??$| ^\s*(from\s+\S+\s+)?import\s+.+$) # Allow the body of an if to be on the same line as the test if there is no # else. single-line-if-stmt=yes # Maximum number of lines in a module max-module-lines=99999 # String used as indentation unit. The internal Google style guide mandates 2 # spaces. Google's externaly-published style guide says 4, consistent with # PEP 8. Here, we use 4 spaces. indent-string=' ' # Number of spaces of indent required inside a hanging or continued line. indent-after-paren=4 # Expected format of line ending, e.g. empty (any line ending), LF or CRLF. expected-line-ending-format= [MISCELLANEOUS] # List of note tags to take in consideration, separated by a comma. notes=TODO [STRING] # This flag controls whether inconsistent-quotes generates a warning when the # character used as a quote delimiter is used inconsistently within a module. check-quote-consistency=yes [VARIABLES] # Tells whether we should check for unused import in __init__ files. init-import=no # A regular expression matching the name of dummy variables (i.e. expectedly # not used). dummy-variables-rgx=^\*{0,2}(_$|unused_|dummy_) # List of additional names supposed to be defined in builtins. Remember that # you should avoid to define new builtins when possible. additional-builtins= # List of strings which can identify a callback function by name. A callback # name must start or end with one of those strings. callbacks=cb_,_cb # List of qualified module names which can have objects that can redefine # builtins. redefining-builtins-modules=six,six.moves,past.builtins,future.builtins,functools [LOGGING] # Logging modules to check that the string format arguments are in logging # function parameter format logging-modules=logging,absl.logging,tensorflow.io.logging [SIMILARITIES] # Minimum lines number of a similarity. min-similarity-lines=4 # Ignore comments when computing similarities. ignore-comments=yes # Ignore docstrings when computing similarities. ignore-docstrings=yes # Ignore imports when computing similarities. ignore-imports=no [SPELLING] # Spelling dictionary name. Available dictionaries: none. To make it working # install python-enchant package. spelling-dict= # List of comma separated words that should not be checked. spelling-ignore-words= # A path to a file that contains private dictionary; one word per line. spelling-private-dict-file= # Tells whether to store unknown words to indicated private dictionary in # --spelling-private-dict-file option instead of raising a message. spelling-store-unknown-words=no [IMPORTS] # Deprecated modules which should not be used, separated by a comma deprecated-modules=regsub, TERMIOS, Bastion, rexec, sets # Create a graph of every (i.e. internal and external) dependencies in the # given file (report RP0402 must not be disabled) import-graph= # Create a graph of external dependencies in the given file (report RP0402 must # not be disabled) ext-import-graph= # Create a graph of internal dependencies in the given file (report RP0402 must # not be disabled) int-import-graph= # Force import order to recognize a module as part of the standard # compatibility libraries. known-standard-library= # Force import order to recognize a module as part of a third party library. known-third-party=enchant, absl # Analyse import fallback blocks. This can be used to support both Python 2 and # 3 compatible code, which means that the block might have code that exists # only in one or another interpreter, leading to false positives when analysed. analyse-fallback-blocks=no [CLASSES] # List of method names used to declare (i.e. assign) instance attributes. defining-attr-methods=__init__, __new__, setUp # List of member names, which should be excluded from the protected access # warning. exclude-protected=_asdict, _fields, _replace, _source, _make # List of valid names for the first argument in a class method. valid-classmethod-first-arg=cls, class_ # List of valid names for the first argument in a metaclass class method. valid-metaclass-classmethod-first-arg=mcs ================================================ FILE: CHANGELOG.md ================================================ # CHANGELOG ## v0.4.7 ### Added - Add turkish language in multi_lang.json. [#1593](https://github.com/XiaoMi/ha_xiaomi_home/pull/1593) ### Changed - Remove unused info getting from central hub gateway. [#1574](https://github.com/XiaoMi/ha_xiaomi_home/pull/1574) - Remove xiaomi.router.rd03 from `UNSUPPORTED_MODELS` and add era.airp.cwb03, k0918.toothbrush.t700 into it. [#1567](https://github.com/XiaoMi/ha_xiaomi_home/pull/1567) ### Fixed - Update the BLE mesh device online state from the central hub gateway. Partially fix the BLE mesh device online state. [#1579](https://github.com/XiaoMi/ha_xiaomi_home/pull/1579) - Add unit for xiaomi.toothbrush.p001 brush-head-left-level property. [#1588](https://github.com/XiaoMi/ha_xiaomi_home/pull/1588) - Fix the playing-state property's access field of xiaomi.wifispeaker.lx04, xiaomi.wifispeaker.lx06, xiaomi.wifispeaker.x08c and xiaomi.wifispeaker.l04m. [#1567](https://github.com/XiaoMi/ha_xiaomi_home/pull/1567) - Fix the MIoT-Spec-V2 of xiaomi.airc.h09h00 humidity-range unit. [#1567](https://github.com/XiaoMi/ha_xiaomi_home/pull/1567) ## v0.4.6 ### Added - Add tv-box device as the media player entity. [#1562](https://github.com/XiaoMi/ha_xiaomi_home/pull/1562) - Set play-control service's play-loop-mode property as the sound mode. [#1562](https://github.com/XiaoMi/ha_xiaomi_home/pull/1562) ### Changed - Use constant value to indicate the cloud MQTT broker host domain. [#1530](https://github.com/XiaoMi/ha_xiaomi_home/pull/1530) - Use constant value to indicate the timer delay of refreshing devices. [#1555](https://github.com/XiaoMi/ha_xiaomi_home/pull/1555) - Set the playing-state property as the required property in the play-control service of the speaker device. [#1552](https://github.com/XiaoMi/ha_xiaomi_home/pull/1552) - Set the playing-state property as the required property in the optional play-control service of the television. [#1562](https://github.com/XiaoMi/ha_xiaomi_home/pull/1562) ### Fixed - Catch paho-mqtt subscribe error properly. [#1551](https://github.com/XiaoMi/ha_xiaomi_home/pull/1551) - After the network resumes, keep retrying to fetch the device list until it succeeds. [#1555](https://github.com/XiaoMi/ha_xiaomi_home/pull/1555) - Catch the http post error properly. [#1555](https://github.com/XiaoMi/ha_xiaomi_home/pull/1555) - Fix the format and the access field of daikin.aircondition.k2 and daikin.airfresh.k33 string value properties. [#1561](https://github.com/XiaoMi/ha_xiaomi_home/pull/1561) ## v0.4.5 ### Changed - Ignore mdns REMOVED package. [#1296](https://github.com/XiaoMi/ha_xiaomi_home/pull/1296) - Format value type first, then evaluate by expression, and set precision at last. [#1516](https://github.com/XiaoMi/ha_xiaomi_home/pull/1516) ### Fixed - Fix xiaomi.derh.lite temperature precision. [#1505](https://github.com/XiaoMi/ha_xiaomi_home/pull/1505) - Fix xiaomi.waterpuri.s1200g filter property unit, lxzn.valve.02 electricity property unit, xiaomi.aircondition.c24 power consumption device class, and cuco.plug.cp7pd power consumption and power value precision. [#1517](https://github.com/XiaoMi/ha_xiaomi_home/pull/1517) ## v0.4.4 ### Added - Add Turkish language support. [#1468](https://github.com/XiaoMi/ha_xiaomi_home/pull/1468) ### Fixed - Stop MQTT internal loop immediately when main loop is closed. [#1465](https://github.com/XiaoMi/ha_xiaomi_home/pull/1465) - Fix the float value precision. [#1485](https://github.com/XiaoMi/ha_xiaomi_home/pull/1485) - Fix the climate entity swing mode setting. [#1486](https://github.com/XiaoMi/ha_xiaomi_home/pull/1486) - Fix the MIoT-Spec-V2 of cykj.hood.jyj22 urn version 4, lumi.motion.bmgl01 siid=2 piid=2 value-list, ykcn.valve.cbcs power property value unit, ainice.sensor_occupy.3b people-number property and qdhkl.airc.a42 hvac mode. [#1496](https://github.com/XiaoMi/ha_xiaomi_home/pull/1496) ## v0.4.3 ### Changed - Remove `VacuumEntityFeature.BATTERY` from the vacuum entity. [#1433](https://github.com/XiaoMi/ha_xiaomi_home/pull/1433) - Subscribe the proxy gateway child device up messages even though the device is offline. [#1393](https://github.com/XiaoMi/ha_xiaomi_home/pull/1393) ### Fixed - Fix the integer value step. [#1388](https://github.com/XiaoMi/ha_xiaomi_home/pull/1388) - Fix the contact-state property value format. [#1387](https://github.com/XiaoMi/ha_xiaomi_home/pull/1387) - Fix the MIoT-Spec-V2 of xiaomi.airc.rr0r00 swing mode and hyd.airer.lyjpro current-position. [#1394](https://github.com/XiaoMi/ha_xiaomi_home/pull/1394) - Fix roidmi.vacuum.v60 siid=2 aiid=3 out field format. - Ignore unsupported properties of xiaomi.wifispeaker.l15a and 759413.aircondition.iez. - Add an alongside button entity for xiaomi.wifispeaker.l05b play action. - Add zhimi.fan.za1 fan mode description in zh_Hans. - Fix the error reported by pylint-4.0.0. [#1455](https://github.com/XiaoMi/ha_xiaomi_home/pull/1455) ## v0.4.2 ### Changed - Set the battery service's start-charge action as the fallback action to support RETURN_HOME feature of the vacuum entity. [#1344](https://github.com/XiaoMi/ha_xiaomi_home/pull/1344) ### Fixed - Correct the property value format after expression calculation. [#1366](https://github.com/XiaoMi/ha_xiaomi_home/pull/1366) - Fix the MIoT-Spec-V2 of xiaomi.fan.p70 and xiaomi.fan.p76 fan level, xiaomi.airc.rr0r00 and xiaomi.airc.h43h00 humidity-range, and zhimi.humidifier.ca4 water level. [#1367](https://github.com/XiaoMi/ha_xiaomi_home/pull/1367) - Ignore the unsupported model hmpace.motion.v6nfc. - Delete all unsupported MIoT-Spec-V2 instances of narwa.vacuum.001 and narwa.vacuum.ax11. [#1355](https://github.com/XiaoMi/ha_xiaomi_home/pull/1355) ## v0.4.1 ### Changed - The setting option "Cover closed position" in CONFIGURE is changed to "Cover dead zone width". [#1301](https://github.com/XiaoMi/ha_xiaomi_home/pull/1301) - Add an alongside switch entity for 090615.aircondition.ktf and juhl.aircondition.hvac. [#1303](https://github.com/XiaoMi/ha_xiaomi_home/pull/1303) ### Fixed - Fix the vacuum status so that the vacuum activity will not always be idle. [#1299](https://github.com/XiaoMi/ha_xiaomi_home/pull/1299) - Set the device on when the switch status is False or None. [#1303](https://github.com/XiaoMi/ha_xiaomi_home/pull/1303) - Hide sensitive info in printing logs. [#1328](https://github.com/XiaoMi/ha_xiaomi_home/pull/1328) - Fix the MIoT-Spec-V2 of cuco.plug.cp2d electric current, xiaomi.fan.p45 fan level, sanmei.valve.s1 power consumption, current and voltage, xiaomi.aircondition.c17, xiaomi.aircondition.m16 and xiaomi.airc.h40h00 humidity-range unit. [#1329](https://github.com/XiaoMi/ha_xiaomi_home/pull/1329) ## v0.4.0 ### Added - Add the watch as the device tracker entity. [#1189](https://github.com/XiaoMi/ha_xiaomi_home/pull/1189) - Add the wifi speaker and the television as the media player entity. [#706](https://github.com/XiaoMi/ha_xiaomi_home/pull/706) - Add an option in CONFIGURE to set the cover closed position. [#1242](https://github.com/XiaoMi/ha_xiaomi_home/pull/1242) - Add notifications to show the status of the local connection to the central hub gateway. [#1280](https://github.com/XiaoMi/ha_xiaomi_home/pull/1280) - Import the device from the third party cloud. [#1258](https://github.com/XiaoMi/ha_xiaomi_home/pull/1258) ### Changed - Add an alongside switch entity for viomi.waterheater.m1. [#1255](https://github.com/XiaoMi/ha_xiaomi_home/pull/1255) - Do not subscribe BLE device online/offline state message. [#1264](https://github.com/XiaoMi/ha_xiaomi_home/pull/1264) ### Fixed - Keep the first element of the discovered ip address list as the recently added address when getting mdns result. [#1250](https://github.com/XiaoMi/ha_xiaomi_home/pull/1250) - Subscribe local topics every time when connected to the central hub gateway. [#1266](https://github.com/XiaoMi/ha_xiaomi_home/pull/1266) - Record the "closing" and "closed" status that occur frequently in the motor-controller, the window-opener and the curtain service. [#1262](https://github.com/XiaoMi/ha_xiaomi_home/pull/1262) - Fix xiaomi.aircondition.c24 total power consumption unit, adp.motor.adswb4 motor switch, cgllc.airm.cgd1st environment temperature, and shhf.light.sflt11 fan switch status. [#1256](https://github.com/XiaoMi/ha_xiaomi_home/pull/1256) ## v0.3.4 ### Added - Exclude the unsupported device models. [#1205](https://github.com/XiaoMi/ha_xiaomi_home/pull/1205) ### Changed - Subscribe the BLE device upstream messages even though the device is offline. [#1207](https://github.com/XiaoMi/ha_xiaomi_home/pull/1207) - Record "opening", "closing" and "closed" status of the airer service that occur frequently and do not record "stop" status for the cover entity. [#1235](https://github.com/XiaoMi/ha_xiaomi_home/pull/1235) - Modify README about spec_filter.yaml and the event attributes. [#1237](https://github.com/XiaoMi/ha_xiaomi_home/pull/1237) ### Fixed - Fix the reconnect delay time to be reset when the client is connected to the broker. [#1200](https://github.com/XiaoMi/ha_xiaomi_home/pull/1200) - Fix the HA warning in the logs related to vacuum state setting. [#694](https://github.com/XiaoMi/ha_xiaomi_home/pull/694) - Fix the operation mode when the device does not have a mode property. [#1199](https://github.com/XiaoMi/ha_xiaomi_home/pull/1199) - Fix 090615.aircondition.ktf environment temperature. [#1210](https://github.com/XiaoMi/ha_xiaomi_home/pull/1210) - Fix a missing variable in translation it.json. [#1215](https://github.com/XiaoMi/ha_xiaomi_home/pull/1215) - Fix yutai.plug.fsov8m power consumption and ignore bjkcz.curtain.kczble curtain status. [#1236](https://github.com/XiaoMi/ha_xiaomi_home/pull/1236) ## v0.3.3 ### Changed - Change the log level of error "mips unsub internal error, 4, None". [#1135](https://github.com/XiaoMi/ha_xiaomi_home/pull/1135) - Add necessary logs for distinguishing the set_properties command source. [#1160](https://github.com/XiaoMi/ha_xiaomi_home/pull/1160) ### Fixed - Fix tofan.airrtc.wk01 thermostat and air conditioner service. [#1160](https://github.com/XiaoMi/ha_xiaomi_home/pull/1160) - Fix mrbond.airer.m1t closing status. [#1134](https://github.com/XiaoMi/ha_xiaomi_home/pull/1134) - Fix the MIoT-Spec-V2 of xiaomi.fan.p69 fan service, ainice.sensor_occupy.3b people number, cykj.hood.jyj22 ventilation switch status, xiaomi.fan.p43 fan level, zhimi.airp.ua1a pm10 density, 090615.switch.x1tpm switch status, dmaker.fan.p33 fan-level. [#1132](https://github.com/XiaoMi/ha_xiaomi_home/pull/1132) - Fix cubee.airrtc.th123e and cubee.airrtc.th123w MIoT-Spec-V2 instance descriptions in Russian. - Fix ijai.vacuum.v1 suction-state value-list descriptions in Chinese. - Fix the misuse of Chinese brackets in multi_lang.json. - The unit of the humidity-range property of xiaomi.aircondition.mt0, xiaomi.aircondition.c35, xiaomi.aircondition.c24 and xiaomi.aircondition.c20 is "none". [#1187](https://github.com/XiaoMi/ha_xiaomi_home/pull/1187) ## v0.3.2 > Xiaomi Home has been added to the Home Assistant Community Store (HACS) as a default since May 8, 2025. ### Added - Modify MIoT-Spec-V2 property format by spec_modify.yaml. [#1111](https://github.com/XiaoMi/ha_xiaomi_home/pull/1111) ### Changed - Update the instructions of Xiaomi Home integration installation from HACS. [#102](https://github.com/XiaoMi/ha_xiaomi_home/pull/102) [#1088](https://github.com/XiaoMi/ha_xiaomi_home/pull/1088) - Add an alongside switch entity for zimi.waterheater.h03 and xiaomi.waterheater.yms2. [#1115](https://github.com/XiaoMi/ha_xiaomi_home/pull/1115) ### Fixed - Fix Chinese encoding in LAN Control. [#1114](https://github.com/XiaoMi/ha_xiaomi_home/pull/1114) - Fix the MIoT-Spec-V2 of lxzn.switch.jcbcsm power consumption, voltage and current, shhf.light.sfla10 fan direction, zhimi.fan.za4 fan-level, zhimi.fan.sa1 fan-level. [#1110](https://github.com/XiaoMi/ha_xiaomi_home/pull/1110) - Revise the Chinese descriptions of loock.lock.t2pv1 door state value-list. [#1110](https://github.com/XiaoMi/ha_xiaomi_home/pull/1110) ## v0.3.1 ### Changed - Setting the fan speed level when the fan is off will turning the fan on first. [#1031](https://github.com/XiaoMi/ha_xiaomi_home/pull/1031) ### Fixed - Fix update device list error when there is no shared devices. [#1024](https://github.com/XiaoMi/ha_xiaomi_home/pull/1024) - Fix the humidifier get_prop_value error when the property is None. [#1035](https://github.com/XiaoMi/ha_xiaomi_home/pull/1035) - Fix the MIoT-Spec-V2 of zhimi.fan.v3 fan-level, cuco.plug.cp1md voltage and current, zimi.plug.zncz01 electric-power, giot.plug.v8icm power-consumption unit, yunmi.kettle.r3 tds unit, and dmaker.fan.p5 fan-level. [#1037](https://github.com/XiaoMi/ha_xiaomi_home/pull/1037) ## v0.3.0 注意:v0.3.0 变更了部分实体 unique_id 的生成规则,如果勾选 xiaomi_home > 配置 > 更新实体转换规则,会导致部分实体已配置的自动化失效。如果想要避免重新配置大量自动化,可使用这个[补丁](https://github.com/XiaoMi/ha_xiaomi_home/pull/972)。 CAUTION: v0.3.0 changes the unique_id of some entities. If you check the option `xiaomi_home > CONFIGURE > Update entity conversion rules`, it may cause the automation settings for these entities to fail. To avoid having to reconfigure a large number of automation settings, you can use this [patch](https://github.com/XiaoMi/ha_xiaomi_home/pull/972). ### Added - Import the devices in the shared homes and the separated shared devices. [#1021](https://github.com/XiaoMi/ha_xiaomi_home/pull/1021) - Support _attr_hvac_action of the climate entity. [#956](https://github.com/XiaoMi/ha_xiaomi_home/pull/956) - Add custom defined MIoT-Spec-V2 instance via spec_add.json. [#953](https://github.com/XiaoMi/ha_xiaomi_home/pull/953) ### Fixed - Ignore 'Event loop is closed' when unsub a closed event loop. [#991](https://github.com/XiaoMi/ha_xiaomi_home/pull/991) - Fix contact-state for linp.magnet.m1 and loock.safe.v1. [#977](https://github.com/XiaoMi/ha_xiaomi_home/pull/977) - Fix the mode initialization error of aupu.bhf_light.s368m. [#955](https://github.com/XiaoMi/ha_xiaomi_home/pull/955) - Fix the MIoT-Spec-V2 of lumi.gateway.mcn001, qmi.plug.psv3, lumi.motion.acn001, izq.sensor_occupy.24, linp.sensor_occupy.hb01 and yunmi.waterpuri.s20. [#949](https://github.com/XiaoMi/ha_xiaomi_home/pull/949) ## v0.2.4 ### Added - Convert the submersion-state, the contact-state and the occupancy-status property to the binary_sensor entity. [#905](https://github.com/XiaoMi/ha_xiaomi_home/pull/905) ### Changed - suittc.airrtc.wk168 mode descriptions are set to strings of numbers from 1 to 16. [#921](https://github.com/XiaoMi/ha_xiaomi_home/pull/921) - Do not set _attr_suggested_display_precision when the spec.expr is set in spec_modify.yaml [#929](https://github.com/XiaoMi/ha_xiaomi_home/pull/929) - Set "unknown event msg" log to info level. ### Fixed - hhcc.plantmonitor.v1 soil moisture and soil ec icon and unit. [#927](https://github.com/XiaoMi/ha_xiaomi_home/pull/27) - cuco.plug.cp2 voltage and power value ratio. - cgllc.airmonitor.s1 unit ppb. - roswan.waterpuri.lte01 tds unit. - lumi.relay.c2acn01 power consumption unit - xiaomi.bhf_light.s1 fan level of ventilation. ## v0.2.3 ### Changed - Specify the service name and the property name during the climate entity's on/off feature initialization. [#899](https://github.com/XiaoMi/ha_xiaomi_home/pull/899) - Remove the useless total-battery property from `SPEC_PROP_TRANS_MAP`. ### Fixed - Fix the hvac mode setting error when changing the preset mode of the ptc-bath-heater. - Fix the ambiguous descriptions of yeelink.bhf_light.v10 ptc-bath-heater mode value-list. - Fix the power consumption value of chuangmi.plug.212a01. [#910](https://github.com/XiaoMi/ha_xiaomi_home/pull/910) ## v0.2.2 This version has modified the conversion rules of the climate entity, which will have effect on the devices with the ptc-bath-heater, the air-conditioner and the air-fresh service. After updating, you need to restart Home Assistant and check `xiaomi_home > CONFIGURE > Update entity conversion rules > NEXT` to reload the integration. 这个版本修改了浴霸、空调、新风机的实体转换规则,更新之后需要重启 Home Assistant,并且勾选 `xiaomi_home > 配置 > 更新实体转换规则 > 下一步` 重新加载集成。 ### Added - Add conversion rules for the air-conditioner service and the air-fresh service. [#879](https://github.com/XiaoMi/ha_xiaomi_home/pull/879) ### Changed - Convert the mode of the ptc bath heater to the preset mode of the climate entity. [#874](https://github.com/XiaoMi/ha_xiaomi_home/pull/874) - Use Home Assistant default icon when device_class is set. [#855](https://github.com/XiaoMi/ha_xiaomi_home/pull/855) ### Fixed - Fix xiaomi.aircondition.m9 humidity-range unit. [#878](https://github.com/XiaoMi/ha_xiaomi_home/pull/878) - Fix MIoT-Spec-V2 conflicts of xiaomi.fan.p5 and mike.bhf_light.2. [#866](https://github.com/XiaoMi/ha_xiaomi_home/pull/866) ## v0.2.1 ### Added - Add the preset mode for the thermostat. [#833](https://github.com/XiaoMi/ha_xiaomi_home/pull/833) ### Changed - Change paho-mqtt version to adapt Home Assistant 2025.03. [#839](https://github.com/XiaoMi/ha_xiaomi_home/pull/839) - Revert to use multi_lang.json. [#834](https://github.com/XiaoMi/ha_xiaomi_home/pull/834) ### Fixed - Fix the opening and the closing status of linp.wopener.wd1lb. [#826](https://github.com/XiaoMi/ha_xiaomi_home/pull/826) - Fix the format type of the wind-reverse property. [#810](https://github.com/XiaoMi/ha_xiaomi_home/pull/810) - Fix the fan-level property without value-list but with value-range. [#808](https://github.com/XiaoMi/ha_xiaomi_home/pull/808) ## v0.2.0 This version has modified some default units of sensors. After updating, it may cause Home Assistant to pop up some compatibility warnings. You can re-add the integration to resolve it. 这个版本修改了一些传感器默认单位,更新后会导致 Home Assistant 弹出一些兼容性提示,您可以重新添加集成解决。 ### Added - Add prop trans rule for surge-power. [#595](https://github.com/XiaoMi/ha_xiaomi_home/pull/595) - Support modify spec and value conversion. [#663](https://github.com/XiaoMi/ha_xiaomi_home/pull/663) - Support the electric blanket. [#781](https://github.com/XiaoMi/ha_xiaomi_home/pull/781) - Add device with motor-control service as cover entity. [#688](https://github.com/XiaoMi/ha_xiaomi_home/pull/688) ### Changed - Update README file. [#681](https://github.com/XiaoMi/ha_xiaomi_home/pull/681) [#747](https://github.com/XiaoMi/ha_xiaomi_home/pull/747) - Update CONTRIBUTING.md. [#681](https://github.com/XiaoMi/ha_xiaomi_home/pull/681) - Refactor climate.py. [#614](https://github.com/XiaoMi/ha_xiaomi_home/pull/614) ### Fixed - Fix variable name or comment errors & fix test_lan error. [#678](https://github.com/XiaoMi/ha_xiaomi_home/pull/678) [#690](https://github.com/XiaoMi/ha_xiaomi_home/pull/690) - Fix water heater error & some type error. [#684](https://github.com/XiaoMi/ha_xiaomi_home/pull/684) - Fix fan level with value-list & fan reverse [#689](https://github.com/XiaoMi/ha_xiaomi_home/pull/689) - Fix sensor display precision [#708](https://github.com/XiaoMi/ha_xiaomi_home/pull/708) - Fix event:motion-detected without arguments [#712](https://github.com/XiaoMi/ha_xiaomi_home/pull/712) ## v0.1.5b2 ### Added - Support binary sensors to be displayed as text sensor entities and binary sensor entities. [#592](https://github.com/XiaoMi/ha_xiaomi_home/pull/592) - Add miot cloud test case. [#620](https://github.com/XiaoMi/ha_xiaomi_home/pull/620) - Add test case for user cert. [#638](https://github.com/XiaoMi/ha_xiaomi_home/pull/638) - Add mips test case & Change mips reconnect logic. [#641](https://github.com/XiaoMi/ha_xiaomi_home/pull/641) - Support remove device. [#622](https://github.com/XiaoMi/ha_xiaomi_home/pull/622) - Support italian translation. [#183](https://github.com/XiaoMi/ha_xiaomi_home/pull/183) ### Changed - Refactor miot spec. [#592](https://github.com/XiaoMi/ha_xiaomi_home/pull/592) - Refactor miot mips & fix type errors. [#365](https://github.com/XiaoMi/ha_xiaomi_home/pull/365) - Using logging for test case log print. [#636](https://github.com/XiaoMi/ha_xiaomi_home/pull/636) - Add power properties trans. [#571](https://github.com/XiaoMi/ha_xiaomi_home/pull/571) - Move web page to html. [#627](https://github.com/XiaoMi/ha_xiaomi_home/pull/627) ### Fixed - Fix miot cloud and mdns error. [#637](https://github.com/XiaoMi/ha_xiaomi_home/pull/637) - Fix type error ## v0.1.5b1 This version will cause some Xiaomi routers that do not support access (#564) to become unavailable. You can update the device list in the configuration or delete it manually. ### Added - Fan entity support direction ctrl [#556](https://github.com/XiaoMi/ha_xiaomi_home/pull/556) ### Changed - Filter miwifi.* devices and xiaomi.router.rd03 [#564](https://github.com/XiaoMi/ha_xiaomi_home/pull/564) ### Fixed - Fix multi ha instance login [#560](https://github.com/XiaoMi/ha_xiaomi_home/pull/560) - Fix fan speed [#464](https://github.com/XiaoMi/ha_xiaomi_home/pull/464) - The number of profile models updated from 660 to 823. [#583](https://github.com/XiaoMi/ha_xiaomi_home/pull/583) ## v0.1.5b0 ### Added - Add missing parameter state_class [#101](https://github.com/XiaoMi/ha_xiaomi_home/pull/101) ### Changed - Make git update guide more accurate [#561](https://github.com/XiaoMi/ha_xiaomi_home/pull/561) ### Fixed - Limit *light.mode count (value-range) [#535](https://github.com/XiaoMi/ha_xiaomi_home/pull/535) - Update miot cloud raise error msg [#551](https://github.com/XiaoMi/ha_xiaomi_home/pull/551) - Fix table header misplacement [#554](https://github.com/XiaoMi/ha_xiaomi_home/pull/554) ## v0.1.4 ### Added - Refactor miot network, add network detection logic, improve devices filter logic. [458](https://github.com/XiaoMi/ha_xiaomi_home/pull/458) [#191](https://github.com/XiaoMi/ha_xiaomi_home/pull/191) ### Changed - Remove tev dependency for lan control & fixs. [#333](https://github.com/XiaoMi/ha_xiaomi_home/pull/333) - Use yaml to parse action params. [#447](https://github.com/XiaoMi/ha_xiaomi_home/pull/447) - Update issue template. [#445](https://github.com/XiaoMi/ha_xiaomi_home/pull/445) - Remove duplicate dependency(aiohttp) [#390](https://github.com/XiaoMi/ha_xiaomi_home/pull/390) ### Fixed ## v0.1.4b1 ### Added - Support devices filter, and device changed notify logical refinement. [#332](https://github.com/XiaoMi/ha_xiaomi_home/pull/332) ### Changed - Readme amend HACS installation. [#404](https://github.com/XiaoMi/ha_xiaomi_home/pull/404) ### Fixed - Fix unit_convert AttributeError, Change to catch all Exception. [#396](https://github.com/XiaoMi/ha_xiaomi_home/pull/396) - Ignore undefined piid and keep processing following arguments. [#377](https://github.com/XiaoMi/ha_xiaomi_home/pull/377) - Fix some type error, wrong use of any and Any. [#338](https://github.com/XiaoMi/ha_xiaomi_home/pull/338) - Fix lumi.switch.acn040 identify service translation of zh-Hans [#412](https://github.com/XiaoMi/ha_xiaomi_home/pull/412) ## v0.1.4b0 ### Added ### Changed ### Fixed - Fix miot cloud token refresh logic. [#307](https://github.com/XiaoMi/ha_xiaomi_home/pull/307) - Fix lan ctrl filter logic. [#303](https://github.com/XiaoMi/ha_xiaomi_home/pull/303) ## v0.1.3 ### Added ### Changed - Remove default bug label. [#276](https://github.com/XiaoMi/ha_xiaomi_home/pull/276) - Improve multi-language translation actions. [#256](https://github.com/XiaoMi/ha_xiaomi_home/pull/256) - Use aiohttp instead of waiting for blocking calls. [#227](https://github.com/XiaoMi/ha_xiaomi_home/pull/227) - Language supports dt. [#237](https://github.com/XiaoMi/ha_xiaomi_home/pull/237) ### Fixed - Fix local control error. [#271](https://github.com/XiaoMi/ha_xiaomi_home/pull/271) - Fix README_zh and miot_storage. [#270](https://github.com/XiaoMi/ha_xiaomi_home/pull/270) ## v0.1.2 ### Added - Support Xiaomi Heater devices. https://github.com/XiaoMi/ha_xiaomi_home/issues/124 https://github.com/XiaoMi/ha_xiaomi_home/issues/117 - Language supports pt, pt-BR. ### Changed - Adjust the minimum version of HASS core to 2024.4.4 and above versions. ### Fixed ## v0.1.1 ### Added ### Changed ### Fixed - Fix humidifier trans rule. https://github.com/XiaoMi/ha_xiaomi_home/issues/59 - Fix get homeinfo error. https://github.com/XiaoMi/ha_xiaomi_home/issues/22 - Fix air-conditioner switch on. https://github.com/XiaoMi/ha_xiaomi_home/issues/37 https://github.com/XiaoMi/ha_xiaomi_home/issues/16 - Fix invalid cover status. https://github.com/XiaoMi/ha_xiaomi_home/issues/11 https://github.com/XiaoMi/ha_xiaomi_home/issues/85 - Water heater entity add STATE_OFF. https://github.com/XiaoMi/ha_xiaomi_home/issues/105 https://github.com/XiaoMi/ha_xiaomi_home/issues/17 ## v0.1.0 ### Added - First version ### Changed ### Fixed ================================================ FILE: CLAUDE.md ================================================ # CLAUDE.md This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. ## Project Overview Xiaomi Home Integration is an official Home Assistant integration for controlling Xiaomi IoT smart devices. It connects to devices via Xiaomi Cloud (MQTT) or locally through Xiaomi Central Hub Gateway. The integration converts MIoT-Spec-V2 device specifications into Home Assistant entities. ## Development Commands ### Installation & Setup ```bash # Install to Home Assistant config directory ./install.sh /path/to/config # Install test dependencies pip install pytest pytest-asyncio pytest-dependency zeroconf paho.mqtt psutil cryptography slugify ``` ### Testing ```bash # Run all tests pytest -v -s -m github ./test/ # Run specific test files pytest -v -s ./test/test_spec.py pytest -v -s ./test/test_cloud.py pytest -v -s ./test/test_lan.py # Check rule format pytest -v -s -m github ./test/check_rule_format.py ``` ### Code Quality ```bash # Run pylint (follows Google Python Style Guide) pylint $(git ls-files '*.py') # Lint specific files pylint custom_components/xiaomi_home/*.py ``` ### Validation ```bash # HACS validation (run by GitHub Actions) # Uses: hacs/action@main # Hassfest validation (run by GitHub Actions) # Uses: home-assistant/actions/hassfest@master ``` ## Architecture Overview ### Core Components (miot/) The integration is built around the `miot/` core package: **miot_client.py**: Top-level client instance representing a logged-in Xiaomi user. Each user login creates one MIoTClient. Manages authentication, device list, and message routing. **miot_cloud.py**: OAuth 2.0 authentication and HTTP API calls to Xiaomi Cloud. Handles token refresh, user info, device control commands, and spec downloads. **miot_mips.py**: Message bus (MQTT) for subscribing to device property changes and events. Implements both cloud (MipsCloudClient) and local (MipsLocalClient) message handling. **miot_device.py**: Device entity class. Each MIoT device creates multiple MIoTDevice instances (one per Home Assistant entity). Handles property updates, action execution, and event processing. **miot_spec.py**: MIoT-Spec-V2 parser. Parses device specifications (URN-based type system) from cloud or local cache. Each spec defines services, properties, events, and actions. **miot_lan.py**: Local LAN control for IP devices in same network. Discovery and control without cloud (optional). **miot_mdns.py**: mDNS discovery for Xiaomi Central Hub Gateway services. **miot_storage.py**: File storage for certificates, device specs, translations, and cached data. **miot_network.py**: Network status monitoring and IP address detection. **miot_i18n.py**: Multi-language support (13 languages). Manages translations for entity names. ### Entity Conversion (specs/specv2entity.py) MIoT-Spec-V2 instances are converted to Home Assistant entities using three mapping dictionaries: - **SPEC_DEVICE_TRANS_MAP**: Whole-device patterns (e.g., vacuum, humidifier, climate) - **SPEC_SERVICE_TRANS_MAP**: Service-level patterns (e.g., battery, air-purifier) - **SPEC_PROP_TRANS_MAP**: Property-level patterns (e.g., temperature, humidity) Conversion priority: Device > Service > Property > General rules ### Spec Customization Files (miot/specs/) **spec_filter.yaml**: Filters out MIoT-Spec-V2 instances that should NOT be converted to entities. Uses device URN keys and supports wildcard matching for service/property/event/action IIDs. **spec_modify.yaml**: Modifies spec instances before conversion (e.g., changing value ranges, access modes). **multi_lang.json**: Local translation overrides with higher priority than cloud translations. Keyed by device URN (without version). **spec_add.json**: Additional spec definitions for devices not in cloud database. **bool_trans.yaml**: Boolean value translation mappings. After editing spec files, you MUST update conversion rules via Integration CONFIGURE page in Home Assistant. ### Platform Files (custom_components/xiaomi_home/) Standard Home Assistant platform files (sensor.py, switch.py, climate.py, etc.) implement entity registration and state management. Each platform imports from miot_device.py and creates entity subclasses. **config_flow.py**: Configuration flow for OAuth login and device selection. **__init__.py**: Integration setup, entry management, and data structure initialization. ## MIoT-Spec-V2 Concepts **URN Format**: `urn::::[::]` - namespace: miot-spec-v2 (Xiaomi), bluetooth-spec (SIG), or vendor-specific - type: device, service, property, event, action - name: human-readable identifier (used for mapping) **IIDs (Instance IDs)**: Decimal identifiers - siid: Service Instance ID - piid: Property Instance ID - eiid: Event Instance ID - aiid: Action Instance ID **Instance Code Format**: ``` service: # service service::property: # property service::property::valuelist: # value list item service::event: # event service::action: # action ``` ## Naming Conventions From CONTRIBUTING.md: - **Xiaomi**: Always "Xiaomi" in text. Variables: "xiaomi" or "mi" - **Xiaomi Home**: Always "Xiaomi Home" in text. Variables: "mihome" or "MiHome" - **Xiaomi IoT**: Always "MIoT" in text. Variables: "miot" or "MIoT" - **Home Assistant**: Always "Home Assistant" in text. Variables: "hass" or "hass_xxx" Mixed Chinese/English: Add space between Chinese and English or use Chinese quotation marks. ## Commit Message Format ``` :