Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
11.54k stars 1.63k forks source link

Motion sensors state behavior (RTCGQ11LM) #270

Closed ASchneiderBR closed 5 years ago

ASchneiderBR commented 5 years ago

Hello everyone.

I was wondering if this behavior is normal or there is something that can be done.

I've noticed that after migrating to this platform from the Xiaomi gateways, the motion sensor cannot maintain the ON state if there is still movement on the room. It only shows the 60 seconds trigger then stays off for a few seconds that does not detects anything and then sends another ON state to HA when motion is detected.

Here is a comparison of the same motion sensors, one with this solution and the other still with connected by the gateway:

image

the one on the bottom is the GW connected sensor, both are the RTCGQ11LM model.

Is this the default behavior? This impacts on my logs, history, recorder (db size) and also CPU, since I have automations that triggers by the ON state of these sensors.

Thanks a lot!

Koenkk commented 5 years ago

I've seen some RTCGQ11LM which do not report any occupancy anymore for +- 1/2 min after occupancy has been detected. Could you post your log so we could verify this? It is important to constantly trigger the motion sensor during that period.

ASchneiderBR commented 5 years ago

Will do @Koenkk! Thanks for you reply. I am pretty sure that the sensor goes "numb" for 30 seconds after triggering. Nothing is sent to HA.

mark078 commented 5 years ago

Hello, I have the same problems with the Xiaomi Motion with Lux Sensor.

If I paire the sensor it only works for 1-2 minutes, then only sporadically and at some point not at all. I have created a log of this:

log2.txt the different times in the log are probably caused by this #DEBUG=zigbee-shepherd* npm start &>> log2.txt

16:33:27 push button 16:33:27 push button 16:48:49 Battery removed

I was in front of the sensor all the time, making hand movements.

The other motion sensor without Lux Sensor works perfectly, for several weeks.

I tested this on a clean fresh zigbee2mqtt environment, with only one sensor. As coordinator I have a CC2530 with external antenna. The range to the sensor is about 3 meters with an open door in between.

I have this problem at two different locations, with different hardware.

Koenkk commented 5 years ago

@mark078 this sound like battery issues, have you already tried replacing?

mark078 commented 5 years ago

@Koenkk no, I haven't changed the battery yet, I'll do that later. But measured with a multimeter, it has 3.01 volts and is from Panasonic.

I have two of these sensors that cause these problems, by the way. I ordered one from Gearbest in April and the other from Joybuy in June.

mark078 commented 5 years ago

@Koenkk I took out the battery and connected a 3.3 Volt Arduino and measured the voltage, it was 3.3 Volt. Unfortunately, nothing has changed in this behaviour. :(

log6.txt

I was the whole time before and waved at him, but he gets out regularly and then reports no more motion. :-(

Don't you have such problems?

Koenkk commented 5 years ago

It seems that your sensors doens't report the occupancy that often (I've seen that more).

Can you try setting the occupancy_timeout to 300?

mark078 commented 5 years ago

I entered it with occupancy_timeout: 300, it looked good at first, but not any more below. There was no reaction for over 8 minutes, although there was movement.

I'll connect it tomorrow with the original Xiaomi bridge. Maybe it'll give him a firmware update.

2018-08-14T19:55:22.273Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":119}}
2018-08-14T19:55:22.303Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":119}'
2018-08-14T19:55:22.331Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":119}}
2018-08-14T19:59:13.591Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"modelId":"lumi.sensor_motion.aq2"}}
2018-08-14T19:59:21.213Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":61}}
2018-08-14T19:59:21.238Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":61}'
2018-08-14T19:59:21.263Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":61}}

battery removed

2018-08-14T19:59:41.619Z - debug: Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-08-14T19:59:41.641Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":61,"occupancy":true}'
2018-08-14T19:59:41.665Z - debug: Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-08-14T19:59:53.279Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":111}}
2018-08-14T19:59:53.302Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":111,"occupancy":true}'
2018-08-14T19:59:53.345Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":111}}
2018-08-14T20:00:11.100Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":118}}
2018-08-14T20:00:11.117Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":118,"occupancy":true}'
2018-08-14T20:00:11.136Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":118}}
2018-08-14T20:00:13.140Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":105}}
2018-08-14T20:00:13.168Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":105,"occupancy":true}'
2018-08-14T20:00:13.197Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":105}}
2018-08-14T20:00:26.059Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":151}}
2018-08-14T20:00:26.076Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":151,"occupancy":true}'
2018-08-14T20:00:26.096Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":151}}
2018-08-14T20:00:28.088Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":124}}
2018-08-14T20:00:28.106Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":124,"occupancy":true}'
2018-08-14T20:00:28.125Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":124}}
2018-08-14T20:00:28.447Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":155}}
2018-08-14T20:00:28.463Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":155,"occupancy":true}'
2018-08-14T20:00:28.482Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":155}}
2018-08-14T20:00:28.803Z - debug: Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-08-14T20:00:28.848Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":155,"occupancy":true}'
2018-08-14T20:00:46.731Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":109}}
2018-08-14T20:00:46.748Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":109,"occupancy":true}'
2018-08-14T20:00:46.766Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":109}}
2018-08-14T20:00:48.758Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T20:00:48.773Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":true}'
2018-08-14T20:00:48.790Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T20:00:50.845Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":154}}
2018-08-14T20:00:50.873Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":154,"occupancy":true}'
2018-08-14T20:00:50.898Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":154}}
2018-08-14T20:00:52.821Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":119}}
2018-08-14T20:00:52.838Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":119,"occupancy":true}'
2018-08-14T20:00:52.857Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":119}}
2018-08-14T20:00:54.956Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T20:00:54.973Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":true}'
2018-08-14T20:00:54.992Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T20:01:42.274Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":112}}
2018-08-14T20:01:42.289Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":112,"occupancy":true}'
2018-08-14T20:01:42.306Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":112}}
2018-08-14T20:01:55.169Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":155}}
2018-08-14T20:01:55.185Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":155,"occupancy":true}'
2018-08-14T20:01:55.204Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":155}}
2018-08-14T20:01:57.219Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T20:01:57.234Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":true}'
2018-08-14T20:01:57.254Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T20:02:09.937Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":149}}
2018-08-14T20:02:09.954Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":149,"occupancy":true}'
2018-08-14T20:02:09.972Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":149}}
2018-08-14T20:02:28.596Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":154}}
2018-08-14T20:02:28.613Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":154,"occupancy":true}'
2018-08-14T20:02:28.631Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":154}}
2018-08-14T20:02:30.621Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":127}}
2018-08-14T20:02:30.636Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":127,"occupancy":true}'
2018-08-14T20:02:30.654Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":127}}
2018-08-14T20:02:43.629Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":123}}
2018-08-14T20:02:43.645Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":123,"occupancy":true}'
2018-08-14T20:02:43.678Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":123}}
2018-08-14T20:02:56.255Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":105}}
2018-08-14T20:02:56.271Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":105,"occupancy":true}'
2018-08-14T20:02:56.290Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":105}}
2018-08-14T20:02:58.283Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":118}}
2018-08-14T20:02:58.299Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":118,"occupancy":true}'
2018-08-14T20:02:58.318Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":118}}
2018-08-14T20:03:00.315Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":153}}
2018-08-14T20:03:00.331Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":153,"occupancy":true}'
2018-08-14T20:03:00.350Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":153}}
2018-08-14T20:03:29.980Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":115}}
2018-08-14T20:03:30.021Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":115,"occupancy":true}'
2018-08-14T20:03:30.039Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":115}}
2018-08-14T20:03:52.850Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":112}}
2018-08-14T20:03:52.867Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":112,"occupancy":true}'
2018-08-14T20:03:52.886Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":112}}
2018-08-14T20:04:16.567Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":126}}
2018-08-14T20:04:16.583Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":126,"occupancy":true}'
2018-08-14T20:04:16.600Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":126}}
2018-08-14T20:04:16.725Z - debug: Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-08-14T20:04:16.744Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":126,"occupancy":true}'
2018-08-14T20:04:28.412Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":104}}
2018-08-14T20:04:28.427Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":104,"occupancy":true}'
2018-08-14T20:04:28.463Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":104}}
2018-08-14T20:04:30.440Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":140}}
2018-08-14T20:04:30.454Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":140,"occupancy":true}'
2018-08-14T20:04:30.473Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":140}}
2018-08-14T20:04:32.473Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":153}}
2018-08-14T20:04:32.489Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":153,"occupancy":true}'
2018-08-14T20:04:32.508Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":153}}
2018-08-14T20:04:34.501Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":130}}
2018-08-14T20:04:34.519Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":130,"occupancy":true}'
2018-08-14T20:04:34.537Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":130}}
2018-08-14T20:04:48.091Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":82}}
2018-08-14T20:04:48.110Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":82,"occupancy":true}'
2018-08-14T20:04:48.129Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":82}}
2018-08-14T20:04:50.121Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":102}}
2018-08-14T20:04:50.138Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":102,"occupancy":true}'
2018-08-14T20:04:50.157Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":102}}
2018-08-14T20:04:52.149Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":98}}
2018-08-14T20:04:52.183Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":98,"occupancy":true}'
2018-08-14T20:04:52.205Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":98}}
2018-08-14T20:04:54.178Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":74}}

sensor turned away

2018-08-14T20:04:54.194Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":74,"occupancy":true}'
2018-08-14T20:04:54.212Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":74}}
2018-08-14T20:09:16.755Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":74,"occupancy":false}'

sensor turned to me again and no motion since ~8 minutes

2018-08-14T20:17:27.648Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":108}}
2018-08-14T20:17:27.679Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":108,"occupancy":false}'
2018-08-14T20:17:27.711Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":108}}
2018-08-14T20:17:27.889Z - debug: Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-08-14T20:17:27.913Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":108,"occupancy":true}'
....
2018-08-14T20:25:46.376Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":139,"occupancy":true}'
2018-08-14T20:30:46.385Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":139,"occupancy":false}'

no reaction

2018-08-14T20:41:33.991Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":108}}
2018-08-14T20:41:34.015Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":108,"occupancy":false}'
2018-08-14T20:41:34.047Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":108}}
2018-08-14T20:41:34.203Z - debug: Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-08-14T20:41:34.219Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":108,"occupancy":true}'

cat configuration.yaml

homeassistant: false
permit_join: true
mqtt:
  base_topic: zigbee2mqtt
  server: 'mqtt://localhost'
serial:
  port: /dev/serial/by-id/usb-STM32_MapleCUL_6574bcc5-if02
advanced:
  baudrate: 115200
  rtscts: false
  log_level: debug
devices:
  '0x00158d0002006aa6':
    friendly_name: '0x00158d0002006aa6'
    retain: false
    occupancy_timeout: 300

cat database.db

{"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0002006aa6","nwkAddr":63121,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.sensor_motion.aq2","epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":263,"inClusterList":[0,1,3,1024,1030,1280,65535],"outClusterList":[0,25],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genPowerCfg":{"dir":{"value":1},"attrs":{}},"genIdentify":{"dir":{"value":1},"attrs":{}},"genOta":{"dir":{"value":2},"attrs":{}},"msIlluminanceMeasurement":{"dir":{"value":1},"attrs":{}},"msOccupancySensing":{"dir":{"value":1},"attrs":{}},"ssIasZone":{"dir":{"value":1},"attrs":{}},"manuSpecificCluster":{"dir":{"value":1},"attrs":{}}}}},"_id":"CBpQEdXZluddV4S1"}
{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0018349128","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6,8],"status":"online","joinTime":1534271660,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"G4m1TMhSJZyqMsOS"}
{"$$indexCreated":{"fieldName":"id","unique":true,"sparse":false}}
{"id":1,"type":"Coordinator","ieeeAddr":"0x00124b0018349128","nwkAddr":0,"manufId":0,"epList":[1,2,3,4,5,6,8],"status":"online","joinTime":1534276343,"endpoints":{"1":{"profId":260,"epId":1,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"2":{"profId":257,"epId":2,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"3":{"profId":261,"epId":3,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"4":{"profId":263,"epId":4,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"5":{"profId":264,"epId":5,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}},"6":{"profId":265,"epId":6,"devId":5,"inClusterList":[],"outClusterList":[],"clusters":{}}},"_id":"G4m1TMhSJZyqMsOS"}
{"id":2,"type":"EndDevice","ieeeAddr":"0x00158d0002006aa6","nwkAddr":63121,"manufId":4151,"manufName":"LUMI","powerSource":"Battery","modelId":"lumi.sensor_motion.aq2","epList":[1],"status":"offline","joinTime":null,"endpoints":{"1":{"profId":260,"epId":1,"devId":263,"inClusterList":[0,1,3,1024,1030,1280,65535],"outClusterList":[0,25],"clusters":{"genBasic":{"dir":{"value":3},"attrs":{}},"genPowerCfg":{"dir":{"value":1},"attrs":{}},"genIdentify":{"dir":{"value":1},"attrs":{}},"genOta":{"dir":{"value":2},"attrs":{}},"msIlluminanceMeasurement":{"dir":{"value":1},"attrs":{}},"msOccupancySensing":{"dir":{"value":1},"attrs":{}},"ssIasZone":{"dir":{"value":1},"attrs":{}},"manuSpecificCluster":{"dir":{"value":1},"attrs":{}}}}},"_id":"CBpQEdXZluddV4S1"}
Koenkk commented 5 years ago

@mark078 I've never thought of this, but these difference could indeed be explained due to different firmware versions! I'm curious if a firmware update solves this problem.

mark078 commented 5 years ago

@Koenkk I'm curious too. Because the two sensors with Lux (RTCGQ11LM) I had never paired with the original bridge before. I only paired the Motion without Lux Sensor (RTCGQ01LM) on the org. xiaomi bridge and it works fine with zigbee2mqtt.

I'll report tomorrow...

Here's something weird from tonight in the log ([0,8],null,null,null,null,0,0,null). Since then, there's been no more motion detection.

2018-08-14T21:01:11.961Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T21:01:11.979Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":true}'
2018-08-14T21:01:12.008Z - debug: Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":122}}
2018-08-14T21:03:56.633Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false}'
2018-08-14T22:01:21.332Z - warn: Soft resetted zigbee
2018-08-14T22:01:21.373Z - info: zigbee-shepherd ready
2018-08-14T23:01:29.876Z - warn: Soft resetted zigbee
2018-08-14T23:01:30.127Z - info: zigbee-shepherd ready
2018-08-14T23:31:31.597Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,8],"10":0,"11":0,"100":0}}}
2018-08-14T23:31:31.622Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-14T23:31:31.648Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,31,5032,33,[0,8],null,null,null,0,0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-08-15T00:24:15.705Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,5],"10":0,"11":0,"100":0}}}
2018-08-15T00:24:15.719Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T00:24:15.740Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,null,null,null,[null,5]]}}
2018-08-15T01:17:51.900Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,2],"10":0,"11":0,"100":0}}}
2018-08-15T01:17:51.917Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T01:17:51.941Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,31,5032,33,[0,2],null,null,null,0,0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-08-15T02:12:19.123Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":32,"4":5032,"5":33,"6":[0,3],"10":0,"11":0,"100":0}}}
2018-08-15T02:12:19.137Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T02:12:19.158Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,32,null,null,[null,3]]}}
2018-08-15T03:06:45.573Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,3],"10":0,"11":0,"100":0}}}
2018-08-15T03:06:45.588Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T03:06:45.612Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,31,5032,33,[0],null,null,null,0,0,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-08-15T04:01:16.422Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":30,"4":5032,"5":33,"6":[0,2],"10":0,"11":3,"100":0}}}
2018-08-15T04:01:16.446Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T04:01:16.468Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,30,null,null,[null,2],null,null,null,null,3]}}
2018-08-15T04:53:53.068Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,2],"10":0,"11":7,"100":0}}}
2018-08-15T04:53:53.083Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T04:53:53.107Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,31,5032,33,[0],null,null,null,0,7,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-08-15T05:46:36.664Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":30,"4":5032,"5":33,"6":[0,3],"10":0,"11":20,"100":0}}}
2018-08-15T05:46:36.679Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T05:46:36.711Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,30,null,null,[null,3],null,null,null,null,20]}}
2018-08-15T06:41:26.971Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,2],"10":0,"11":11,"100":0}}}
2018-08-15T06:41:26.988Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T06:41:27.011Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,31,5032,33,[0,2],null,null,null,0,11,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-08-15T07:36:27.525Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,1],"10":0,"11":13,"100":0}}}
2018-08-15T07:36:27.539Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T07:36:27.562Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,null,null,null,[null,1],null,null,null,null,13]}}
2018-08-15T08:30:08.719Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":31,"4":5032,"5":33,"6":[0,26],"10":0,"11":26,"100":0}}}
2018-08-15T08:30:08.733Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T08:30:08.754Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,31,5032,33,[0,26],null,null,null,0,26,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-08-15T09:24:46.032Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":32,"4":5032,"5":33,"6":[0,41],"10":0,"11":34,"100":0}}}
2018-08-15T09:24:46.047Z - info: MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":122,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-08-15T09:24:46.070Z - debug: Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,32,null,null,[null,41],null,null,null,null,34]}}
Koenkk commented 5 years ago

@mark078 this is some random data from Xiaomi sensors (pretty normal).

mark078 commented 5 years ago

@Koenkk Okay and the soft restart is normal, too? Because the sensor stopped responding to movement at all afterwards. :(

Small update.. I paired both motion with Lux sensors to the Xiaomi Bridge and both have been running without problems for about 3 hours. Motion detection works every 5 seconds without any failures. I leave them connected overnight and take them back with me tomorrow and connect them to the CC2530.

photo5449444631491225996 photo5449444631491225997

Koenkk commented 5 years ago

I didn't notice the soft restart, but this could also cause problems (like in #274).

Could you try changing: https://github.com/Koenkk/zigbee2mqtt/blob/master/lib/controller.js#L14 to const softResetTimeout = 9999999 * 1000; // seconds * 1000..

This should disable the soft restart.

mark078 commented 5 years ago

@Koenkk I'll try tomorrow. If you want me to test anything to fix the error, let me know. :) I would rather use zigbee2mqtt than the xiaomi cloud solution.

The rest like xiaomi switches, motion without lux sensor and cube works very well!

Koenkk commented 5 years ago

@mark078 ok great, let me know the result. Was there any firmware update available for the motion sensors?

mark078 commented 5 years ago

Hey @Koenkk , not good news. I didn't see an update in the Mi Home app, there was only one for the Yeelight bulb. I had paired the motion sensor at Xiaomi bridge for about 16 hours.

I paired the motion sensor to zigbee2mqtt again. Unfortunately, the behaviour has not changed. :-(

It detects motion for a few minutes, then at some point it only transmits light values and then it no longer reacts at all for a long time. I also paired the cube and it continues to respond. There's only problem with the motion sensor with Lux.

I adjusted the controller.js (with a 9 less) and tried to set the channel to 14, but that didn't help.

My firmware for CC2530 is from ptvo: http://ptvo.info/cc2530-based-zigbee-coordinator-and-router-112/ Because the FW from here (CC2530ZNP-Pro-Secure_LinkKeyJoin.hex) doesn't start zigbee2mqtt: zigbee-shepherd:init Coordinator initialize had an error: Error: request timeout P20 is connected to GND.

Koenkk commented 5 years ago

@mark078 could you try this firmware: https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/CC2530/bin

mark078 commented 5 years ago

@Koenkk this firmware doesn't work, I tried it on two different CC2530s: https://de.aliexpress.com/item/CC2530-Zigbee-Module-UART-Wireless-Core-Board-Development-Board-CC2530F256-Serial-Port-Wireless-Module-2-4GHz/32767470382.html

I have flashed this several times...

Pics: https://www.dropbox.com/sh/ud0mx1igu9df0r5/AACqJfgwPYGdGam42xi5iCqSa?dl=0

Zigbee2mqtt start with CC2530ZNP-Prod.hex FW:

> zigbee2mqtt@0.1.2 start /opt/zigbee2mqtt
> node index.js

2018-8-16 19:50:53 DEBUG Using zigbee-shepherd with settings: '{"net":{"panId":6754,"channelList":[14]},"dbPath":"/opt/zigbee2mqtt/data/database.db","sp":{"baudrate":115200,"rtscts":false}}'
2018-8-16 19:50:54 INFO Starting zigbee2mqtt version 0.1.2 (commit #7dd1c75)
2018-8-16 19:50:54 INFO Starting zigbee-shepherd
  zigbee-shepherd:init zigbee-shepherd booting... +0ms
  zigbee-shepherd:request REQ --> SYS:osalNvRead +198ms
  zigbee-shepherd:request RSP <-- SYS:osalNvRead +3s
  zigbee-shepherd:init Coordinator initialize had an error: Error: request timeout
    at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:254:22)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at CcZnp.emit (events.js:211:7)
    at Timeout.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:233:18)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5) +38ms
2018-8-16 19:50:58 INFO Error while starting zigbee-shepherd, attemping to fix... (takes 60 seconds)
2018-8-16 19:51:58 INFO Starting zigbee-shepherd
  zigbee-shepherd:init zigbee-shepherd booting... +1m
  zigbee-shepherd:request REQ --> SYS:osalNvRead +34ms
  zigbee-shepherd:request RSP <-- SYS:osalNvRead +3s
  zigbee-shepherd:init Coordinator initialize had an error: Error: request timeout
    at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:254:22)
    at Object.onceWrapper (events.js:315:30)
    at emitOne (events.js:116:13)
    at CcZnp.emit (events.js:211:7)
    at Timeout.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:233:18)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5) +11ms
2018-8-16 19:52:01 ERROR Error while starting zigbee-shepherd!
2018-8-16 19:52:01 ERROR Press the reset button on the stick (the one closest to the USB) and start again
2018-8-16 19:52:01 ERROR Failed to start
        {"message":"request timeout","stack":"Error: request timeout\n    at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:254:22)\n    at Object.onceWrapper (events.js:315:30)\n    at emitOne (events.js:116:13)\n    at CcZnp.emit (events.js:211:7)\n    at Timeout.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:233:18)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)"}

With the ptvo FW it works.

> zigbee2mqtt@0.1.2 start /opt/zigbee2mqtt
> node index.js

2018-8-16 19:47:44 DEBUG Using zigbee-shepherd with settings: '{"net":{"panId":6754,"channelList":[14]},"dbPath":"/opt/zigbee2mqtt/data/database.db","sp":{"baudrate":115200,"rtscts":false}}'
2018-8-16 19:47:45 INFO Starting zigbee2mqtt version 0.1.2 (commit #7dd1c75)
2018-8-16 19:47:45 INFO Starting zigbee-shepherd
  zigbee-shepherd:init zigbee-shepherd booting... +0ms
  zigbee-shepherd:request REQ --> SYS:osalNvRead +192ms
  zigbee-shepherd:request RSP <-- SYS:osalNvRead, status: 2 +387ms
  zigbee-shepherd:init Non-Volatile memory is changed. +46ms
  zigbee-shepherd Starting a hardware reset... +21ms
  zigbee-shepherd:request REQ --> SYS:resetReq +16ms
  zigbee-shepherd:msgHdlr IND <-- SYS:resetInd +899ms
  zigbee-shepherd:request RSP <-- SYS:resetReq +6ms
...
Koenkk commented 5 years ago

@kirovilya do you know what could cause the CC2530 firmware not to work?

kirovilya commented 5 years ago

@mark078 could you try this firmware: https://raw.githubusercontent.com/kirovilya/files/master/CC2530ZNP-Pro-Secure_LinkKeyJoin.hex (it is first FW that work for me) if it works, then I will try to find new build parameters...

Sometimes helps wire P05 and P04 to GND (and P20 too).

mark078 commented 5 years ago

@Koenkk I don't really have any idea why the FW doesn't work for me. I just installed it on a third platform (orange pi zero) and did the same thing there. ptvo firmware works, the others fw don't. But I still have a cc2531 usb-stick with my girlfriend, so I could try it at the weekend, if the xiaomi motion lux sensors work with it.

@kirovilya thank you, maybe it will work! I'll try and report it. :)

mark078 commented 5 years ago

@kirovilya sadly that didn't work. I flashed your FW first, then tried one by one: P04 + P20 connected to GND > did not work P05 + P20 connected to GND > did not work P04 + P05 + P20 connected to GND > did not work

The same again with the FW from Koenkk but there also receives the error "request timeout" from the coordinator. :-(

Then the firmware of ptvo flashed again and it runs, crazy. Only there is the possible problem with the motion sensors...

Do you have the same CC2530 as me? 2x Double header with 6 pins from ChdTech? And which Zigbee2mqtt version? I have the latest: Starting zigbee2mqtt version 0.1.2 (commit #7dd1c75)

Then one more question, do you have the Xiaomi Motion Lux sensors and do they work on you?

kirovilya commented 5 years ago

@mark078 I think so yes. It is my chip https://www.aliexpress.com/item/CC2530-Zigbee-UART-Wireless-Core-Board-Development-Board-CC2530F256-Serial-Port-Wireless-Module-24MHz/32767470382.html My RTCGQ11LM work fine.

In last chance try set rtscts: false in config.

I tried all the devices from here https://github.com/Koenkk/zigbee2mqtt/issues/52#issuecomment-390380532

mark078 commented 5 years ago

Mhhh that's strange, that the firmware works for you and not for me.

I had "rtscts: false" mainly in the config. But in the meantime I took it out, without success.

I will test the cc2531 with the xiaomi motion sensor on the weekend. and flashing the cc2530 with linux, instead of windows.

Next week I can try the arduino flashing method. I had already flashed my first cc2530 board with arduino and the custom firmware and it was running. I can test this with the current FW and this: https://github.com/Koenkk/zigbee2mqtt/issues/190#issuecomment-404192164

Koenkk commented 5 years ago

Interested in the result with the CC2531! @mark078

mark078 commented 5 years ago

@Koenkk it seems to work with the CC2531 Stick. I have this running for about an hour and the sensor (Xiaomi motion with lux) reacts constantly and much more often without interruption. I'm gonna let this go for a while.

But I don't know which firmware is on it anymore.

What would be interesting, if ptvo has this Xiaomi motion with lux sensor with its firmware in operation?

And why the CC2530 doesn't work for me. It's the same problem as here: https://github.com/Koenkk/zigbee2mqtt/issues/231

Koenkk commented 5 years ago

@mark078 ok great that it works with the CC2531, at least we know the sensor is not the problem!

@ptvoinfo could you provide some help here?

mark078 commented 5 years ago

@Koenkk Yeah, I'm a little happy now, after a few days of fumbling around. :)

The motion sensor still works, actually as good as with the Xiaomi Bridge.

I will flash a newest firmware on the CC2531 stick tomorrow. If it doesn't work anymore, could be the debugger responsible for the problems.

Because the stick has flashed to me someone else where I had no debugger yet.

mark078 commented 5 years ago

I have reflashed the CC2531 Stick with this firmware: https://github.com/Koenkk/Z-Stack-firmware/tree/master/coordinator/CC2531/bin The Xiaomi motion sensors also worked with it.

So the debugger must be okay.

After that I flashed the CC2530 with Linux and CC2530 Firmware, but the problem is still that zigbee2mqtt does not start.

2018-8-18 13:05:01 DEBUG Using zigbee-shepherd with settings: '{"net":{"panId":6754,"channelList":[11]},"dbPath":"/opt/zigbee2mqtt/data/database.db","sp":{"baudrate":115200,"rtscts":false}}'
2018-8-18 13:05:01 INFO Starting zigbee2mqtt version 0.1.2 (commit #7dd1c75)
2018-8-18 13:05:01 INFO Starting zigbee-shepherd
2018-8-18 13:05:04 INFO Error while starting zigbee-shepherd, attemping to fix... (takes 60 seconds)
2018-8-18 13:06:04 INFO Starting zigbee-shepherd
2018-8-18 13:06:07 ERROR Error while starting zigbee-shepherd!
2018-8-18 13:06:07 ERROR Press the reset button on the stick (the one closest to the USB) and start again
2018-8-18 13:06:07 ERROR Failed to start
        {"message":"request timeout","stack":"Error: request timeout\n    at CcZnp.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:254:22)\n    at Object.onceWrapper (events.js:315:30)\n    at emitOne (events.js:116:13)\n    at CcZnp.emit (events.js:211:7)\n    at Timeout.<anonymous> (/opt/zigbee2mqtt/node_modules/cc-znp/lib/ccznp.js:233:18)\n    at ontimeout (timers.js:498:11)\n    at tryOnTimeout (timers.js:323:5)\n    at Timer.listOnTimeout (timers.js:290:5)"}

I will flash the CC2530 next week with an Arduino.

mark078 commented 5 years ago

I noticed something at firmware von @dzungpv

Freshly after pairing, the Xiaomi Motion with Lux Sensor has reported every 6 seconds when it has detected a motion. So in a row...

After several hours, it only transmits a motion detection every minute.

If I briefly press the pairing button on the motion sensor, it responds again recognizes motion every 6 seconds. That's not normal?

< push paring button >

2018-8-22 13:08:59 DEBUG Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":33,"4":12712,"5":65,"6":[0,18],"10":0,"11":16,"100":0},"modelId":"lumi.sensor_motion.aq2"}}
2018-8-22 13:08:59 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":10,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:08:59 DEBUG Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,3005,null,null,12712,null,[null,18],null,null,null,null,16],"modelId":"lumi.sensor_motion.aq2"}}
2018-8-22 13:09:09 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":11}}
2018-8-22 13:09:09 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":11,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:09 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":11}}
2018-8-22 13:09:09 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:09 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":11,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:23 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":10}}
2018-8-22 13:09:23 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":10,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:23 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":10}}
2018-8-22 13:09:23 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:23 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":10,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:28 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":12}}
2018-8-22 13:09:28 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":12,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:28 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":12}}
2018-8-22 13:09:28 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:28 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":12,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:33 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:33 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":12,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:38 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":11}}
2018-8-22 13:09:38 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":11,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:38 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":11}}
2018-8-22 13:09:38 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:38 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":11,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:43 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":10}}
2018-8-22 13:09:43 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":10,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:43 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":10}}
2018-8-22 13:09:44 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:44 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":10,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:55 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":11}}
2018-8-22 13:09:55 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":11,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 13:09:55 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":11}}
2018-8-22 13:09:56 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 13:09:56 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":11,"occupancy":true,"battery":"100.00","voltage":3005}'

There is still a problem, despite my waving in front of the sensor it sends an occupancy false after one minute and an occupancy true immediately afterwards. This would cause a lamp that was previously on, to go off briefly and then go on again immediately afterwards.

it looks as if the sensor is going to sleep for a minute. during this time it does not measure or detect any motion. after the minute it always sends a wrong occupancy false. If a movement has then taken place again, it transmits an occupancy true or occupancy 1.

2018-8-22 11:36:40 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":15}}
2018-8-22 11:36:40 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":15,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 11:36:40 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 11:36:40 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":15,"occupancy":true,"battery":"100.00","voltage":3005}'

< here >

2018-8-22 11:37:40 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":15,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 11:37:48 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":21}}
2018-8-22 11:37:48 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":21,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 11:37:48 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":21}}
2018-8-22 11:37:48 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 11:37:48 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":21,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 12:48:27 DEBUG Recieved zigbee message with data {"cid":"genBasic","data":{"65281":{"1":3005,"3":33,"4":5032,"5":65,"6":[0,65582],"10":0,"11":18,"100":0}}}
2018-8-22 12:48:27 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":21,"occupancy":true,"battery":"100.00","voltage":3005}'
2018-8-22 12:48:27 DEBUG Recieved zigbee message with data {"cid":"genBasic","data":{"65281":[null,null,null,33,5032,65,[0,65582],null,null,null,0,18,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,0]}}
2018-8-22 12:49:02 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":21,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 12:49:04 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":18}}
2018-8-22 12:49:04 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":18,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 12:49:04 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":18}}
2018-8-22 12:49:04 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 12:49:04 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":18,"occupancy":true,"battery":"100.00","voltage":3005}'

< here > 

2018-8-22 12:50:04 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":18,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 12:50:06 DEBUG Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":18}}
2018-8-22 12:50:06 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":18,"occupancy":false,"battery":"100.00","voltage":3005}'
2018-8-22 12:50:06 DEBUG Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}
2018-8-22 12:50:06 INFO MQTT publish, topic: 'zigbee2mqtt/0x00158d0002006aa6', payload: '{"illuminance":18,"occupancy":true,"battery":"100.00","voltage":3005}'

I think this is the same problem as here: https://github.com/Koenkk/zigbee2mqtt/issues/70

dzungpv commented 5 years ago

@mark078 It is normal, you can check the FAG in Mi Home app screenshot_20180822-182205_mi home

dzungpv commented 5 years ago

@mark078 You should connect it to a Mi Home gateway and check for firmware update, i have two of them and they work fine, they say it will always sleep 1 minute and work and then sleep again, when it sleep mean it not respond to any motion, you can use Automation in Hass to solve the problem

mark078 commented 5 years ago

@dzungpv ahhh ok. So after an hour, your motion sensors only respond for a minute at a time? I guess that's to save energy.

My second problem.. I try to solve then times to set the occupancy_timeout higher than 60 seconds. because it is actually not correct when a motion takes place, which it then transmits occupancy false and then immediately true. maybe occupancy_timeout solves the problem.

Because of the firmware update to the original bridge, i paired the two sensors a few days ago. But there was no firmware update. Only for the bridge and xiaomi yeelight bulb.

But the sensors run much better with your firmware now. With the other firmware from ptvo for cc2530, the sensors didn't react at all at some point.

dzungpv commented 5 years ago

@mark078 Yes, it sleep and wake up after 1 minute. have both RTCGQ11LM(2) and RTCGQ01LM(2). It all the same behavior. You can read more FAQ in Mi home app, open you sensor and fin it in the thee dot icon.

You can try to place near the gateway and test like this. 1 connect to Xiaomi gateway and 1 connect to cc2530/cc2530. Both gateway connect to Hass and you can see if it has any difference. When signal low, it could miss the data, you can try to replace the CR2032 battery.

That why i try to make cc2530 work, it have very far better signal quality compare to cc2531 usb

mark078 commented 5 years ago

@dzungpv I'd read about the 60 seconds before, but then I forgot. :D

I will reflash the other cc2530 and repair all sensors. Maybe compare this with the bridge later.

I also think the cc2530 is better, especially since you save one usb port. I have the cc2530 on a maplecun (stm32), there can connect 4x cc1101 for 433/866 mhz, you still have two free uarts and all this over one usb port, or lan/wlan: https://wiki.fhem.de/wiki/MapleCUN

temaivanoff commented 5 years ago

Hi, is there a way to change the parameters of sleep 1 minute to 5 sec? it is possible to simulate push pairing button?

Any ideas how to fix this.

alinelena commented 5 years ago

I am having similar issue. xiaomi sensor without illumination works, with illumination it does not. this is with yesterday's code base. in debug i get

Sep 09 08:35:29  npm[5482]:   zigbee2mqtt:debug 9/9/2018, 8:35:29 AM Recieved zigbee message with data {"cid":"msIlluminanceMeasurement","data":{"measuredValue":22}}
Sep 09 08:35:29  npm[5482]:   zigbee2mqtt:debug 9/9/2018, 8:35:29 AM Recieved zigbee message with data {"cid":"msOccupancySensing","data":{"occupancy":1}}

but i do not seem to get any topic post.

Koenkk commented 5 years ago

@alinelena can you post your complete log?

ASchneiderBR commented 5 years ago

Hello everyone! Not sure how but it seems that this issue is fixed with the latest update:

image

No more 1 minute on\off states on history.

I will monitor it for the next few days.

Thanks!

Koenkk commented 5 years ago

@tatunts Version 0.1.4 changed the default occupancy to 90 seconds, that has probably solved it.

jgyoldi commented 5 years ago

Hi, is there a way to change the parameters of sleep 1 minute to 5 sec? it is possible to simulate push pairing button?

Any ideas how to fix this.

Hello. Have you had any answer about this? I think this is the question. If we can simulate the reset push via software o send a "keep alive" command to the sensor, the problem will be solved.

alinelena commented 5 years ago

@Koenkk this went under my radar... got fixed after some updates.

jgyoldi commented 5 years ago

So,is it fixed in earlier updates? Does zigbee2mqtt in his latest update keep xiaomi motion sensor alive so they send al state changes even if they are within the first minute?

Regards,

Jose

Koenkk commented 5 years ago

@jgyoldi after the cooldown period of 1 minute the sensor only sends it state once a minute. This is the behavior of the sensor.

jgyoldi commented 5 years ago

You are right. The thing is, is there a way via software to reproduce the behaviour of the physical reset? Some kind of soft-reset. It could be sent if there is a detention after the cool down period. I there is no detection after an hour the sensor van enter in cool down period of detection from every minute and if there is again a detection send again the soft-reset.

Koenkk commented 5 years ago

If it's not possible using the Xiaomi gateway it probably isn't.

Ric199021 commented 1 year ago

Hi, still got this issue with occupancy_timeout 90 seconds. How bad it is if I put it on 180s? I have a big hallway and I'm using 2 sensor but sometimes one of them doesn't see movent. Can I solve my problem with the 180s or should I consider purchasing another sensor? Thanks!

danielbrunt57 commented 11 months ago

I have an RTCGQ01LM which was reporting "motion" after every 55 minutes followed by "no motion detected" 90s later, with no one home! Setting the occupancy_timeout specifically to 90 (which was 'blank' and should default to 90s) solved the problem. It's been "no motion detected" for 3 hours now!