Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[New device support]: Aqara P1 Motion Sensor (MS-S02) #11990

Closed
backlink-market opened this issue Mar 30, 2022 · 75 comments · Fixed by Koenkk/zigbee-herdsman-converters#4099
Closed
Labels
new device support New device support request

Comments

@backlink-market
Copy link

backlink-market commented Mar 30, 2022

Link

https://www.aqara.com/en/product/motion-sensor-p1

Database entry

{"id":24,"type":"EndDevice","ieeeAddr":"0x54ef44100043e1a1","nwkAddr":380,"manufId":4447,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.motion.ac02","epList":[1],"endpoints":{"1":{"profId":260,"epId":1,"devId":263,"inClusterList":[0,1,3,64704],"outClusterList":[3,25,64704],"clusters":{"genBasic":{"attributes":{"appVersion":5,"modelId":"lumi.motion.ac02","manufacturerName":"LUMI","powerSource":3,"zclVersion":3,"hwVersion":1,"dateCode":"Dec 7 2021","swBuildId":"0.0.0_0005"}},"aqaraOpple":{"attributes":{"252":0}}},"binds":[],"configuredReportings":[],"meta":{}}},"appVersion":5,"hwVersion":1,"dateCode":"Dec 7 2021","swBuildId":"0.0.0_0005","zclVersion":3,"interviewCompleted":true,"meta":{},"lastSeen":1648630655174,"defaultSendRequestWhen":"immediate"}

Comments

The new Aqara P1 Motion Sensor (MS-S02) is nearly the same as the Aqara RTCGQ11LM but with two Batteries and a possibilty to change the timeout and constant LUX updates.

@backlink-market backlink-market added the new device support New device support request label Mar 30, 2022
@Koenkk
Copy link
Owner

Koenkk commented Mar 30, 2022

@z-x-f @Otnow , managed to get this device already? 😄

@backlink-market
Copy link
Author

@Otnow
Copy link

Otnow commented Mar 30, 2022

🙂 Unfortunately, I do not have this sensor, but judging by description, functionally it is a symbiosis of RTCGQ12LM and RTCGQ13LM.

Accordingly, it can be assumed that this sensor uses the logic of its predecessors, i.e. the external converter suggested below might work:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const ota = require('zigbee-herdsman-converters/lib/ota');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
        zigbeeModel: ['lumi.motion.ac02'],
        model: 'RTCGQ14LM',
        vendor: 'Xiaomi',
        whiteLabel: [{vendor: 'Xiaomi', model: 'MS-S02'}],
        description: 'Aqara P1 human body movement and illuminance sensor',
        fromZigbee: [fz.RTCGQ12LM_occupancy_illuminance, fz.aqara_opple, fz.battery],
        toZigbee: [tz.aqara_detection_interval, tz.aqara_motion_sensitivity],
        exposes: [e.occupancy(), e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
            exposes.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high']),
            exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
                .withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
        meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await endpoint.read('genPowerCfg', ['batteryVoltage']);
            await endpoint.read('aqaraOpple', [0x0102], {manufacturerCode: 0x115f});
            await endpoint.read('aqaraOpple', [0x010c], {manufacturerCode: 0x115f});
        },
        ota: ota.zigbeeOTA,
};

module.exports = definition;

Important: to check the operation of proposed converter, latest stable versions of zigbee2mqtt and firmware of coordinator (at least as indicated here) must be installed.

@backlink-market
Copy link
Author

backlink-market commented Mar 30, 2022

I am using the Z-Stack firmware with my SONOFF Zigbee 3.0 USB Dongle via IoBroker with this https://github.com/ioBroker/ioBroker.zigbee adapter.
So how can I test your suggestion? Where to add this code?

@Otnow
Copy link

Otnow commented Mar 30, 2022

I am using the Z-Stack firmware with my SONOFF Zigbee 3.0 USB Dongle via IoBroker with this https://github.com/ioBroker/ioBroker.zigbee adapter.
So how can I test your suggestion? Where to add this code?

I'm not familiar with IoBroker, so I can't say if it's possible to use an external converter in it.

Maybe someone who knows can tell?

@asgothian
Copy link

asgothian commented Mar 31, 2022

The iobroker allows the use of external converters, but the feature is not well documented. As such, i need to verify the exact steps which are required and will provide them later today.

A.

p.s. Use of external converters is unwieldy at the moment, and requires editing the paths for the require statements. I am working on changing this to offer use of external converters in an identical fashion to zigbee2mqtt.io. I did provide detailed instructions in the issue on the iobroker.ioBroker.zigbee project.

@backlink-market
Copy link
Author

backlink-market commented Mar 31, 2022

🙂 Unfortunately, I do not have this sensor, but judging by description, functionally it is a symbiosis of RTCGQ12LM and RTCGQ13LM.

Accordingly, it can be assumed that this sensor uses the logic of its predecessors, i.e. the external converter suggested below might work:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const ota = require('zigbee-herdsman-converters/lib/ota');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
        zigbeeModel: ['lumi.motion.ac02'],
        model: 'RTCGQ14LM',
        vendor: 'Xiaomi',
        whiteLabel: [{vendor: 'Xiaomi', model: 'MS-S02'}],
        description: 'Aqara P1 human body movement and illuminance sensor',
        fromZigbee: [fz.RTCGQ12LM_occupancy_illuminance, fz.aqara_opple, fz.battery],
        toZigbee: [tz.aqara_detection_interval, tz.aqara_motion_sensitivity],
        exposes: [e.occupancy(), e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
            exposes.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high']),
            exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
                .withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
        meta: {battery: {voltageToPercentage: '3V_2850_3000_log'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await endpoint.read('genPowerCfg', ['batteryVoltage']);
            await endpoint.read('aqaraOpple', [0x0102], {manufacturerCode: 0x115f});
            await endpoint.read('aqaraOpple', [0x010c], {manufacturerCode: 0x115f});
        },
        ota: ota.zigbeeOTA,
};

module.exports = definition;

Important: to check the operation of proposed converter, latest stable versions of zigbee2mqtt and firmware of coordinator (at least as indicated here) must be installed.

Unfortunatly this code is not working. There is a TypeError: TypeError: Cannot read property 'options' of undefined
Please see https://github.com/ioBroker/ioBroker.zigbee/issues/1402#issuecomment-1084971902

EDIT:
Finally I made the adapter even start without errors by changing this line:
toZigbee: [tz.aqara_detection_interval, tz.aqara_motion_sensitivity],
to:
toZigbee: [tz.aqara_detection_interval, tz.RTCGQ13LM_motion_sensitivity],

and removing the meta. meta: { battery: { voltageToPercentage: '3V_2850_3200' } },

Now I am able to add the sensor but it still throws an error while adding it:

Pairing time left: 27
Error: Error collectOptions for 54ef44100043e1a1. Error: Error: Not batteryVoltageToPercentage type supported: 3V_2850_3000_log
    at batteryVoltageToPercentage (C:\iobroker\MiCasa\node_modules\zigbee-herdsman-converters\lib\utils.js:168:15)
    at Object.convert (C:\iobroker\MiCasa\node_modules\zigbee-herdsman-converters\converters\fromZigbee.js:328:39)
    at C:\iobroker\MiCasa\node_modules\iobroker.zigbee\main.js:462:43
    at StatesController.collectOptions (C:\iobroker\MiCasa\node_modules\iobroker.zigbee\lib\statescontroller.js:179:23)
    at runNextTicks (internal/process/task_queues.js:60:5)
    at processImmediate (internal/timers.js:437:9). undefined
Pairing time left: 28
New device joined '0x54ef44100043e1a1' model RTCGQ14LM
Interview successful: {"friendly_name":"0x54ef44100043e1a1","model":"RTCGQ14LM","vendor":"Xiaomi","description":"Aqara P1 human body movement and illuminance sensor","supported":true}
Pairing time left: 28
Pairing time left: 27
Device '0x54ef44100043e1a1' announced itself
Interview started: 0x54ef44100043e1a1

The occupany, link quality,illuminance_raw and available fields are working the other things are (null) see here:
http://prntscr.com/CzEkUQn4otgR

@Otnow
Copy link

Otnow commented Apr 1, 2022

Unfortunatly this code is not working. There is a TypeError: TypeError: Cannot read property 'options' of undefined
Please see https://github.com/ioBroker/ioBroker.zigbee/issues/1402#issuecomment-1084971902

I got acquainted with your ioBroker PR and it seems that I understood a little how ioBroker.zigbee module works.

According to ioBroker changelog, ioBroker.zigbee 1.6.16 was released on 2022-02-16 and, accordingly, I can assume that version of zigbee-herdsman-converters used in it corresponds to this date.

My initial version of external converter was designed for development version of zigbee2mqtt (not stable version, as I mistakenly indicated), so it did not work for you, because at the moment, significant changes have been made to zigbee-herdsman-converters.

Try to test this variant adapted, it seems to me, to your version of zigbee-herdsman-converters:

const fz = require('zigbee-herdsman-converters/converters/fromZigbee');
const tz = require('zigbee-herdsman-converters/converters/toZigbee');
const exposes = require('zigbee-herdsman-converters/lib/exposes');
const ota = require('zigbee-herdsman-converters/lib/ota');
const e = exposes.presets;
const ea = exposes.access;

const definition = {
        zigbeeModel: ['lumi.motion.ac02'],
        model: 'RTCGQ13LM',
        vendor: 'Xiaomi',
        whiteLabel: [{vendor: 'Xiaomi', model: 'MS-S02'}],
        description: 'Aqara P1 human body movement and illuminance sensor',
        fromZigbee: [fz.RTCGQ12LM_occupancy_illuminance, fz.aqara_opple, fz.battery],
        toZigbee: [tz.aqara_detection_interval, tz.RTCGQ13LM_motion_sensitivity],
        exposes: [e.occupancy(), e.illuminance().withUnit('lx').withDescription('Measured illuminance in lux'),
            exposes.enum('motion_sensitivity', ea.ALL, ['low', 'medium', 'high']),
            exposes.numeric('detection_interval', ea.ALL).withValueMin(2).withValueMax(65535).withUnit('s')
                .withDescription('Time interval for detecting actions'), e.temperature(), e.battery()],
        meta: {battery: {voltageToPercentage: '3V_2850_3200'}},
        configure: async (device, coordinatorEndpoint, logger) => {
            const endpoint = device.getEndpoint(1);
            await endpoint.read('genPowerCfg', ['batteryVoltage']);
            await endpoint.read('aqaraOpple', [0x0102], {manufacturerCode: 0x115f});
            await endpoint.read('aqaraOpple', [0x010c], {manufacturerCode: 0x115f});
        },
        ota: ota.zigbeeOTA,
};

module.exports = definition;

Changes:

  • tz.aqara_motion_sensitivity replaced by tz.RTCGQ13LM_motion_sensitivity
  • 3V_2850_3000_log replaced by 3V_2850_3200
  • also for testing needs, model RTCGQ14LM is replaced by RTCGQ13LM, so that motion_sensitivity is initialized when pairing

Accordingly, it will be necessary to re-pair the sensor.

@backlink-market
Copy link
Author

backlink-market commented Apr 1, 2022

Great, this works well except the motion_sensitivity and detection_interval. Both values are not respected by the sensor when I chage them. Its always the default value. The log shows the following error:

Error 240 on send command to 0x54ef44100043e940. Error: Error: Write 0x54ef44100043e940/1 aqaraOpple({"258":{"value":[30],"type":32}}, {"sendWhen":"immediate","timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":0,"srcEndpoint":null,"reservedBits":0,"manufacturerCode":4447,"transactionSequenceNumber":null,"writeUndiv":false}) failed (Data request failed with error: 'MAC transaction expired' (240)) at ZStackAdapter.sendZclFrameToEndpointInternal (C:\iobroker\MiCasa\node_modules\zigbee-herdsman\dist\adapter\z-stack\adapter\zStackAdapter.js:331:23) at async Queue.executeNext (C:\iobroker\MiCasa\node_modules\zigbee-herdsman\dist\utils\queue.js:19:32)

@Otnow
Copy link

Otnow commented Apr 1, 2022

Great, this works well except the motion_sensitivity and detection_interval. Both values are not respected by the sensor when I chage them. Its always the default value.

Because since sensor is battery-powered, it is in sleep mode most of the time to save energy and therefore does not respond to commands.

In order for sensor to accept new settings, immediately after changing them in web interface, press button on it to wake it up.

@backlink-market
Copy link
Author

Because since sensor is battery-powered, it is in sleep mode most of the time to save energy and therefore does not respond to commands.

In order for sensor to accept new settings, immediately after changing them in web interface, press button on it to wake it up.

Ok, did it and the error does not pop up in the log but the sensor still does not respect that value. Occupany is still 60s true before it falls back to false when no motion happens.

@Otnow
Copy link

Otnow commented Apr 1, 2022

Ok, did it and the error does not pop up in the log but the sensor still does not respect that value. Occupany is still 60s true before it falls back to false when no motion happens.

To better understand what's going on, we now need a debug log.

Enable debug messages (it seems to me that this option is visible in this screenshot) and provide a log in which process of pairing sensor and an attempt to change its settings will be visible.

@asgothian
Copy link

This is correct. Please note: In order to see the zigbee-herdsman-debug messages, the adapter has to be run in debug mode as well.

A.

@backlink-market
Copy link
Author

backlink-market commented Apr 1, 2022

logs are quite big for pasting so I uploaded the log files:
Pairing log: pairing_log.txt

changing detection_interval to 10s: changed detection_interval to 10s.txt

note: There might be some unuseful logs stuff before and after but I thought its better to add more than missing something.

@Otnow
Copy link

Otnow commented Apr 1, 2022

Pairing log: https://file.io/EZ3AG2BdNS9e
changing detection_interval to 10s: https://file.io/aOixzZmlgaMc

The file.io service reports:

The file you requested has been deleted

There is no need to use a third party service as files can be attached here.

@backlink-market
Copy link
Author

Pairing log: pairing_log.txt
changing detection_interval to 10s: changed detection_interval to 10s.txt

@Otnow
Copy link

Otnow commented Apr 1, 2022

Occupany is still 60s true before it falls back to false when no motion happens.

Pairing log: pairing_log.txt

It's strange that your occupancy is 60 seconds, although during pairing, the sensor reports that detection_interval = 30 seconds:

2022-04-01 18:20:53.350 - debug: zigbee.1 (15728) Received Zigbee message from '0x54ef44100043f0b3', type 'readResponse', cluster 'aqaraOpple', data '{"258":30}' from endpoint 1 with groupID 0
...
2022-04-01 18:20:53.379 - debug: zigbee.1 (15728) Publish {"detection_interval":30} to "54ef44100043f0b3"

changing detection_interval to 10s: changed detection_interval to 10s.txt

I did not find any entry in log about pressing button on sensor after trying to change detection_interval.

Try to write a log with 2-3 attempts to change detection_interval and motion_sensitivity, as well as the start and end of motion detection.

@backlink-market
Copy link
Author

okay, here we go:
changed the interval to 13,14,15 seconds and pushed the button several times.
changed detection_interval 13,14,15s.txt

changed the motion_sensitivity several times and pushed the button several times:
changed motion sensitivity .txt

@Otnow
Copy link

Otnow commented Apr 2, 2022

changed the interval to 13,14,15 seconds and pushed the button several times. changed detection_interval 13,14,15s.txt

changed the motion_sensitivity several times and pushed the button several times: changed motion sensitivity .txt

These logs show that sensor accepts changed detection_interval and motion_sensitivity settings.

However, I did not see in logs "end of motion detection" event ("occupancy":false), which I asked to record:

as well as the start and end of motion detection.

Try to write a log that will contain following actions:

  • press button on sensor once
  • change motion_sensitivity to high and immediately press button on sensor once (no need to press it several times)
  • change detection_interval to 2 seconds and immediately press button on sensor once (no need to press it several times)
  • wait until sensor stops detecting movement ("occupancy":false)
  • create an active continuous movement in front of sensor for 15-20 seconds
  • do not create any movement in front of sensor until sensor stops detecting movement ("occupancy":false)
  • press button on sensor once

@backlink-market
Copy link
Author

Ok, this is a exact instructions 👍
Here is the log file:
Logfile.txt

@Otnow
Copy link

Otnow commented Apr 3, 2022

Here is the log file:
Logfile.txt

Very good. Judging by log, sensor accepts settings and follows them, but for some reason converter timeout does not correspond to detection_interval and is equal to default value (60 seconds), although there is a record of state change:

2022-04-03 13:40:23.153 - debug: zigbee.1 (8604) convert result {"state":{"detection_interval":2}}

This is strange and I still can not understand reason for discrepancy.

I would like to take a look at values of states of this sensor.
Is it possible in ioBroker to see current states of sensor like in zigbee2mqtt web-interface?:

Zigbee2MQTT_states

I also noticed in log that you have a lumi.motion.agl04 (RTCGQ13LM) sensor on network. The timeout algorithm in its converter is same as in what we are currently using for lumi.motion.ac02 (MS-S02).
Hence the question - does lumi.motion.agl04 work correctly for you, i.e. does timeout match value of detection_interval?

@backlink-market
Copy link
Author

backlink-market commented Apr 3, 2022

Do you mean this:
Screenshot_2

When I change the detection_interval in the RTCGQ13LM settings it shows the timeout error:
Send command to 0x54ef441000398e05 failed with no error code (Timeout - 19045 - 1 - 241 - 64704 - 4 after 10000ms)

When I try to wake up the sensor via button on the back it does not work. So the value is not set.

@Otnow
Copy link

Otnow commented Apr 3, 2022

Do you mean this:

This is a little different, it seems to me that this is an analogue of Exposes in the zigbee2mqtt web-interface.

In zigbee2mqtt, device states can be found in state.json file in data subdirectory. Maybe in ioBroker there is something similar?

When I change the detection_interval in the RTCGQ13LM settings it shows the timeout error: Send command to 0x54ef441000398e05 failed with no error code (Timeout - 19045 - 1 - 241 - 64704 - 4 after 10000ms)

When I try to wake up the sensor via button on the back it does not work. So the value is not set.

Also strange. Unable to set detection_interval on both lumi.motion.agl04 sensors?

@asgothian, can you tell us where in ioBroker we can see device states and can there be a problem with writing or reading states (in our case it is detection_interval)?

@asgothian
Copy link

The way it works in iobroker:

  • each expose will generate one or multiple states, as visible in the screenshot @backlink-market posted 2 hrs ago.
  • if a device reports any piece of information linked to an expose, this state will be updated.
  • if the operator changes a state, the respective "set" command will be issued.
  • ioBroker does not support reading individual states, but a trigger on the "device query" will attempt to read all states which offer a "read" function in the converter.

If a device offers a read function but no value is read, a message is left in the log. The same is true if a device does not actually acknowledge a "set" command.

A.

@Otnow
Copy link

Otnow commented Apr 3, 2022

@asgothian, ok, thanks.
How can we find out the exact version of zigbee-herdsman-converters that is used in @backlink-market's ioBroker?

@backlink-market
Copy link
Author

I am using Zigbee Adapter v1.6.16. Maybe @asgothian can help

@backlink-market
Copy link
Author

@Otnow I just checked the folder node_modules\zigbee-herdsman-converters and found the file package.json:
package.json.txt

The file contains this: "raw": "zigbee-herdsman-converters@14.0.422",

So I think the version you are looking for is 14.0.422 , right?

@bzeiss
Copy link

bzeiss commented May 20, 2022

@Otnow Thanks for answering. Yes, I somehow made it work. Not sure why it didn't work before, it was probably related to a missing restart as you suggested. The trigger indicator setting seems to work for me. It's not blinking any more. Thanks!

@bzeiss
Copy link

bzeiss commented May 20, 2022

@Otnow I have followed your instructions for the debug log. I hope this helps. The sensor address is 0x54ef44100049756c.

log.txt

One thing that is a little irritating for me is the motion sensor sensitivity. When I put it on high, I still need to be more or less directly in front of the sensor in order to activate it. I have the old aqara motion sensors and they activate when I'm pretty far away.

@digiblur
Copy link

@bzeiss same kind of oddness I found at times https://youtu.be/qWVbsZCj6CY

@Otnow
Copy link

Otnow commented May 20, 2022

@bzeiss, great, and thank you for the log, this is what I needed 👍

Created a PR to add support for the trigger indicator option to the zigbee2mqtt repository.

One thing that is a little irritating for me is the motion sensor sensitivity. When I put it on high, I still need to be more or less directly in front of the sensor in order to activate it. I have the old aqara motion sensors and they activate when I'm pretty far away.

The sensitivity setting was added by analogy with the RTCGQ13LM, so it is likely that it still works a little differently in the RTCGQ14LM.

In the RTCGQ14LM there may be a reverse sequence of sensitivity settings, in other words, try to set low sensitivity instead of high and test the sensor again.

@bzeiss
Copy link

bzeiss commented May 20, 2022

@Otnow Great!

About the sensitivity, I'm not sure. It behaves really odd. I have tried multiple timeout settings and occupancy timeouts along with different sensitivity values. I think low is still worse than high. No matter what configuration, the maximum detection distance is like 2m for me (with all my four P1 motion sensors).

@backlink-market
Copy link
Author

I can confirm. Most P1 sensor does only have a detection distance of 2m or below.....don't know why

@Otnow
Copy link

Otnow commented May 21, 2022

It seems that the matter is not in the sensitivity settings, but this option can be definitely excluded only by testing the sensor with the native Aqara hub.

Does anyone from the owners of the sensor have such an opportunity?


Also on the official website of the manufacturer there is such a comparison table:

Motion-Sensor P1

As far as I understand, the old model RTCGQ11LM is compared with RTCGQ14LM.

This is the detection area for the RTCGQ11LM from the user manual (by the way, the maximum distance is 7 m, not 4 m as noted in the comparison table above):

RTCGQ11LM

And this is the detection area for RTCGQ14LM from the user manual:

RTCGQ14LM

Looking at the detection areas, it is completely incomprehensible why the RTCGQ14LM has problems with this.

As one of the reasons, some kind of manufacturing defect is possible, for example, with a lens.

By the way, is there an inconspicuous protective film on the lens that can interfere with the normal operation of the sensor?

@backlink-market
Copy link
Author

backlink-market commented May 22, 2022

Does low or high mean full distance of 7m? can't really see a difference when changing

@bzeiss
Copy link

bzeiss commented May 22, 2022

My P1 motion sensors don't have a protective film. I think I have also placed them pretty well according to the instructions. What I have noticed, having tested them for a few days now, is that one single of my P1 sensors seems to overperform all the time (i.e. it triggers at a distance of maybe 4-5 meters) even on low sensitivity while the others don't. Unfortunately, I don't have the Aqara hub to test them with. I hope that someone else here is able to help with this.

@Otnow
Copy link

Otnow commented May 22, 2022

Does low or high mean full distance of 7m? can't really see a difference when changing

Theoretically yes, but apparently there is some other reason for the problem.


@bzeiss, thanks for the info. Strange problem. Let's wait for feedback from other owners.

@TheJulianJES
Copy link

Using ZHA here with a slightly modified version of this WIP quirk.
I can confirm that the detection range is only around 2 meters on Medium (2). Setting it to High (3) seems to increase the range a bit (sometimes?).

@spn91
Copy link

spn91 commented May 23, 2022

It seems that this a problem with the retail version of the P1 motion sensor. I didn't notice it, because I have only one in use and this one doesn't need to detect motion farther away than 2 meters.
This problem is already discussed in the Aqara Beta Test Channel and reported from users which are using the aqara zigbee gateway.

@backlink-market
Copy link
Author

Is it fixable via software update? Or do we need to send the sensor back to aqara?

@spn91
Copy link

spn91 commented May 23, 2022

We don't know it yet. On the retail version is a newer firmware installed, then on the beta version of the sensor. Maybe this is the reason.

@bzeiss
Copy link

bzeiss commented May 31, 2022

@spn91 Is that beta test channel you are referring to something public? As I have four of the p1 sensors, I'm really interested in a solution.

@TheJulianJES
Copy link

@bzeiss I think spn91 was talking about the pre-release firmware installed on sensors that were for testing.
Z2M has a fix for getting P1 sensors completely working that should be releasing with the next Z2M release (I think it should be tomorrow).

@spn91
Copy link

spn91 commented May 31, 2022

@bzeiss no, it isn’t. There’s is also no solution for this problem at the moment, so access to this channel wouldn’t help. It has already been escalated to aqara, but no answer from them yet.

@spn91
Copy link

spn91 commented May 31, 2022

@TheJulianJES this sounds interesting. Do you know how this problem has been fixed?

@TheJulianJES
Copy link

TheJulianJES commented May 31, 2022

See Koenkk/zigbee-herdsman-converters#4099 for the initial device support and Koenkk/zigbee-herdsman-converters#4299 for the high illuminance fix.

Basically, the sensor only sends high illuminance values when in complete darkness. Z2M just parses those high values as illuminance=0 for now.

@bzeiss
Copy link

bzeiss commented May 31, 2022

@TheJulianJES This is very cool, looking very forward to test this.

@spn91
Copy link

spn91 commented May 31, 2022

Hmm I think I can’t follow you. The device was already supported for a longer time now and the other fix is for the problem with illumination and not the detection range 🤔

@TheJulianJES
Copy link

@spn91 Sorry, the problem I was talking about was with the high illuminance and not the detection range. That will probably really need a firmware upgrade (if it's not a hardware issue)

@backlink-market
Copy link
Author

@spn91 Sorry, the problem I was talking about was with the high illuminance and not the detection range. That will probably really need a firmware upgrade (if it's not a hardware issue)

Is there anything new regarding the detection range problem?

@bzeiss
Copy link

bzeiss commented Jul 10, 2022

So I have fetched an Aqara Hub E1 (which seems to be the cheapest Aqara hub) to check whether there is a firmware update that fixes things. There is indeed an update available:

current version: 0.0.0_0005
Latest version: version 0.0.0_00006

"Optimize illumination reporting".

I'm updating two of my sensors now and repair them with Zigbee2MQTT to find out whether the reporting has improved.

By the way: in case anyone wants to try this too, it has taken quite a while for me to get to this point.

  1. Pairing the Aqara Hub E1 with Aqara home: being in Europe I could safely ignore most comments on the Internet that suggested switching modes from Xiaomi Home to Aqara home, resetting everything by pressing the button 10 times etc. Two things were most relevant to me: switching to a 2.4ghz wifi network and actually understanding how the Aqara Home App on Android works. The screen where I was expecting the pairing to happen wasn't even the pairing screen, but a screen before that. A very tiny checkbox (that I didn't identify as something that had to be checked) had to be checked in order to proceed to the actual pairing screen.

  2. I thought one firmware update for the hub was enough and after that started the pairing process with the P1. This pairing process failed all the time. It tuned out I had to do like 4 or 5 firmware updates to the Aqara Hub E1 before I had the latest version which could actually pair the motion sensor P1.

I'll report back to this thread as soon as I have a result with the new firmware version. The firmware update of the sensors seems to take a long time.

@spn91
Copy link

spn91 commented Jul 10, 2022

I don’t think that a firmware update which fixes this problem is already available. I just got the info this week (after a long time), from an aqara representative, that they began to work on it.

But your work was not for nothing, because may you can provide us with the firmware if it is available in the near future ;)

@bzeiss
Copy link

bzeiss commented Jul 10, 2022

Sure, I'll definately help in grabbing the file if someone gives me pointers how to do that (Wireshark?).

@Otnow
Copy link

Otnow commented Jul 10, 2022

Created a PR to add OTA firmware.

Sure, I'll definately help in grabbing the file if someone gives me pointers how to do that (Wireshark?).

The OTA firmware file can be obtained in the following way: https://www.zigbee2mqtt.io/advanced/more/tuya_xiaomi_ota_url.html

@Otnow
Copy link

Otnow commented Jul 11, 2022

Created a PR to add OTA firmware.

The PR has been merged, so now it is possible to update the sensor firmware using z2m.

Judging by the update log (Optimize illumination reporting), it seems to me that this firmware (0.0.0_0006) should fix the problem of reporting high illuminance values in the dark (#12596).

@backlink-market
Copy link
Author

Is there anything new regarding the detection range problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new device support New device support request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants