Giter VIP home page Giter VIP logo

al-one / hass-xiaomi-miot Goto Github PK

View Code? Open in Web Editor NEW
3.9K 34.0 556.0 1.78 MB

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成

Home Page: https://miot-spec.com

License: Apache License 2.0

Python 99.48% Shell 0.52%
xiaomi miio miot home-assistant smart-home xiaomi-miot miot-spec homeassistant iot xiaoai

hass-xiaomi-miot's Introduction

version releases stars issues HACS

Xiaomi Miot For HomeAssistant

English | 简体中文

MIoT-Spec: The protocol specification for Xiaomi IoT devices, is a standard designed by the Xiaomi IoT platform to describe the function definition of hardware products according to the networking mode of hardware products, the characteristics of product functions, the characteristics of user usage scenarios and the user's requirements for hardware product use experience specification.

This component uses the miot protocol to automatically integrate Xiaomi devices into HomeAssistant, and currently supports most Xiaomi IoT devices. And it supports HA Web UI, and you can easily integrate Xiaomi devices into HA without configuring yaml.

hass-xiaomi-miot-configs

Installation

Method 1: HACS

  • First installation

    HACS > Integrations > ➕ EXPLORE & DOWNLOAD REPOSITORIES > Xiaomi Miot Auto > DOWNLOAD THIS REPOSITORY

  • Update component

    HACS > Integrations > Xiaomi Miot Auto > UPDATE / Redownload

Method 2: Manually installation via Samba / SFTP

Download and copy custom_components/xiaomi_miot folder to custom_components folder in your HomeAssistant config folder

Method 3: Onkey shell via SSH / Terminal & SSH add-on

wget -O - https://get.hacs.vip | DOMAIN=xiaomi_miot bash -

# Or

wget -O - https://raw.githubusercontent.com/al-one/hass-xiaomi-miot/master/install.sh | ARCHIVE_TAG=latest bash -

Method 4: shell_command service

  1. Copy this code to file configuration.yaml
    shell_command:
      update_xiaomi_miot: |-
        wget -O - https://get.hacs.vip | DOMAIN=xiaomi_miot bash -
  2. Restart HA core
  3. Call this service: shell_command.update_xiaomi_miot in Developer Tools
  4. Restart HA core again

Config

⚙️ Configuration > Devices and Services > 🧩 Integrations > ➕ Add Integration > 🔍 Search Xiaomi Miot Auto

Or click: Add Integration

Add devices using Mi Account:

Starting from the v0.4.4 version, the component has added support for selecting the connection device mode when integrated by account:

  • Automatic: The component will regularly update the devices that support miot-spec in LAN, and automatically use the local connection for the supported devices (recommended)
  • Local: All devices filtered by the integrated configuration will use local connection. If you check the devices that do not support miot in LAN, they will be unavailable
  • Cloud: All devices filtered by the integrated configuration will use cloud connection. It is recommended that miio, BLE, ZigBee devices use this mode

Add device using host/token:

Suitable for devices support miot-spec protocol in LAN

Config Xiaomi Cloud:

Config Xiaomi cloud for the devices integrated by host/token

# configuration.yaml
xiaomi_miot:
  username: xiaomi_username
  password: xiaomi_password
  # server_country: cn # Location of xiaomi cloud: cn(default), de, i2, ru, sg, tw, us
  # http_timeout: 15   # Timeout (seconds) for requesting the xiaomi apis

⚙️ Configuration > Devices and Services > 🧩 Integrations > Xiaomi Miot Auto > Options > ☑️ Enable miot cloud

Translations

Looking forward to your contribution.

# configuration.yaml
xiaomi_miot:
  language: zh # Using the built-in dictionary, currently only `zh` is supported
  # https://github.com/al-one/hass-xiaomi-miot/blob/master/custom_components/xiaomi_miot/core/translation_languages.py
  translations:
    # Global dictionary
    idle: '空闲'
    busy: '工作中'
    # Dictionary for specifying fan modes
    fan.mode:
      straight wind: '直吹模式'
      natural wind: '自然风'
    # Dictionary for specifying the drying modes of the washer
    washer.drying_level:
      moist: '微湿'
      extra: '特干'
# configuration.yaml
homeassistant:
  customize: !include customize.yaml

# Customize via device model
xiaomi_miot:
  # https://github.com/al-one/hass-xiaomi-miot/blob/master/custom_components/xiaomi_miot/core/device_customizes.py
  device_customizes:
    chuangmi.plug.212a01:
      miot_local: true
      chunk_properties: 7


# Customize via parent entity
# customize.yaml
domain.your_entity_id:
  miot_local: true        # Force to read and write data in LAN (integrate by account)
  miot_cloud: true        # Enable miot cloud for entity (read, write, action)
  miot_cloud_write: true  # Enable miot cloud (only write)
  miot_cloud_action: true # Enable miot cloud (only action)
  check_lan: true         # Check LAN connection in cloud mode
  miio_properties: power,battery # Get miio properties to state attributes
  miio_cloud_props: prop.power,event.dev_online

# Custom sub entities
domain.parent_entity_id:
  sensor_properties: temperature,humidity,illumination # Miot properties
  binary_sensor_properties: is_volume_muted,any_boolen_property
  switch_properties: on,power
  number_properties: volume
  select_properties: mode
  fan_properties: mode,fan_level
  cover_properties: motor_control

light.your_entity_id:
  color_temp_reverse: false # Reverse color temperature (Requires reload config entry)
  yeelight_smooth_on:  2000 # milliseconds (Only for Yeelights in local mode)
  yeelight_smooth_off: 3000 # milliseconds (Only for Yeelights in local mode)

climate.your_entity_id:
  bind_sensor: sensor.temperature_entity,sensor.humidity_entity # Sensor entities

camera.your_entity_id:
  video_attribute: 1   # https://github.com/al-one/hass-xiaomi-miot/issues/11#issuecomment-773054167
  keep_streaming: true # Continuously update stream address

cover.your_entity_id:
  closed_position: 5     # Change cover state to closed when position <= 5%
  deviated_position: 2   # Current position deviation 2% -> 0%, 98% -> 100%
  motor_reverse: true    # Reverse motor state (Requires reload config entry)
  position_reverse: true # Reverse motor position (Requires reload config entry)
  open_texts: Open,Up
  close_texts: Close,Down

media_player.mitv_entity_id:
  bind_xiaoai: media_player.xiaoai_entity_id # Bind xiaoai speaker for turn on TV

domain.your_entity_id_xxxx:
  interval_seconds: 30 # Seconds between each update state (Requires reload config entry)
  chunk_properties: 10 # Chunk miot properties on update state (LAN)
  reverse_state: true  # Reverse the On/Off state of a binary sensor

Filter entity attributes

Too many entity attributes will make your HA's database very large. If some entity attributes are useless to you, you can configure exclude_state_attributes to ignore them.

# configuration.yaml
xiaomi_miot:
  exclude_state_attributes:
    - miot_type
    - stream_address
    - motion_video_latest

YAML configuration reloading

This component has added support for configuration reloading (to avoid having to restart HomeAssistant instance after a YAML configuration change):

🔨 Developer tools > YAML Configuration > YAML configuration reloading > 🔍 Look for Xiaomi Miot Auto (almost at the bottom of the list)

Unsupported devices

This component uses the polling method to obtain the device state, so it cannot listen the events of some devices in real time.

Services

Since the HA support service response has been for some time, this component no longer triggers events starting from v0.7.18.

service: xiaomi_miot.set_property
data:
  entity_id: camera.isa_hlc7_xxxx
  field: camera_control.on
  value: true
service: xiaomi_miot.set_miot_property
data:
  entity_id: camera.isa_hlc7_xxxx
  siid: 2
  piid: 1
  value: true
service: xiaomi_miot.get_properties
data:
  entity_id: camera.isa_hlc7_1ab7
  mapping:
    - siid: 2
      piid: 1
    - siid: 3
      piid: 2
  update_entity: true # Update to entity state attributes
service: xiaomi_miot.call_action
data:
  entity_id: vacuum.dreame_p2259_entity_id
  siid: 4 # vacuum-extend
  aiid: 1 # start-clean
  params:
    - 18 # piid: 1 - work-mode
    - '{"selects":[[7,1,0,2,1]]}' # piid: 10 - clean-extend-data
service: xiaomi_miot.send_command
data:
  entity_id: switch.your_entity_id
  method: set_power
  params:
    - on
service: xiaomi_miot.get_token
data:
  name: Light # Keyword of device name in Mihome / IP / Model.
service: xiaomi_miot.intelligent_speaker
data:
  entity_id: media_player.xiaoai_lx04_xxxx
  text: Turn on the light
  execute: true # Execute text directive.
  silent: true  # Silent execution.
service: xiaomi_miot.xiaoai_wakeup
data:
  entity_id: media_player.xiaoai_lx04_xxxx
service: xiaomi_miot.renew_devices
data:
  username: 80001234 # Xiaomi Account ID / Email / Phone
service: xiaomi_miot.request_xiaomi_api
data:
  entity_id: sensor.your_entity_id
  api: /v2/plugin/fetch_plugin
  data:
    latest_req:
      api_version: 10070
      plugins:
        - model: brand.device.model

More services

Debug

Get Entity State Attributes

🔨 Developer tools > ℹ️ State > 🔍 Filter Entity

# configuration.yaml
logger:
  default: warning
  logs:
    custom_components.xiaomi_miot: debug

⚙️ Configuration > ⚙️ System > ✍️ Logs

Obtain miio token

  • Use HomeAssistant Service
    1. Goto HomeAssistant service developer tool
    2. Select xiaomi_miot.get_token, Enter the keyword of device name
    3. Find the token from the HA notifications
  • Use MiHome mod by @vevsvevs
    1. Down apk from СКАЧАТЬ ВЕРСИЮ 6.x.x and install
    2. Start Mihome APP > Profile > Experimental features
    3. Check on Write custom log files and Enable app's debug mode
    4. Find the token from vevs/logs/misc/devices.txt after restart app
  • Xiaomi Cloud Tokens Extractor
    1. Download and run token_extractor.exe for Windows or install for Python
    2. Enter username, password and your server region
    3. Extracts tokens from your cloud account. Also reveals the bind_key for BT devices

hass-xiaomi-miot's People

Contributors

al-one avatar alryaz avatar altapo avatar baiuu avatar blakadder avatar cheny95 avatar codyc1515 avatar detecti1 avatar dsimop avatar duvanjamid avatar eros-fabbri avatar flyingfeng2021 avatar gvssr avatar harrychen55 avatar hatebaozi avatar heyxk avatar jezza34000 avatar jianyun8023 avatar jimmykmi avatar leandroissa avatar menelao147 avatar nesror avatar parkghost avatar ptbsare avatar seanchengn avatar smosia avatar stbkde avatar tvrrp avatar xiaxianguyue avatar zuz666 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hass-xiaomi-miot's Issues

Support for New Widetech Dehumidifier (nwt.derh.312en)

Dear @al-one ,
I have successfully added hass-xiaomi-miot addon in HACS as custom repository. I managed to add my New Widetech Dehumidifier (nwt.derh.312en) device on the integration page in Home Assistant.
My problem is that I do not see my device neither devices nor in entities.
I assume this device is not yet supported by the addon. Can I help you somehow to support this device?

邦先生晾衣架问题

用xiaomi_miot_raw这个识别不了mrbond.airer.m1s,后来找到你的插件安装了可以正常识别,led也可以用控制,但是有个问题就是只能按下降,按停止,不能按上升,显示灰色状态,位置也不能显示,希望能修复一下,感谢
微信图片_20210121015828

邦先生晾衣架问题

用xiaomi_miot_raw这个识别不了mrbond.airer.m1s,后来找到你的插件安装了可以正常识别,led也可以用控制,但是有个问题就是只能按下降,按停止,不能按上升,显示灰色状态,位置也不能显示,希望能修复一下,感谢
微信图片_20210121015828

isa.camera.hlc6 crashes on hw_ver

I've just set up a fresh HA instance and I'm trying to integrate the isa.camera.hlc6 camera. I'm running HA in a docker container in host network mode. I've tried the latest stable, latest beta and master branch build of the integration. I'm using Europe Mi servers.

Providing host/token ends up with the following error on initialization:

homeassistant    | 2021-03-14 17:00:38 ERROR (MainThread) [homeassistant.components.camera] Error while setting up xiaomi_miot platform for camera
homeassistant    | Traceback (most recent call last):
homeassistant    |   File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 200, in _async_setup_platform
homeassistant    |     await asyncio.shield(task)
homeassistant    |   File "/config/custom_components/xiaomi_miot/camera.py", line 44, in async_setup_entry
homeassistant    |     await async_setup_config_entry(hass, config_entry, async_setup_platform, async_add_entities, ENTITY_DOMAIN)
homeassistant    |   File "/config/custom_components/xiaomi_miot/__init__.py", line 349, in async_setup_config_entry
homeassistant    |     await async_setup_platform(hass, c, async_add_entities)
homeassistant    |   File "/config/custom_components/xiaomi_miot/camera.py", line 62, in async_setup_platform
homeassistant    |     entities.append(MiotCameraEntity(hass, cfg, srv))
homeassistant    |   File "/config/custom_components/xiaomi_miot/camera.py", line 71, in __init__
homeassistant    |     super().__init__(miot_service, config=config)
homeassistant    |   File "/config/custom_components/xiaomi_miot/__init__.py", line 903, in __init__
homeassistant    |     super().__init__(miot_service, device, **kwargs)
homeassistant    |   File "/config/custom_components/xiaomi_miot/__init__.py", line 538, in __init__
homeassistant    |     super().__init__(name, device, **kwargs)
homeassistant    |   File "/config/custom_components/xiaomi_miot/__init__.py", line 389, in __init__
homeassistant    |     'hardware_version': self._miio_info.hardware_version,
homeassistant    |   File "/usr/local/lib/python3.8/site-packages/miio/device.py", line 84, in hardware_version
homeassistant    |     if self.data["hw_ver"] is not None:
homeassistant    | KeyError: 'hw_ver'

Setting up an integration with Mi Account credentials successfuly adds devices but it shows either that camera is off or there was an error opening stream:

homeassistant    | 2021-03-14 17:09:56 ERROR (MainThread) [homeassistant.components.camera] Error requesting stream: Camera is off
homeassistant    | 2021-03-14 17:13:25 ERROR (stream_worker) [homeassistant.components.stream.worker] Error opening stream https://de01.livestreaming.io.mi.com/hlstranscoder/.../playlist.m3u8

Let me know if I can help fixing this somehow as I cannot use the camera in HA. :(

mijia.vacuum.v1/ xiaomi mijia g1

Status unknown

fan_speed_list:
  - 全局清扫
  - 定点清扫
  - 沿边清扫
battery_level: 100
battery_icon: 'mdi:battery'
fan_speed: 全局清扫
model: mijia.vacuum.v1
lan_ip: ---
mac_address: '-----'
firmware_version: 2.1.3
hardware_version: esp32
entity_class: MiotVacuumEntity
other_status.mop_status: 0
language: 1
language.not_disturb_switch: false
clean_record.clean_area: 140
clean_record.clean_time: 2
clean_record.total_clean_area: 229490
clean_record.total_clean_time: 2499
clean_record.total_clean_count: 54
remote_control.direction_key.error: -704030013
brush_cleaner-15.brush_life_level: 38
brush_cleaner-15.brush_left_time: 3446
brush_cleaner.brush_life_level: 69
brush_cleaner.brush_left_time: 12572
filter.filter_life_level: 39
filter.filter_left_time: 3572
alarm: true
alarm.volume: 52
battery.battery_level: 100
battery.charging_state: 2
vacuum.status: 5
vacuum.fault: 0
vacuum.mode: 1
vacuum.target_water_level: 2
vacuum.fan_level: 1
state_updater: cloud
friendly_name: Xiaomi Miot Robot Cleaner
supported_features: 12536

Unable to get image and more another error - isa.camera.hlc6

Sometimes getting this error.

Logger: homeassistant
Source: components/camera/__init__.py:148
First occurred: 23:28:14 (1 occurrences)
Last logged: 23:28:14

Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/components/homekit/type_cameras.py", line 472, in async_get_snapshot
    await self.hass.components.camera.async_get_image(self.entity_id),
  File "/usr/src/homeassistant/homeassistant/components/camera/__init__.py", line 148, in async_get_image
    raise HomeAssistantError("Unable to get image")
homeassistant.exceptions.HomeAssistantError: Unable to get image
Error opening stream https://de08.livestreaming.io.mi.com/hlstranscoder/GCAwYjk4YWRkNWRjMjI0M2U5YmY3ZDBjMDY0NDExZmY4MhgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8
Error opening stream https://de07.livestreaming.io.mi.com/hlstranscoder/GCBlN2M3ZjczZjJmNmU0OWMwODEzZTc5YzA3OGU1MzdlYxgKX191bnVzZWRfXwA_H265transH264/playlist.m3u8

And after 5 minutes it will stop showing the stream. I need to reboot the camera or HA server.

接入wifi插座时,实体注册成功,但显示不可用

Logger: custom_components.xiaomi_miot
Source: custom_components/xiaomi_miot/__init__.py:343
Integration: Xiaomi Miot (documentation, issues)
First occurred: 上午9:51:04 (71 occurrences)
Last logged: 上午10:26:05

Got exception while fetching the state for None: Unable to recover failed command
Got exception while fetching the state for switch.ke_ting_tai_deng_chuangmi_plug_m3_switch: Unable to recover failed command

image

添加空调内存泄漏

云米空调添加使用后内存不断增加,导致homeassistant死掉。卸载插件后正常~

yeelink.bhf_light.v1浴霸

image
浴霸,无法使用,开启云端都显示但是还是无法使用。用您的另一个插件Miio for Yeelink是可以的。
日志:
image
image

can't find cloud enable setting

Hi
Im trying to add a chuangmi.camera.ipc016 camera using the integration.
I'm trying to follow the instructions on the code page.
I've managed to add miot cloud for entity using the customization page.
It than says to "Enabled miot cloud for device: Configuration > Integrations > Xiaomi Miot Auto > Options > Enable miot cloud"
but I cannot see this option anywhere. is this crucial for camera operation?
Currently I got it to look like this:
image
But getting this when I'm trying to see an image:
image

only miot error from log I can see is this:
2021-02-21 19:48:35 WARNING (MainThread) [homeassistant.helpers.entity] Update of camera.miot_camera_control is taking over 10 seconds

what can be the cause?
where can I enable "miot cloud for device" if needed?
where can I find the did value? is it manetory?

thanks,

Unable to add integration

I am using Home Assistant OS 5.12 (HASS Core 2021.2.3) and installed the integration (v0.2.4) via HACS:

image

But unfortunately, I am not able to select the integration in the HASS configuration -> Integrations:

image

Is there something wrong with my setup?

EDIT:
Log file says the integration is active
2021-02-23 09:27:47 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xiaomi_miot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
Is there no more GUI?

mijia.vacuum.v1 vacuum.py

In state property non exists STATE_PAUSED state

...

elif val in self._prop_status.list_search('Paused'):
    return STATE_PAUSED

...

mijia.vacuum.v2/ xiaomi mijia g1

return to base does not work in Mi Robot Vacuum-Mop Essential G1 from other forum commands for Vacuum:
Start cleanup "method":"action","params":{"did":"X","siid":2,"aiid":1}
Pause cleanup "method":"action","params":{"did":"X","siid":2,"aiid":2}
Charge "method":"action","params":{"did":"X","siid":13,"aiid":1}

xiaomi_miot 已载入,但HA的UI中找不到此集成,在configuration.yaml添加设备也不成功

您好,我有一个米家智能晾衣机,型号是hyd.airer.znlyj1,想测试一下能否接入,但遇到一些问题,想咨询一下原因。
首选,xiaomi_miot放置位置应该没问题,路径如下:

┌ Tuesday [2021.01.12 - 15:49:39] (/etc/homeassistant/custom_components)
# ll
total 24K
drwxr-xr-x 12 homeassistant 4.0K Jan 11 21:28 hacs
drwxr-xr-x  4 homeassistant 4.0K Jan 12 15:15 miio_yeelink
drwxr-xr-x  5 homeassistant 4.0K Jan 11 21:43 xiaomi_gateway3
drwxr-xr-x  3 homeassistant 4.0K Dec 24 18:38 xiaomi_miio_airconditioningcompanion
drwxr-xr-x  3 homeassistant 4.0K Jan 11 21:43 xiaomi_miio_airconditioningcompanionmcn02
drwxr-xr-x  4 homeassistant 4.0K Jan 12 15:38 xiaomi_miot
┌ Tuesday [2021.01.12 - 15:49:40] (/etc/homeassistant/custom_components)
# ll xiaomi_miot
total 80K
-rw-r--r-- 1 homeassistant 7.2K Jan  8 23:35 climate.py
-rw-r--r-- 1 homeassistant 3.2K Jan  8 23:35 config_flow.py
-rw-r--r-- 1 homeassistant  15K Jan  8 23:35 cover.py
-rw-r--r-- 1 homeassistant 1.4K Jan  8 23:35 fan.py
-rw-r--r-- 1 homeassistant  15K Jan  8 23:35 __init__.py
-rw-r--r-- 1 homeassistant 1.7K Jan  8 23:35 light.py
-rw-r--r-- 1 homeassistant  377 Jan  8 23:35 manifest.json
drwxr-xr-x 2 homeassistant 4.0K Jan 12 15:38 __pycache__
-rw-r--r-- 1 homeassistant 4.3K Jan  8 23:35 sensor.py
-rw-r--r-- 1 homeassistant  604 Jan  8 23:35 services.yaml
-rw-r--r-- 1 homeassistant 1.1K Jan  8 23:35 switch.py
drwxr-xr-x 2 homeassistant 4.0K Jan  8 23:35 translations

启动HA时的相关日志为,表明此集成也正常载入了:

2021-01-12 15:42:18 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for hacs which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-01-12 15:42:18 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for miio_yeelink which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-01-12 15:42:18 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xiaomi_gateway3 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-01-12 15:42:21 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xiaomi_miot which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-01-12 15:42:21 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xiaomi_miio_airconditioningcompanion which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant.
2021-01-12 15:42:22 WARNING (MainThread) [homeassistant.loader] You are using a custom integration for xiaomi_miio_airconditioningcompanionmcn02 which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant

但在Web UI中却搜索不到此集成:
no miot

另外,我在configuration.yaml中直接配置为light和cover也不成功,配置如下:

light:
  - platform: xiaomi_miot
    name: 阳台灯
    host: 192.168.2.55
    token: af0f2be5d00d70f85a2753ee837d1475
#    model: hyd.airer.znlyj1

# 晾衣机
cover:
  - platform: xiaomi_miot
    name: 晾衣机
    host: 192.168.2.55
    token: af0f2be5d00d70f85a2753ee837d1475
#    model: hyd.airer.znlyj1

light这项配置在日志里报错如下:

2021-01-12 15:42:25 ERROR (MainThread) [homeassistant.config] Invalid config for [light.xiaomi_miot]: [name] is an invalid option for [light.xiaomi_miot]. Check: light.xiaomi_miot->name. (See /etc/homeassistant/configuration.yaml, line 109). Please check the docs at https://github.com/al-one/hass-xiaomi-miot

而cover的配置没有相关日志提示,HA中也没有出现相关实体。

云米浴霸问题

你好,我的云米浴霸A1用你的插件可以添加,但只显示浴霸灯一个实体,型号viomi.bhf_light.v4,求提供完整支持,谢谢!

Option to switch between fan modes

First of all, great work with this plugin! It works perfectly with my Yeelight ceiling fan.

A minor thing I'm missing though is the ability to control fan mode. In the app it offers the options "direct" and "natural mode". There's also a third mode which changes the direction in which the fan turns.

Could support for these features be added to the plugin?

米家门锁接入问题

先感谢大佬,看到插件0.3.0版本写的增加了对门锁的支持,试了一下接入米家智能门锁,能接入,但一直显示未知。相关截图如下:
Screenshot_20210323_210415_com android chrome

人体传感器一直处于触发状态

看到新版本的插件支持门磁传感器和人体传感器了,也就相当于在HA里装了米家app了,控制了非WIFI设备。但是人体传感器一直显示触发状态,门磁传感器使用正常。或许跟米价服务器有关。

是否有可能支持蓝牙温湿度计?

理论上来说蓝牙温湿度计是不支持miot协议的,但是受到 cloud 模式支持空调伴侣的启发,即该 issue 79元的空调伴侣2不可用

那么温湿度指示器是否有可能通过同样的方式从云端获取数据呢?

因为现在配置在 Unraid 的 Docker 中的 HomeAssistant 调用 USB 蓝牙并不是那么方便。

我手头的温湿度指示剂是 蓝牙温湿度计2,model: miaomiaoce.sensor_ht.t2,该设备支持的参数如下:

序号	        model 	          urn
1	miaomiaoce.sensor_ht.t2	urn:miot-spec-v2:device:temperature-humidity-sensor:0000A00A:miaomiaoce-t2:1
设备描述:Temperature Humidity Sensor
设备属性:

siid 1: Device Information

   piid 1: Device Manufacturer 可读取
      数据类型:string
   piid 2: Device Model 可读取
      数据类型:string
   piid 3: Device Serial Number 可读取
      数据类型:string
   piid 4: Current Firmware Version 可读取
      数据类型:string


siid 2: Temperature Humidity Sensor

   piid 1: Temperature 可读取
      数据类型:float
      取值范围:[-30, 100, 0.1]
   piid 2: Relative Humidity 可读取
      数据类型:float
      取值范围:[0, 100, 0.1]
   piid 3: Battery Level 可读取
      数据类型:uint8
      取值范围:[0, 100, 1]

Failed to connect the device

Hi!
I'm having problems trying to get this addon to work, no matter what I try it always ends up with "Failed to connect the device".
I'm using the European (German) servers and my camera shows up fine there and I've been able to get my token etc without issues.
This is what I've added to my configuration.yaml:
image
Addon downloaded from HACS and then when trying to add the integration I get this and nothing more:
image
Error in the log isn't saying much either:
2021-02-21 12:29:22 DEBUG (MainThread) [custom_components.xiaomi_miot.config_flow] Xiaomi Miot config flow: {'user_input': {'name': 'xiaomi_cam_01', 'host': 'xxx', 'token': 'xxx'}, 'miio_info': None, 'errors': {'base': 'cannot_connect'}}

Is there a step I've missed? Do I need to installa anything besides the addon itself?

chuangmi.plug.v1 -10000 Method not found

Device info
chuangmi.plug.v1
by chuangmi
Firmware: 1.2.4_7

was good with xiaomi_miio, but error after switching to xiaomi_miot

2021-02-02 19:08:16 ERROR (MainThread) [custom_components.xiaomi_miot] Got exception while fetching the state for WorkRoom Desktop Light USB Switch Status: {'code': -10000, 'message': 'Method not found.'}
2021-02-02 19:08:16 ERROR (MainThread) [custom_components.xiaomi_miot] Got exception while fetching the state for WorkRoom Desktop Light Power Switch Status: {'code': -10000, 'message': 'Method not found.'}

beside this issue, temperature sensor is missing

config flow lose input value on failure

type wrong ip or wrong token
"Failed to connect the device"
3 fields i just input is lost, reset to default value
expected: preserve values i inputted so i can correct them and try again

集成前端UI添加小米账户时报错

大佬好,先感谢大佬的插件。
最新版本插件可以前端配置云账号添加设备了。但是我在配置的时候添加用户名密码之后报错如图。
Screenshot_20210315_232056

用设备IP token本地添加没问题。但我需要这个云端添加模式,以便在没有部署HA的地方也能接入米家设备。

HA报错日志去下:
Logger: aiohttp.server
Source: custom_components/xiaomi_miot/config_flow.py:114
First occurred: 下午10:42:13 (2 occurrences)
Last logged: 下午10:42:16

Error handling request
Traceback (most recent call last):
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/config/config_entries.py", line 169, in post
return await super().post(request, flow_id)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/data_validator.py", line 60, in wrapper
result = await method(view, request, *args, **kwargs)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/helpers/data_entry_flow.py", line 106, in post
result = await self._flow_mgr.async_configure(flow_id, data)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 155, in async_configure
result = await self._async_handle_step(flow, cur_step["step_id"], user_input)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/data_entry_flow.py", line 213, in _async_handle_step
result: Dict = await getattr(flow, method)(user_input)
File "/volume1/@appstore/homeassistant/var/config/custom_components/xiaomi_miot/config_flow.py", line 178, in async_step_cloud
return await self.async_step_cloud_filter(user_input)
File "/volume1/@appstore/homeassistant/var/config/custom_components/xiaomi_miot/config_flow.py", line 196, in async_step_cloud_filter
schema = await get_cloud_filter_schema(self.hass, user_input, errors, schema)
File "/volume1/@appstore/homeassistant/var/config/custom_components/xiaomi_miot/config_flow.py", line 114, in get_cloud_filter_schema
hass.data[DOMAIN]['prev_input'] = user_input
KeyError: 'xiaomi_miot'

我的安装环境如下,是在群晖第三方套件安装的HA:
System Health

version: 2021.1.5
installation_type: Home Assistant Core
dev: false
hassio: false
docker: false
virtualenv: true
python_version: 3.8.7
os_name: Linux
os_version: 3.10.105
arch: armv7l
timezone: Asia/Shanghai

GitHub API: ok
Github API Calls Remaining: 4887
Installed Version: main
Stage: running
Available Repositories: 759
Installed Repositories: 12

logged_in: false
can_reach_cert_server: ok
can_reach_cloud_auth: ok
can_reach_cloud: ok

dashboards: 3
mode: storage
views: 1
resources: 9

logged_in: true
can_reach_micloud_server: ok
accounts_count: 1
account_devices_count: 45
added_devices: 9

还望大佬帮忙看看是什么问题,多谢。

米家微波炉无法控制

model: chunmi.microwave.n20l01
firmware_version: 2.0.7
hardware_version:
entity_class: MiotCookerEntity
state_property: microwave_oven.left_time
physical_controls_locked: false
microwave_oven.left_time: 0
microwave_oven.status: 5
state_updater: cloud
microwave_oven.status_desc: Paused
sub_entities: physical_controls_locked-3.physical_controls_locked-1, cook_switch
friendly_name: 微波炉 Microwave Oven
icon: mdi:microwave
supported_features: 0
image

目前已有的开关中,通锁正常控制,Microwave Oven status 控制无效
其次,缺少 选择火力、加热时间、加热模式等

looks like the MJSXJ09CM camera isn't supported

Hi, first of all, great to see this module!

Currently trying to set up my Mi 360 Home Security Camera 2K with it, while getting the token and successfully added it via the integrations page. I'm not getting much info from it, it also says "unavailable" in the entities overview.

Could anyone confirm if the camera type is supported?

chuangmi.camera.ipc019 - data type not valid

I have 3 camera (2 chuangmi.camera.ipc019 and 1 mijia.camera.v3).

mijia.camera.v3 is working fine. But the remain 2 chuangmi.camera.ipc019 is not working. Can you please help me to set it up?

Cloud enabled, "did" is set in customize.

2021-02-16 11:59:14 DEBUG (MainThread) [homeassistant.components.http.view] Serving /api/camera_proxy_stream/camera.xiaomi_security_360_camera_control to 192.168.0.1 (auth: False)
2021-02-16 11:59:14 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: Xiaomi Security 360 Camera Control url: None expired: 0
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Send request: {"params": {"did": 3699177XX, "siid": 4, "aiid": 1, "in": [3]}} to https://de.api.io.mi.com/app/miotspec/action
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie channel=MI_APP_STORE for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie dst_offset=0 for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie is_daylight=1 for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie locale=None for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie serviceToken=GwA2RN1gXG7ClJ19XwEW+btRcX07YFyb4H2jcgc36edRWTB/b+5S7o42JQJKPtMdpAIGjCo+JKlWrxLDON3KBQsfOyDOPqxCv5StMpGtiX5kQrYGTzqglZiOXpCOeqnozXVZKYdHpG5iIQ9GKvJ0E/JlsjvRh2yNj9IwcP8LBDY= for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie timezone=GMT+01:00 for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie userId=902943XX for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [root] Cookie: <Cookie yetAnotherServiceToken=GwA2RN1gXG7ClJ19XwEW+btRcX07YFyb4H2jcgc36edRWTB/b+5S7o42JQJKPtMdpAIGjCo+JKlWrxLDON3KBQsfOyDOPqxCv5StMpGtiX5kQrYGTzqglZiOXpCOeqnozXVZKYdHpG5iIQ9GKvJ0E/JlsjvRh2yNj9IwcP8LBXX= for />
2021-02-16 11:59:14 DEBUG (SyncWorker_1) [custom_components.xiaomi_miot.core.xiaomi_cloud] Request miot spec: action, params: {'did': 3699177XX, 'siid': 4, 'aiid': 1, 'in': [3]} to cloud failed: {"code":-8,"message":"data type not valid","result":null} None
2021-02-16 11:59:14 WARNING (SyncWorker_1) [custom_components.xiaomi_miot] Call miot action to Xiaomi Security 360 Camera Control ({'did': 3699177XX, 'siid': 4, 'aiid': 1, 'in': [3]}) failed: None
2021-02-16 11:59:14 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Get miot camera stream from cloud for Xiaomi Security 360 Camera Control: {}
2021-02-16 11:59:14 DEBUG (MainThread) [custom_components.xiaomi_miot.camera] Miot camera: Xiaomi Security 360 Camera Control url is empty. {'model': 'chuangmi.camera.ipc019', 'lan_ip': '192.168.1.XX', 'mac_address': '78:8B:2A:BC:D7:XX', 'firmware_version': '4.0.9_0426', 'hardware_version': 'Linux', 'entity_class': 'MiotCameraEntity', 'video_codec_type': None, 'video_attribute': None, 'audio_codec_type': None, 'audio_attribute': None, 'stream_address': None, 'stream_status': 1, 'authorization_type': None, 'image_snapshot': None, 'expiration_time': None, 'camera_control.on': True}

Errors after install

Hi there! Thank you for this integration. It's working but after install I have this error in server log:
Unable to prepare setup for platform xiaomi_miot.sensor: Platform not found (cannot import name 'DeviceStatus' from 'miio.device' (/usr/local/lib/python3.8/site-packages/miio/device.py)).
And ha notification:

The following integrations and platforms could not be set up:
    xiaomi_miot.sensor

My environment: HA core-2021.3.4, also I using miio2 platform, and Xiaomi Gateway 3 integration.

scishare.coffee.s1102 心想胶囊机求支持

model: scishare.coffee.s1102

可以获取的参数:

scishare.coffee.s1102   urn:miot-spec-v2:device:coffee-machine:0000A049:scishare-s1102:1
设备描述:Coffee Machine
设备属性:
siid 1: Device Information
   piid 1: Device Manufacturer 可读取
      数据类型:string
   piid 2: Device Model 可读取
      数据类型:string
   piid 3: Device Serial Number 可读取
      数据类型:string
   piid 4: Current Firmware Version 可读取
      数据类型:string

siid 2: Coffee Machine
   piid 1: Status 可读取
      数据类型:uint8
      取值范围:
         1: Off
         2: Idle
         3: Preheating
         4: Error
         5: Busy
   piid 2: Switch Status 可读取 可控制
      数据类型:bool

已测试传入原始命令可以进行控制,利用node-red可以控制开关机和不同咖啡的制作,不知道可否接入ha.
能控制开关和查询状态就好.

// 开机 
{
    "cmd": "miio",
    "method": "Machine_ON",
    "value": []
}
//关机
{
    "cmd": "miio",
    "method": "Machine_OFF",
    "value": []
}

 // 设置美式
{
    "cmd": "miio",
    "method": "Americano_Coffee_Set",
    "value": [
        80,
        80,
        40,
        85
    ]
}


//制作美式 
{
    "cmd": "miio",
    "method": "Americano_Coffee",
    "value": [
        80,
        80,
        40,
        85
    ]
}

原来接入没问题的净水器,更新后无法接入获取不到实体了

Logger: homeassistant.components.sensor
Source: custom_components/xiaomi_miot/sensor.py:101
Integration: 传感器 (documentation, issues)
First occurred: 下午11:20:25 (2 occurrences)
Last logged: 下午11:20:25

Error adding entities for domain sensor with platform xiaomi_miot
Error while setting up xiaomi_miot platform for sensor
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 316, in async_add_entities
await asyncio.gather(*tasks)
File "/usr/src/homeassistant/homeassistant/helpers/entity_platform.py", line 424, in _async_add_entity
device_class=entity.device_class,
File "/config/custom_components/xiaomi_miot/sensor.py", line 101, in device_class
if self._prop_state.name in ['temperature']:
AttributeError: 'NoneType' object has no attribute 'name'

设备号:yunmi.waterpuri.lx9

Xiaomi Air Purifier 3C

Can you add support for zhimi.airpurifier.mb4 ??? Si detected in lan mode, but not working neither sensores or switch and no al entities displayed

[Supported Devices]已支持设备收集

如果您使用本插件成功接入设备,请留下您的设备型号,或者为已有的回复点赞👍🏻

回复格式如下:

xiaomi.aircondition.mt1

如果您的设备需要开启miot_cloud或通过账号接入才可以使用的话,请回复:

xiaomi.wifispeaker.x08c(cloud)

v0.4.2版本开始,本插件新增了收集支持本地miot协议的设备型号( d9a2579 ),如果想根据型号查询更多的设备信息,可通过小米/米家产品库查询

chuangmi.camera.ipc019摄像头无图像

先感谢大佬插件,有如下问题

云账号模式添加摄像头,有2个实体出现并可用,一个摄像头开关实体,一个摄像头实体。但摄像头实体无法显示图像。实体记录没有,实体图像url里也没有。
image

image

image

日至报错如下:
Logger: aiohttp.server
Source: custom_components/xiaomi_miot/camera.py:219
First occurred: 上午10:47:15 (10 occurrences)
Last logged: 上午11:04:50

Error handling request
Traceback (most recent call last):
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 422, in _handle_request
resp = await self._request_handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_app.py", line 499, in _handle
resp = await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/aiohttp/web_middlewares.py", line 118, in impl
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/security_filter.py", line 56, in security_filter_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/request_context.py", line 18, in request_context_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/ban.py", line 72, in ban_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/auth.py", line 127, in auth_middleware
return await handler(request)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/http/view.py", line 129, in handle
result = await result
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/camera/init.py", line 502, in get
return await self.handle(request, camera)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/homeassistant/components/camera/init.py", line 537, in handle
return await camera.handle_async_mjpeg_stream(request)
File "/volume1/@appstore/homeassistant/var/config/custom_components/xiaomi_miot/camera.py", line 219, in handle_async_mjpeg_stream
await stream.close()
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/haffmpeg/core.py", line 158, in close
await self._loop.run_in_executor(None, _close)
File "/var/packages/python38/target/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/volume1/@appstore/homeassistant/env/lib/python3.8/site-packages/haffmpeg/core.py", line 153, in _close
self._proc.stdin.write(b"q")
BrokenPipeError: [Errno 32] Broken pipe

我的安装环境如下
System Health

version: 2021.1.5
installation_type: Home Assistant Core
dev: false
hassio: false
docker: false
virtualenv: true
python_version: 3.8.7
os_name: Linux
os_version: 3.10.105
arch: armv7l
timezone: Asia/Shanghai

麻烦能否看下什么问题,多谢。

新增 camera 似乎不支持小白摄像头 chuangmi.camera.ipc016

看到最近的一次提交显示支持 camera 设备了。

然而将我的小白摄像头 chuangmi.camera.ipc016 配置到集成中之后,会显示为不可用,点击设备也没有预览。

进入日志显示 -9999。

采用 customize 设置云端登陆,设备会从不可用显示为休眠,但设备实际并不处于休眠模式。预览界面和上面保持一致。

此外配置过摄像机后,侧边栏会有登陆的提醒。

该问题是否是因为我的摄像头不支持所致?如果是这样的话,不知是否有已知兼容良好的摄像头可以选择?因为家中正巧打算购入新的设备。

小米窗帘关闭状态相反

添加多个窗帘,有几个的开合状态是反的。

Model:lumi.curtain.hmcn01
Entity class:LumiCurtainEntity
Adjust value:-
Position:0
Closed:true

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.