Xiaomi Human / Body / Motion Sensor - Timeout

I meant the file structure and not the content of the files. Just move my files to the new structure.

can you give me your link of file. I’m looking all thread but don’t see it . can you help ?

Found your file here:

https://raw.githubusercontent.com/syssi/home-assistant/9e24ac84f0946b6c3a337a50901a64be34a52449/homeassistant/components/binary_sensor/xiaomi_aqara.py

all I need is download that file and rename it to
binary_sensor.py
and copy it to
home/homeassistant/.homeassistant/custom_components/xiaomi_aqara/
and restart HA. That’s all? Sorry, I’m new so I have to ask carefully for incase I misunderstood. Thanks please reply

This is correct!

Not sure what all this talk is of hardware hacks and 2 minute timeouts. I am sniffing the direct zigbee traffic from the sensor, while connected to the Xiaomi hub, and look at this while I wave my hand in front of it (it’s filtered to only show motion events sent from the sensor):

Checkout the time column…it actually reports motion almost every 5 or 6 seconds!

Any 2 minute limitation is enforced purely by the API on the gateway or by something coded into zigbee2mqtt.

2 Likes

Huh, no I take it back. I’ve had a read through and I must have somehow activated the special mode (no idea how??!). It’s back to having a blind time of around 1 minute.

After use this method. I know we will have a problem with notification Chinese voice from gateway. WE can reduce the volume of the gateway. But I want to know IF we still can use the Xiaomi ring bell with gate way when we used moded sensor??

In MiHome app you have different volume settings for Alarm, Doorbell, Radio and Prompt (at least in iOS app). Setting Prompt volume to 0 will solve the problem with Chinese lady and you can still use Alarm, Dorbell and Radio

1 Like

Hi

i using hass.io (0.88.1) and xiaomi gateway v.2

some of the motion sensors i have are mija and some aqara (with the light sensor).

1- to improve sensor reading in need to add:
SCAN_INTERVAL = timedelta(seconds=10) ?

2- what the difference between this one:

and

https://github.com/NidalM/home-assistant/blob/master/homeassistant/components/binary_sensor/xiaomi_aqara.py

3- i need create the file according to this path : custom_components\xiaomi_aqarabinary_sensor.py ?

tnx

I got a problem when I used your custom component. my HA does not update the status of sensor although I can see its status in HA log. when I tried to come back to original component. everything go find . I have to gateways In my house. in my log I saw that:

homeassistant.exceptions.HomeAssistantError: Entity id already exists: binary_sensor.motion_sensor_158d0002247fcf. Platform xiaomi_aqara does not generate unique IDs

this binary_sensor is the sensor which does not update the status. can you help me to fix it ?

This happens if you pair a single zigbee device with two gateways. Please unregister/unpair the device from one of your gateways: https://www.home-assistant.io/components/xiaomi_aqara/#service-xiaomi_aqararemove_device

thanks. so I have go to developer tools / services. and call Xiaomi_aquara service- remove device? Do you know how to get list of device that already pair in gateway? (I didn’t see any binary sensor in mi-app but I think that sensor still connect to the gateway)

I’ve rebased my branch to be compatible with the new directory structure of HA >0.88:

https://github.com/syssi/home-assistant/tree/feature/xiaomi-aqara-modded-motion-sensor
https://github.com/syssi/home-assistant/tree/feature/xiaomi-aqara-modded-motion-sensor/homeassistant/components/xiaomi_aqara

1 Like

Please enable the debug output of the component and the underlying library by:

logger:
  default: warn
  logs:
    xiaomi_gateway: debug
    homeassistant.components.xiaomi_aqara: debug
    homeassistant.components.xiaomi_aqara.binary_sensor: debug

Reboot Home Assistant and look for get_id_list in your home-assistant.log:

2019-03-06 08:53:35 INFO (Thread-2) [xiaomi_gateway] Discovering Xiaomi Devices
2019-03-06 08:53:35 DEBUG (Thread-2) [xiaomi_gateway] _send_cmd >> b'{"cmd" : "get_id_list"}'
2019-03-06 08:53:35 DEBUG (Thread-2) [xiaomi_gateway] _send_cmd resp << {'token': '7PAPffffffffffff', 'data': '["158dffffffffff", ...]', 'cmd': 'get_id_list_ack', 'sid': '286cffffffff'}
2019-03-06 08:53:35 INFO (Thread-2) [xiaomi_gateway] Found 39 devices
1 Like

Do we need to add anything to the cofig.yaml or change any permissions to the file to get this to work?

BTW thanks for working on this @syssi These sensors not updating enough is a real bugbear for me

No special config or permission needed. Just use the changed files as custom component.

Few days ago I installed custom component. Now it doesn’t work. It was working like a charm for day or two. It looks like hass doesn’t see this custom component and use “normal” component. How to check it?

Is there a way to customize the custom component? So that it is enabled for only certain motion sensors which I have modded and not for others?
As the zigbee devices are discovered automatically I can’t think of a way to customize each sensor.

Thanks for the reply, I’ll get modding them when I get home today! Much appreciated

@syssi
Please help me to load a custom xiaomi_aquara component on my HA. I’ve just update my HA to 0.89.2 and I cannot load my custom Xiaomi aqua component in my HA. I already paste syssi’s binary_sensor.py to

.homeassistant/custom_components/xiaomi_aqara/

but when I restart my HA and check my HA’s Log. I didn’t see my HA load that custom component. HA only load other custom component like this:

2019-03-13_16:49:11.60767 2019-03-13 23:49:11 WARNING (MainThread) [homeassistant.components.http] legacy_api_password support has been enabled. If you don't require it, remove the 'api_password' from your http config.
2019-03-13_16:49:18.61819 2019-03-13 23:49:18 WARNING (MainThread) [homeassistant.loader] You are using a custom component for lich_am.sensor which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you do experience issues with Home Assistant.

please help