-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[New device support]: Aqara P1 Motion Sensor (MS-S02) #11990
Comments
You can order it here: https://www.gronahus.se/sv/varumarken/aqara/aqara-motion-sensor-p1.html |
🙂 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 |
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. |
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? |
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. |
Unfortunatly this code is not working. There is a TypeError: TypeError: Cannot read property 'options' of undefined EDIT: 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:
The occupany, link quality,illuminance_raw and available fields are working the other things are (null) see here: |
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:
Accordingly, it will be necessary to re-pair the sensor. |
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:
|
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. |
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. |
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. |
logs are quite big for pasting so I uploaded the log files: 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. |
The file.io service reports:
There is no need to use a third party service as files can be attached here. |
Pairing log: pairing_log.txt |
It's strange that your occupancy is 60 seconds, although during pairing, the sensor reports that 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"
I did not find any entry in log about pressing button on sensor after trying to change Try to write a log with 2-3 attempts to change |
okay, here we go: changed the motion_sensitivity several times and pushed the button several times: |
These logs show that sensor accepts changed However, I did not see in logs "end of motion detection" event (
Try to write a log that will contain following actions:
|
Ok, this is a exact instructions 👍 |
Very good. Judging by log, sensor accepts settings and follows them, but for some reason converter timeout does not correspond to 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. I also noticed in log that you have a |
When I change the detection_interval in the RTCGQ13LM settings it shows the timeout error: When I try to wake up the sensor via button on the back it does not work. So the value is not set. |
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
Also strange. Unable to set @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 |
The way it works in iobroker:
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. |
@asgothian, ok, thanks. |
I am using Zigbee Adapter v1.6.16. Maybe @asgothian can help |
@Otnow I just checked the folder node_modules\zigbee-herdsman-converters and found the file package.json: 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? |
@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! |
@Otnow I have followed your instructions for the debug log. I hope this helps. The sensor address is 0x54ef44100049756c. 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. |
@bzeiss same kind of oddness I found at times https://youtu.be/qWVbsZCj6CY |
@bzeiss, great, and thank you for the log, this is what I needed 👍 Created a PR to add support for the
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. |
@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). |
I can confirm. Most P1 sensor does only have a detection distance of 2m or below.....don't know why |
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: 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): And this is the detection area for RTCGQ14LM from the user manual: 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? |
Does low or high mean full distance of 7m? can't really see a difference when changing |
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. |
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. |
Using ZHA here with a slightly modified version of this WIP quirk. |
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. |
Is it fixable via software update? Or do we need to send the sensor back to aqara? |
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. |
@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. |
@bzeiss I think spn91 was talking about the pre-release firmware installed on sensors that were for testing. |
@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. |
@TheJulianJES this sounds interesting. Do you know how this problem has been fixed? |
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. |
@TheJulianJES This is very cool, looking very forward to test this. |
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 🤔 |
@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? |
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 "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.
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. |
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 ;) |
Sure, I'll definately help in grabbing the file if someone gives me pointers how to do that (Wireshark?). |
Created a PR to add OTA firmware.
The OTA firmware file can be obtained in the following way: https://www.zigbee2mqtt.io/advanced/more/tuya_xiaomi_ota_url.html |
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). |
Is there anything new regarding the detection range problem? |
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.
The text was updated successfully, but these errors were encountered: