SOLVED.
I’m not sure if this is a configuration problem or a bug - since I’m new to Home Assistant, this is most likely a configuration issue, but I actually spent many hours trying to figure this out and searched a lot of topics without any luck. I would really appreciate your help!
The “Mi Control Hub” and the temperature sensors are showing up correctly in the Mi Home app.
I get a log line stating that Xiaomi Gateway is configured on the correct ip-address but the xiaomi_aqara sensor raises a KeyError exception. Later on in the logs I get a line saying “Cannot connect to Gateway”, so perhaps I’m not correctly connected after all?
I got a Gateway connection error until I explicitly stated the gateway, ip, mac and key!?
Home assistant version
Ver 0.83.3. Running on HassOS 1.13 on Raspberry Pi 3
The hub and sensor info
Version code:208
网关ID:130078600
Zigbee通道:11
网关信息:
{"ap":{"bssid":"xxx","rssi":-51,"ssid":"Vodafone_xxx"},"cfg_time":0,"fw_ver":"1.4.1_161","hw_ver":"MW300","life":18452,"mac":"xxx","mcu_fw_ver":"0143","mmfree":182304,"model":"lumi.gateway.v3","netif":{"gw":"192.168.1.1","gw_mac":"xxx","localIp":"192.168.1.102","mask":"255.255.255.0"},"ot":"otu","ott_stat":[0,0,0,0],"otu_stat":[340,340,262,9,250,1868],"token":"2767ee7636cec748b5b88732f7190af4","wifi_fw_ver":"SD878x-14.76.36.p84-702.1.0-WM"}
子设备信息:
[{"model":"lumi.sensor_ht.v1","did":"lumi.158d00025ed84e","name":"Hiti_solskali"},{"model":"lumi.weather.v1","did":"lumi.158d0002772e4a","name":"Hiti_hol"},{"model":"lumi.sensor_ht.v1","did":"lumi.158d0002e6aecc","name":"Hiti_bur"}]
configuration.yaml
homeassistant:
# Name of the location where Home Assistant is running
name: Home
# Location required to calculate the time the sun rises and sets
latitude: 65.8683
longitude: -17.3936
# Impacts weather/sunrise data (altitude above sea level in meters)
elevation: 200
# metric for Metric, imperial for Imperial
unit_system: metric
# Pick yours from here: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
time_zone: UTC
# Customization file
customize: !include customize.yaml
# Show links to resources in log and frontend
#introduction:
# Enables the frontend
frontend:
# Enables configuration UI
config:
# Uncomment this if you are using SSL/TLS, running in Docker container, etc.
# http:
# base_url: example.duckdns.org:8123
# Checks for available updates
# Note: This component will send some information about your system to
# the developers to assist with development of Home Assistant.
# For more information, please see:
# https://home-assistant.io/blog/2016/10/25/explaining-the-updater/
updater:
# Optional, allows Home Assistant developers to focus on popular components.
# include_used_components: true
# Discover some devices automatically
discovery:
# Allows you to issue voice commands from the frontend in enabled browsers
conversation:
# Enables support for tracking state changes over time
history:
# View all events in a logbook
logbook:
# Enables a map showing the location of tracked devices
map:
# Track the sun
sun:
# Xiaomi gateway
xiaomi_aqara:
gateways:
- host: 192.168.1.102
mac: xxx
key: xxx
# Sensors
sensor:
# Weather prediction
- platform: yr
- platform: version
- platform: xiaomi_aqara
# Text to speech
tts:
- platform: google
# Cloud
cloud:
group: !include groups.yaml
automation: !include automations.yaml
script: !include scripts.yaml
logger:
default: info
logs:
homeassistant.components.xiaomi_aqara: debug
homeassistant.components.sensor.xiaomi_aqara: debug
homeassistant.components.switch.xiaomi_aqara: debug
homeassistant.components.binary_sensor: debug
home-assistant.log:
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain logger took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.loader] Loaded history from homeassistant.components.history
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.loader] Loaded recorder from homeassistant.components.recorder
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up http
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain http took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up lovelace
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain lovelace took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up recorder
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up websocket_api
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain websocket_api took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up system_log
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain system_log took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up auth
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain auth took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up onboarding
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up api
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain api took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setup of domain onboarding took 0.0 seconds.
2018-12-12 19:28:03 INFO (MainThread) [homeassistant.setup] Setting up frontend
2018-12-12 19:28:06 INFO (MainThread) [homeassistant.setup] Setup of domain frontend took 3.0 seconds.
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setup of domain recorder took 3.6 seconds.
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setting up history
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setup of domain history took 0.0 seconds.
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded logbook from homeassistant.components.logbook
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded sensor from homeassistant.components.sensor
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded sensor.yr from homeassistant.components.sensor.yr
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded sensor.xiaomi_aqara from homeassistant.components.sensor.xiaomi_aqara
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setting up sensor
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded tts from homeassistant.components.tts
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded tts.google from homeassistant.components.tts.google
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded automation from homeassistant.components.automation
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded group from homeassistant.components.group
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded map from homeassistant.components.map
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setting up map
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setup of domain map took 0.0 seconds.
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded updater from homeassistant.components.updater
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setting up updater
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded script from homeassistant.components.script
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded sun from homeassistant.components.sun
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setting up sun
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setup of domain sun took 0.2 seconds.
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded cloud from homeassistant.components.cloud
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.loader] Loaded discovery from homeassistant.components.discovery
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setting up discovery
2018-12-12 19:28:07 INFO (MainThread) [homeassistant.setup] Setup of domain discovery took 0.1 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded conversation from homeassistant.components.conversation
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up group
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain group took 0.0 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded xiaomi_aqara from homeassistant.components.xiaomi_aqara
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up xiaomi_aqara
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config from homeassistant.components.config
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.xiaomi_aqara
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.components.sensor] Setting up sensor.yr
2018-12-12 19:28:08 DEBUG (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Expecting 1 gateways
2018-12-12 19:28:08 INFO (SyncWorker_1) [homeassistant.components.xiaomi_aqara] Discovering Xiaomi Gateways (Try 1)
2018-12-12 19:28:08 INFO (SyncWorker_1) [xiaomi_gateway] Xiaomi Gateway 04cfbcxxxxxx configured at IP 192.168.1.102:9898
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain updater took 0.6 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up logbook
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain logbook took 0.0 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up tts
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up automation
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain automation took 0.0 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up script
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain script took 0.0 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up cloud
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain cloud took 0.0 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up conversation
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain conversation took 0.0 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setting up config
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.group from homeassistant.components.config.group
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.device_registry from homeassistant.components.config.device_registry
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.entity_registry from homeassistant.components.config.entity_registry
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.core from homeassistant.components.config.core
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.config_entries from homeassistant.components.config.config_entries
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.auth_provider_homeassistant from homeassistant.components.config.auth_provider_homeassistant
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.automation from homeassistant.components.config.automation
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.auth from homeassistant.components.config.auth
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.hassbian from homeassistant.components.config.hassbian
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.customize from homeassistant.components.config.customize
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.loader] Loaded config.script from homeassistant.components.config.script
2018-12-12 19:28:08 ERROR (MainThread) [homeassistant.components.sensor] Error while setting up platform xiaomi_aqara
Traceback (most recent call last):
File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity_platform.py", line 128, in _async_setup_platform
SLOW_SETUP_MAX_WAIT, loop=hass.loop)
File "/usr/local/lib/python3.6/asyncio/tasks.py", line 358, in wait_for
return fut.result()
File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.6/site-packages/homeassistant/components/sensor/xiaomi_aqara.py", line 24, in setup_platform
for (_, gateway) in hass.data[PY_XIAOMI_GATEWAY].gateways.items():
KeyError: 'xiaomi_gw'
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain config took 0.1 seconds.
2018-12-12 19:28:08 INFO (MainThread) [homeassistant.setup] Setup of domain tts took 0.2 seconds.
2018-12-12 19:28:09 INFO (MainThread) [homeassistant.setup] Setup of domain sensor took 1.5 seconds.
2018-12-12 19:28:18 WARNING (MainThread) [homeassistant.setup] Setup of xiaomi_aqara is taking over 10 seconds.
2018-12-12 19:28:18 ERROR (SyncWorker_1) [xiaomi_gateway] Cannot connect to Gateway
2018-12-12 19:28:18 ERROR (SyncWorker_1) [xiaomi_gateway] No data in response from hub None
2018-12-12 19:28:18 INFO (SyncWorker_1) [xiaomi_gateway] Discovering Xiaomi Devices