Xiaomi Human / Body / Motion Sensor - Timeout

@syssi I tryed copying everything from ur github again, put everything in custom_components\xiaomi_aqara, restarted, but it doesn’t seem to work.

Could you provide your homeassistant.log?

I read it here:

and here

My findings on this regards are:

1: From Hassio .0.93.0 you have to follow this instruction to override a built-in integration.

2: The component xiaomi_aqara use a discovery service method that take place everythime you start HA. If you include a second custom component (xiaomi_aqara_custom, lets say) then you have two instances of the same discovery method taking place, one for the build-in xiaomi_aqara and another for the xiaomi_aqara_custom. Thats the source of duplicated entities (actually are not “duplicated” but recreated with a “_2” at the end of the entity name) something like this:

binary_sensor.motion_sensor_158d0003a40825
binary_sensor.motion_sensor_158d0003a40825_2

I thought that I could disable the auto discovery for Xiaomi GW on the configurtion_yaml using:

discovery:
  ignore: 
   - xiaomi_gw

In my case I dont have duplicated entities anymore …

Thougnts?

Your solution is fine. It should work also if you don’t rename the component. May be I’m wrong. I will try it soon

@syssi you are right, by just copying your custom component at /config/custom_component/xiaomi_aqara and deleting all the xiaomi sensor entities previosly created and restarting HA everything just works fine.

I just apologize for the confusion created.

1 Like

Hello guys!

Does this hack also improve the illumination detection without motion ?

I only see illumination updates on motion events. That behaviour remain the same.

In my case I managed to keep motions events puting this thing in front of the sensor gato-chino-dorado-de-la-suerte-con-movimiento-de-mano-pata-D_NQ_NP_13386-MLM2995607551_082012-F

1 Like

Okay, thanks for this information.

Not shure why, but I cannot get this component to work anymore… I’m using Xiaomi gateway.
@syssi Is there something new I need to do?

Hi,

I read almost all discussion and came with this steps that need to be done:

  1. Mod the sensor
  2. Create the /custom_components/xiaomi_aqara/ folder
  3. Put init .py and binary_sensor.py in the /custom_components/xiaomi_aqara/ folder
  4. NO changes to configuration.yaml to use the custom component?
  5. Reboot HA

Two questions:

  1. After this motion will be triggered every 5 second in ha yes ?
  2. Is there any other way to do this without this hardware mod ?

@syssi Any update on how to get this working with xiaomi gateway?

I don’t understand your question. What are you looking for?

I have modded the sensor, and it has been working fine until I update HomeAssistant to 0.93. Is there some new config I need to update for custom component?

Still works for me, I’d check all your steps again.

HI All, after some test on the unmodded version. Here is hte time line of the sensor.
Consider 0 sec when motion detected
0 - ha shows motion changed to on
60 - 120 motion sensor tried to detect motion.
120 if there motion detect - the motion extend another 60 sec.if no motion, ha will change to off.
180 ha shows off if no motion after 120 sec. if there is motion, the timer extend every 60 sec
eg
at 130 sec, if there is motion 130+60 = 190. ha turn off at 190 sec.

hopefully this helps writing automation.
I try to highlight, there is no changes of state between 120 and 180 .
if no motion at 60 -120 it is off. if there is motion, it will extend to 180.

@syssi First of all, thank you very much for this custom component.

Unfortunately it’s not working for me.

To resume what I have done so far:

  1. Modded one (two others are not modded, connected to the same gateway) of my aqua sensors (I can see in the Xiaomi Home app that the mod worked)
  2. created a folder ‘custom_components’ in ‘config’ folder
  3. created a folder ‘xiaomi_aqara’ in ‘custom components’ folder
  4. uploaded binary_sensory.py and init.py from ‘https://github.com/syssi/home-assistant/tree/feature/xiaomi-aqara-modded-motion-sensor/homeassistant/components/xiaomi_aqara’ to ‘xiaomi_aqara’ folder
  5. restarted home assistant

Is this procedure correct or did I anything wrong?
There is just no change after doing this. The sensors are still working as before :frowning:

this is btw. my log file (maybe it helps):

INFO:2019-08-20 11:38:39,953:hass_configurator.configurator:127.0.0.1 - "GET /api/listdir?path=. HTTP/1.1" 200 -
INFO:2019-08-20 11:38:39,961:hass_configurator.configurator:127.0.0.1 - "GET / HTTP/1.1" 200 -
172.30.32.2 - - [20/Aug/2019:11:38:39 +0200] "GET /api/listdir?path=. HTTP/1.1" 200 4728 "http://hassio.local:8123/api/hassio_ingress/-1e11RGHyBG6gURRXg8KqEFDo0-Z8ZmMH6rSKOKNz08/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"
172.30.32.2 - - [20/Aug/2019:11:38:40 +0200] "GET / HTTP/1.1" 200 45584 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"
INFO:2019-08-20 11:38:40,568:hass_configurator.configurator:127.0.0.1 - "GET /api/file?filename=/config/custom_component/xiaomi_aqara/binary_sensor.py HTTP/1.1" 200 -
172.30.32.2 - - [20/Aug/2019:11:38:40 +0200] "GET /api/file?filename=/config/custom_component/xiaomi_aqara/binary_sensor.py HTTP/1.1" 200 18065 "http://hassio.local:8123/api/hassio_ingress/-1e11RGHyBG6gURRXg8KqEFDo0-Z8ZmMH6rSKOKNz08/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"
INFO:2019-08-20 11:38:44,275:hass_configurator.configurator:127.0.0.1 - "GET /api/file?filename=/config/home-assistant.log HTTP/1.1" 200 -
172.30.32.2 - - [20/Aug/2019:11:38:44 +0200] "GET /api/file?filename=/config/home-assistant.log HTTP/1.1" 200 155 "http://hassio.local:8123/api/hassio_ingress/-1e11RGHyBG6gURRXg8KqEFDo0-Z8ZmMH6rSKOKNz08/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"
INFO:2019-08-20 11:38:50,579:hass_configurator.configurator:127.0.0.1 - "POST /api/save HTTP/1.1" 200 -
172.30.32.2 - - [20/Aug/2019:11:38:50 +0200] "POST /api/save HTTP/1.1" 200 103 "http://hassio.local:8123/api/hassio_ingress/-1e11RGHyBG6gURRXg8KqEFDo0-Z8ZmMH6rSKOKNz08/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"
INFO:2019-08-20 11:38:50,627:hass_configurator.configurator:127.0.0.1 - "GET /api/listdir?path=/config HTTP/1.1" 200 -
172.30.32.2 - - [20/Aug/2019:11:38:50 +0200] "GET /api/listdir?path=/config HTTP/1.1" 200 4852 "http://hassio.local:8123/api/hassio_ingress/-1e11RGHyBG6gURRXg8KqEFDo0-Z8ZmMH6rSKOKNz08/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.1.2 Safari/605.1.15"

You spelt aqara wrong when you created your folder in custom_components.
Not sure whether this is your issue though.

Thanks @miles.beattie

Unfortunately it was typed wrong here but correct in home assistant.
So issue still exists…

@syssi Any chance that you have a look at my issue?

In the meantime I also tried to do the following things to get the issue solved (without access).

  • remove the sensor from the entity list and restart HA
  • add all files of your folder to the xiaomi_aqara folder (and not only init.py and binary_sensor.py)

So now I guess that there are only two options left:
a) I need to mod all my sensors?
b) I need to change xiaomi_aqara to xiaomi_aqara_custom and ignore the stock config

Anything from your side to help?