kkossev/Hubitat

2-i-1 motion sensor - motion sensing inverted

Closed this issue · 4 comments

I just got a Tuya 2-in-1 motion+lux sensor and have tried it with your driver, via HPM.

    endpointId: 01
    application: 42
    manufacturer: _TZE200_3towulqd
    model: TS0601

It appears the motion detection flag is inverted. When motion is detected, it is registered as no motion, and when there is no motion, it is registered as motion!

Example logging output when motion is detected:

2022-12-08 21:44:48.455[debug] New Motion and Luminance sensor parse(_TZE200_3towulqd) descMap = [raw:catchall: 0104 EF00 01 01 0040 00 812A 01 00 0000 02 01 00D50104000100, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:812A, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, D5, 01, 04, 00, 01, 00]]

... and when motion is no longer detected:

2022-12-08 21:45:00.730[debug] New Motion and Luminance sensor parse(_TZE200_3towulqd) descMap = [raw:catchall: 0104 EF00 01 01 0040 00 812A 01 00 0000 02 01 00D80104000101, profileId:0104, clusterId:EF00, clusterInt:61184, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:812A, isClusterSpecific:true, isManufacturerSpecific:false, manufacturerId:0000, command:02, direction:01, data:[00, D8, 01, 04, 00, 01, 01]]

Can be fixed by changing line 475:

<<<                handleMotion(motionActive=fncmd)
>>>                handleMotion(motionActive=!fncmd)

but haven't raised as a pull request as I'm not sure I'm confident enough that it won't break something for another model of sensor!

Just saw the related discussion in #12 ... The one I have is using the EF00 cluster.

Hi Matt,

Thank you for the report. Yes, the motion detection flag is inverted for : _TZE200_3towulqd TS0601, so I have made a correction in the code (for this particular model only).

The fix is in the dev. branch version 1.0.16

I will keep this issue open, as I have some doubts about whether the sensitivity and motion re-trigger settings are working for this device. Can you check? You would probably need to wake up the sensor at the time, when you click on Send Preferences.

Last edit (timestamp "2022/12/10 11:53 AM") - this sensor is excluded from the IAS group. It is very weird that the device reports IAS Zone cluster during the discovery, but later uses the Tuya specific cluster for configuration.

'Invert Motion' option was added, there was no way to automatically distinguish between the two modifications of this sensor ( the app. version is the same).