Xiaomi motion sensor - occupied not motion?

Hi,

What a great product is Mozilla gateway, glad I found it and can use it, it has a lot of potential.

Question. Why is a BinarySensor and BooleanProperty used instead of an MotionSensor and MotionProperty for the Xiaomi motion sensor? Is there a difference between occupied and motion in the Mozilla gateway? Design? If I change this to motion I get the nice motion and no motion icons shown in the thing.

currently used code:

‘lumi.sensor_motion.aq2’: { // RTCGQ11LM
name: ‘occupancy’,
type: Constants.THING_TYPE_BINARY_SENSOR,
@type’: [‘BinarySensor’],
powerSource: POWERSOURCE.BATTERY,
occupancyTimeout: 10, // seconds
activeEndpoints: {
1: {
profileId: PROFILE_ID.ZHA_HEX,
inputClusters: [
CLUSTER_ID.GENBASIC_HEX,
CLUSTER_ID.OCCUPANCY_SENSOR_HEX,
],
outputClusters: [],
},
},
properties: {
occupied: {
descr: {
@type’: ‘BooleanProperty’,
type: ‘boolean’,
label: ‘Occupied’,
description: ‘Occupancy Sensor’,
},
profileId: PROFILE_ID.ZHA,
endpoint: 1,
clusterId: CLUSTER_ID.OCCUPANCY_SENSOR,
attr: ‘occupancy’,
value: false,
parseValueFromAttr: ‘parseOccupiedAttr’,
},

With motion property.

I think that this was just a case of timing. When the Xiaomi motion sensor support was added the MotionSensor and MotionProperty weren’t supported in the gateway.

Some manufacturers call them motion sensors, and some call them occupancy sensors. I’m not sure if there is any significant difference.

I guess one could argue that a motion sensor is really detecting an instantaneous event and occupied is more like a state.

I see, so from now on we should use MotionSensor and MotionProperty if we want the nice motion icons.

Is there a lot of code in the Zigbee and Z-Wave add-on that still uses occupied or occupancy or only the Zigbee Xiaomi code? Will I break something if I change occupied or occupancy to motion. (maybe I should find a Dutch Mozilla Iot makers group who can help with coding, I definitely miss the skills :grin:)

The only thing that would break would be rules which had been setup referencing the occupied property.

I’d be happy to take a PR changing to use MotionSensor/MotionProperty (instead of BinarySensor/BooleanProperty)

I will check the code and change what I think is necessary and will put it in a new github issue so that you can check the code and roll out a change.

I made the following ZigBee -adapter issue: