Xiaomi Sensor with Lux help

Hello.

I have 2 of these and 1 older without lux. I am struggling with them and automation’s. They work well when they work, but I think they must have some sort of long time out? maybe more than 10 minutes?

I can trigger the motion, light on. several minutes later the sensor reports off to HA. So I go to trigger it again and nothing, stays as OFF, but check the log in the Xiaomi app and it has been triggered.

Is there some sort of setting I need to set to allow the Xiaomi gateway to speak to HA more regularly please?

Cheers
Mark

25 minutes had gone by and I walked in, no status change in HA but it did in the Xiaomi app… am I missing something please?

It looks like your wireless connection (AP <-> xiaomi gateway) is flaky. The “there is motion”-event is a multicast/udp broadcast. If the event gets lost there is no way for a recovery at the moment. The mi home app / the communication with the xiaomi server in china uses another protocol. So the lost (local network) event between home assistant and xiaomi gateway doesn’t have an impact.

ahh that makes perfect sense thank you. I have moved the gateway next to my router (was in another room) and it looks to have sorted it out I think! I have 3 routers in the house sharing SSID to allow roaming as I had several dead spots and wonder if this was causing a problem with the gateway.

Cheers
Mark

You could check the gateway is connected to the correct access point for safety:

mi home app -> gateway -> (...more) -> about -> gateway information

The fourth line is a json string which includes the BSSID of your access point. Of the paragraph is empty (“null”) go back and enter the “gateway information” section again. The json blob will show up now.

Quick question on luminosity values provided by Xiaomi:

  • Gateway values are shown in lm (Lumen);
  • Aqara values are shown in lx (Lux).

I’m definitely not an expert in the subject, but according to Wikipedia, lx depends on the area, which lm doesn’t.

Illuminance is a measure of how much luminous flux is spread over a given area. 
One can think of luminous flux (measured in lumens) as a measure of the total 
"amount" of visible light present, and the illuminance as a measure of the intensity of 
illumination on a surface. A given amount of light will illuminate a surface more dimly if it 
is spread over a larger area, so illuminance is inversely proportional to area when the 
luminous flux is held constant.


One lux is equal to one lumen per square metre:
1 lx = 1 lm/m2

So my question is: how can the sensor know the area to provide measurements in lx? Is it maybe related with the detection distance of 7m with 170-degree detection angle?

Is the gateway sending the values with unit of measurement lx? I suppose so, because I remember seeing it in the device log in Mi Home app.

The measurement unit of the gateway illumination sensor is unknown. It provides a value between 300 and 1300. The home assistant component shifts the value a bit (-300 = 0…1000).

I mean the Aqara motion sensor, from the gateway…