019-05-04 19:57:34 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi_aqara_custom
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/config/custom_components/xiaomi_aqara_custom/__init__.py", line 124, in setup
xiaomi.discover_gateways()
File "/config/deps/lib/python3.7/site-packages/xiaomi_gateway/__init__.py", line 108, in discover_gateways
discovery_retries, self._interface,
UnboundLocalError: local variable 'discovery_retries' referenced before assignment
2019-05-04 19:58:28 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi_aqara
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/xiaomi_aqara/__init__.py", line 132, in setup
xiaomi.discover_gateways()
File "/config/deps/lib/python3.7/site-packages/xiaomi_gateway/__init__.py", line 108, in discover_gateways
discovery_retries, self._interface,
UnboundLocalError: local variable 'discovery_retries' referenced before assignment
I rename value of DOMAIN in __init__.py to xiaomi_aqara_custom and HA is booting again. All my components name got changed though. Need to edit all my automations.
I’m getting these last bit of errors. No sure what it is but most of the sensors and stuff seems to be working. Anyone can help me troubleshoot these last bits?
Error during setup of component xiaomi_aqara
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
component.setup, hass, processed_config) # type: ignore
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/site-packages/homeassistant/components/xiaomi_aqara/__init__.py", line 132, in setup
xiaomi.discover_gateways()
File "/config/deps/lib/python3.7/site-packages/xiaomi_gateway/__init__.py", line 108, in discover_gateways
discovery_retries, self._interface,
UnboundLocalError: local variable 'discovery_retries' referenced before assignment
I’m using both aqara and xiaomi motion sensors with decozn. I’ve made the hardware modification but it still refreshes every two minutes. Do i have to change something in config files? If so then what exactly?
I’m using Zigbee2Mqtt myself, and I have to change its config file or it won’t work.
Therefore I’m pretty sure you have to change a setting in Deconz in order for this to work.
In my Zigbee2Mqtt there is this setting: occupancy_timeout: 5
A few days ago I noticed that I had two gateways discovered in HA: xiaomi_aqara and xiaomi_aqara_custom
This happened after 0.92 release, with the new domain name for custom component - xiaomi_aqara_custom. Somehow HA also discovered the xiaomi_aqara and all the sensors and devices were added twice.
I tried to check the init.py code to see if I can find a solution, but my python skills sucks, so I had no luck with that.
So I decided to move to ziqbee2mqtt and I must say that everything works flawless with the hardware mod and occupancy_timeout option in ziqbee2mqtt. The only thing that I have to improve is the range if zigbee signal.
Actually yes, I was about to write some short guide. I’m not at home at the moment so I’ll try to write it as precise as I remember
Basically:
Install Postman addon for chrome (or use other tool to send api reuqests)
In deconz setings find something like “Open for other applications”
In Postman send Post request: at http://hassioip:40850/api/ ; in body (raw) put: { “devicetype”: “my application” } it should rerutn you API key
Go at http://hassioip:40850/api/apikey/sensors/ and find your sensor (it should be one or two digits)
Go at http://hassioip:40850/api/apikey/sensors/sensornumber to check if it’s right one. It shoud have parameter like duration: 90
Use Postman to send POST request at http://hassioip:40850/api/apikey/sensors/sensornumber /config ; in body (raw) put: {“duration”: 5} - where 5 is refresh time.
Many thanks @syssi, after mod 3 of my sensors and using your custom component, everything works perfect. I only had to hide the duplicated entities, but this is not a big deal. Great job mate!!
I would be happy about a copy of a (maybe reduced) .storage/core.entity_registry file. This entries will give a hint what’s going wrong here (in case of duplicates).
I don’t have duplicates, as custom component doesn’t work for me since 0.92. I cannot figure out what I must change in order for it to start working again?