Xiaomi Human / Body / Motion Sensor - Timeout

yeah those files are in hafolder/custom_components/xiaomi_aqara/ but i don’t know what’s the problem, I did everything of your procedure but on ha restart it just won’t start and even the log won’t record anything so i don’t know how to troubleshoot it

Hi,

I have 4 xiaomi pir sensors, they all work verry good, but occasionally 1 of them, at random order is failing

I don’t see them as detected in HA, they don’t change state… (Motion not detected)
I am using deconz/conbee…

I have they idea they sometimes switch to another router or just loose link… A few minutes later, it’s working again

Assume this custom component also works with the modded xiaomi mijia motion sensor?

Just realised you only need the custom component if using the xiaomi gateway. I’m using the zigbee2mqtt gateway so modding the sensor and setting the “occupancy_timeout” to 5 works great.

Same here.
What to search for in the log file?
How to change folder permission? Via SSH?
Any suggestion appreciated.

yes . I am modded mine and all is perfect now.

Hi @syssi I’m testing HA 0.92.0b2 and these errors appear to me.

 2019-04-20 14:49:27 ERROR (SyncWorker_17) [xiaomi_gateway] Cannot connect to Gateway
 2019-04-20 14:49:27 ERROR (SyncWorker_17) [xiaomi_gateway] No data in response from hub None

Does the binary sensor change have anything to do with it? I have updated every file (including manifest.json and services.yaml) from the latest beta release to my custom component dir excluding the modified binary_sensor.py. I can keep it as it is or I need to modify your binary_sensor.py? Thanks in advance

ok i finally did it guys, was an error on my side because of an erraneous copy-paste

btw i have a problem, every time the sensor is idle for some time and then it activates the mijia gateway play a recorded female chinese voice that i can’t understand (i even tried to change it to english without success) and that i can’t disable, it’s very annoying

It is a known problem. A side effect of the mod. You can lower the promt volume to 0 from the volume settings under gateway. That’s the only solution as of now as far as I know.

1 Like

btw latest update broke something in the custom components files

What does ‘latest update’ mean?

the home assistant 0.92

Ok, now we have got that far, how about a log showing the error?

there’s no entries in the log, nor even those warnings about the use of custom components

Hi,

Has any one tried making hardware modification with pencil? I’ve tried it several times but the sensor still keeps refreshing its state only after 2 minutes.

Yep, the 0.92 broke some custom_components. I did this, what is on devs blog, but it seems like hass ignoring xiaomi_aqara_custom and uses xiaomi_aqara instead. Here is what was on devs blog:

  • If you want to override a built-in integration, you need to specify a manifest.json for your custom integration. Note that we strongly discourage overriding built-in integrations. Instead, if you want to run an integration with custom changes change the integration name. For example if you want to run a custom version of the MQTT integration, named mqtt in Home Assistant:
    • Copy the content of the mqtt folder from the Home Assistant repository to a new folder <config>/custom_components/mqtt_custom/
    • Open mqtt_custom/manifest.json and change the value for domain from mqtt to mqtt_custom
    • Open mqtt_custom/__init__.py and change the value of DOMAIN from mqtt to mqtt_custom
    • Anywhere in your config where you referenced mqtt , reference mqtt_custom . So use mqtt_custom: to specify the host and use platform: mqtt_custom when specifying platforms.

I would say that some custom component authors didn’t update their software :slight_smile:

In fact yes. But it is getting irritating - from few updates I need to fix something manually every update. The Aqara component isn’t very irritating - only my lights are on 2 minutes more than I want. But one of update broke my covers and one morning I needed to login manually to all my 12 shutters to open it.

Have you changed the name of the folder from xiaomi_aqara to xiaomi_aqara_custom? Also, in configuration.yaml you need to use xiaomi_aqara_custom instead of xiaomi_aqara where you define the gateway

xiaomi_aqara_custom:
  discovery_retry: 15
  gateways:
   - key: YOUR_KEY
     host: ”YOUR_HOST”

i tried but this broken things up even more, now the log is giving me this:

Traceback (most recent call last):
  File "/path-to/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/USER/.homeassistant/custom_components/xiaomi_aqara_custom/__init__.py", line 124, in setup
    xiaomi.discover_gateways()
  File "/path-to/homeassistant/lib/python3.6/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-02 18:03:28 ERROR (MainThread) [homeassistant.setup] Error during setup of component xiaomi_aqara
Traceback (most recent call last):
  File "/path-to/homeassistant/lib/python3.6/site-packages/homeassistant/setup.py", line 156, in _async_setup_component
    component.setup, hass, processed_config)  # type: ignore
  File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/path-to/homeassistant/lib/python3.6/site-packages/homeassistant/components/xiaomi_aqara/__init__.py", line 132, in setup
    xiaomi.discover_gateways()
  File "/path-to/homeassistant/lib/python3.6/site-packages/xiaomi_gateway/__init__.py", line 108, in discover_gateways
    _LOGGER.info('Xiaomi Gateway %s found at IP %s', sid, ip_add)
UnboundLocalError: local variable 'discovery_retries' referenced before assignment

Hi,

I tried to replace my gateway with xiaomi_aqara_custom in configuration.yaml but my home assistant didn’t start up. I need to revert the changes through samba before it start up again. Anything else you think i can try to do?