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

RTCGQ11LM Aqara Motion Sensor no_occupancy_since message malformed #18083

Closed
mateuszkozakiewicz opened this issue Jun 21, 2023 · 10 comments
Closed
Labels
problem Something isn't working stale Stale issues

Comments

@mateuszkozakiewicz
Copy link

mateuszkozakiewicz commented Jun 21, 2023

What happened?

When no_occupancy_since is set a malformed message arrives after a specified time period, example:
Received MQTT message on 'zigbee2mqtt/bridge/request/device/options' with data '{"id":"0x00158d0007758324","options":{"no_occupancy_since":[{"undefined":30}]},"transaction":"fjz2v-14"}'
Such message is ignored by HASS and the attribute no_occupancy_since is not added to the device.

What did you expect to happen?

Correct format should be per the field description:

no_occupancy_since
Sends a message the last time occupancy (occupancy: true) was detected. 
When setting this for example to [10, 60] a `{"no_occupancy_since": 10}` will be send after 10 seconds 
and a `{"no_occupancy_since": 60}` after 60 seconds.

So my understanding is I should've received:
Received MQTT message on 'zigbee2mqtt/bridge/request/device/options' with data '{"id":"0x00158d0007758324","options":{"no_occupancy_since":30},"transaction":"fjz2v-14"}'
instead.

How to reproduce it (minimal and precise)

Configure no_occupancy_since for Aqara Motion Sensor device.

Zigbee2MQTT version

1.31.2

Adapter firmware version

6.7.10.0 build 423

Adapter

Xiaomi Gateway 3

Debug log

This is the message Z2M sends when changing no_occupancy_since via web UI:
Received MQTT message on 'zigbee2mqtt/bridge/request/device/options' with data '{"id":"0x00158d0007758324","options":{"no_occupancy_since":[{"undefined":30}]},"transaction":"3zkk4-2"}'
This is the correct message:
pub -t 'zigbee2mqtt/bridge/request/device/options' -m '{"id":"0xa4c138741b588475","options":{"no_occupancy_since":[30]},"transaction":"fjz2v-20"}'
When I publish manually everything works as expected.

@mateuszkozakiewicz mateuszkozakiewicz added the problem Something isn't working label Jun 21, 2023
@mateuszkozakiewicz
Copy link
Author

Correction: it still works kinda odd, observe the following log:
(occupancy_timeout: 60 no_occupancy_since: 30)

Zigbee2MQTT:info  2023-06-22 09:42:05: MQTT publish: topic 'zigbee2mqtt/Motion Sensor', payload '{"battery":100,"device_temperature":32,"illuminance":26,"illuminance_lux":26,"linkquality":76,"occupancy":true,"power_outage_count":10,"voltage":3045}'
Zigbee2MQTT:info  2023-06-22 09:42:35: MQTT publish: topic 'zigbee2mqtt/Motion Sensor', payload '{"battery":100,"device_temperature":32,"illuminance":26,"illuminance_lux":26,"linkquality":76,"no_occupancy_since":30,"occupancy":true,"power_outage_count":10,"voltage":3045}'
Zigbee2MQTT:info  2023-06-22 09:43:35: MQTT publish: topic 'zigbee2mqtt/Motion Sensor', payload '{"battery":100,"device_temperature":32,"illuminance":26,"illuminance_lux":26,"linkquality":76,"occupancy":false,"power_outage_count":10,"voltage":3045}'

So currently the process is to start counting the no_occupancy_since on the rising edge of occupancy, so I receive no_occupancy_since WHILE occupancy is still true which makes very little sense and contradicts the original issue:
#1195 (comment)

When motion true, reset to 0 as long as movement is detected:

{"no_occupancy_since": 0}

Which makes much more sense.
Is current behavior expected or is it a bug?

@mateuszkozakiewicz
Copy link
Author

The attribute is also not showing in HASS but I am unsure where is the problem here.

@paifre
Copy link

paifre commented Jun 24, 2023

Similar behavior reported in #17957

@ybizeul
Copy link

ybizeul commented Jul 10, 2023

There seem to be an issue with how z2m UI writes the configuration, which it does as follow in the current version exposing this bug :

    no_occupancy_since:
      - undefined: 30
      - undefined: 60
      - undefined: 90

Instead of :

    no_occupancy_since:
      - 30
      - 60
      - 90

or :

    no_occupancy_since: [30, 60, 90]

Fixing the config file seems to fix the issue at least for me.

@merlinpimpim
Copy link

The bug is still there for this module : https://www.zigbee2mqtt.io/devices/RTCGQ01LM.html#xiaomi-rtcgq01lm
(But, as mentioned above, a manual fix in the configuration file provides a workaround).
A real bug fix soon?

@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2023

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

@github-actions github-actions bot added the stale Stale issues label Sep 6, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 13, 2023
@mpuff
Copy link

mpuff commented Oct 21, 2023

i have the same problem now, also on the motion sensor, the gui is writing it wrong into the configuration file

@stuffofmine
Copy link

Same for me, the config is saved as per below when setting the values through z2m gui.

...
no_occupancy_since:
  - undefined: 300
  - undefined: 600
...

Editing/cleaning the config manually is required.

@werty1st
Copy link

werty1st commented Dec 1, 2023

Will this not be fixed? Has somebody identified the wrong code?

@fcassata
Copy link

Would love to have this resolved :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working stale Stale issues
Projects
None yet
Development

No branches or pull requests

8 participants