How often you should read an attribute from Zigbee device?

I'm trying to create a custom driver for an occupance sensor and i have the code to read the attribute for the occupancy. However, what i would like to know is how often should i read the occupancy attribute?I'm using the runIn code yo read it in a minute now. However, that seems like not a good way to report motion.

Is there a recommended time for a motion sensor to read the motion triggered attribute?

Thanks in advance.

An occupancy sensor that needs to be polled is really of limited value for obvious reasons.

What specific device is this?

2 Likes

Thanks a lot for replying Mike. It is an OWON occupancy sensor. There are no dirvers available. I tried using the generic zigbee motion sensor and the logs were not showing the cluster that it reports occupancy.

This could also because I've got no clue in creating a custom driver.

Can you post a link to the site where you purchased the sensor from?

Is it this one? China 1ZigBee Occupancy Sensor OPS305 factory and manufacturers | Owon Technology

When paired to HE, what is the Model and Manufacturer values (from device web page 'Data' section) ?

3 Likes

That is the one.

  • model: OCP305
  • manufacturer: OWON

Try the philips hue motion driver.
Be sure the device is awake and click the configure command

4 Likes

Yayyyy!!! It works. Now I need to poke around (hoping not to break anything) to remove the extra configuration items from there. Thank you so much.

I see that the driver code is not public. I think I'll live with the Temperature and Lux reporting options. Is there documentation on how the configuration on Zigbee works? I would like to learn more about creating custom drivers.

Let us know how this sensor performs. How quickly does it detect presence? How many seconds after a human is not in the sensing range is the presence (motion attribute?) cleared?

When debug option is turned on, do you see data sent by this sensor in any 1 or any 4 seconds?

Detection is 1~2 seconds. Motion is cleared after 40~50 seconds. I'm not so sure if this is what you are looking for.

I do see data in the logs in sub-second range.

dev:152022-08-14 11:39:04.709 am infoskipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 5A8D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[5A, 8D]]
dev:152022-08-14 11:39:04.706 am debugdescMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 5A8D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[5A, 8D]]
dev:152022-08-14 11:39:03.909 am inforeporting configuration for Temperature Measurement (cluster 0x0402), attribute 0x0000 failed, unsupported attribute
dev:152022-08-14 11:39:03.906 am debugdescMap:[raw:catchall: 0104 0402 01 01 0040 00 FC7C 00 00 0000 07 01 86000000, profileId:0104, clusterId:0402, clusterInt:1026, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[86, 00, 00, 00]]
dev:152022-08-14 11:39:03.104 am infoskipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 588D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[58, 8D]]
dev:152022-08-14 11:39:03.101 am debugdescMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 588D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[58, 8D]]

Motion clear is happening before that it is in 20~30 second range. It could be me trying to use the stop watch in one and trying to check the events in another.

@user1922 I can only say - congratulations on your successful purchase!

OWON is a well-known and reputable Chinese manufacturer of electrical measurement equipment, seeing its wide range of IoT devices is a piece of very good news!

I am glad to see OWON engineers know what are they doing and have made a mmWave sensor that complies with the Zigbee standards, unlike most of the 'powered by Tuya' junk that heavily spams the Zigbee network.

3 Likes

Curious how this works for you as I would be interested in this device.

Where did you buy it?

I was a bit over exicted. The inactive status is getting reported "falsely" by the Hue driver.

The reason why I say that is because I can see the occupancy led blinking even if I'm not moving. However, the event shows that the motion is inactive.

I feel like I do need a custom driver. However, I don't think I understand this well enough to start something from scratch. Or i might need help some you or others to nudge me to the right direction.

Well, it happens to think something is working in the beginning, while later when you get into the details you see that not everything works as it should be...

Writing a driver from a scratch is not a good idea if you have no previous experience with this.
You can try to analyze the debug logs that are produced from HE standard drivers.

Change the driver to the HE inbuilt driver named 'device'. Then press the Get Info button and post here her device fingerprint.

Then, turn the power off, wait a few seconds and switch the power supply back on. Please post the debug logs from this moment on.

You can use the cog wheel tool in this editor to shrink the logs like this:

Summary

dev:152022-08-14 11:39:04.709 am infoskipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 5A8D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[5A, 8D]]
dev:152022-08-14 11:39:04.706 am debugdescMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 5A8D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[5A, 8D]]
dev:152022-08-14 11:39:03.909 am inforeporting configuration for Temperature Measurement (cluster 0x0402), attribute 0x0000 failed, unsupported attribute
dev:152022-08-14 11:39:03.906 am debugdescMap:[raw:catchall: 0104 0402 01 01 0040 00 FC7C 00 00 0000 07 01 86000000, profileId:0104, clusterId:0402, clusterInt:1026, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[86, 00, 00, 00]]
dev:152022-08-14 11:39:03.104 am infoskipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 588D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[58, 8D]]
dev:152022-08-14 11:39:03.101 am debugdescMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7

Thanks a lot @kkossev .

Here is the detail from GetInfo

Get Info

dev:152022-08-14 10:23:53.779 pm info fingerprint profileId:"0104", endpointId:"01", inClusters:"0000,0003,0406", outClusters:"0003", model:"OCP305", manufacturer:"OWON"
dev:152022-08-14 10:23:53.643 pm trace ZCL version:03
dev:152022-08-14 10:23:53.607 pm trace Software Build Id:unknown
dev:152022-08-14 10:23:53.605 pm trace Model:OCP305
dev:152022-08-14 10:23:53.602 pm trace Manufacturer:OWON
dev:152022-08-14 10:23:53.424 pm debug getting info for unknown Zigbee device...

Here are the logs after the power cycle.

Logs after power

dev:152022-08-14 10:29:31.414 pm info reporting configuration for Power Configuration (cluster 0x0001), attribute 0x0021 failed, unsupported attribute
dev:152022-08-14 10:29:31.411 pm debug descMap:[raw:catchall: 0104 0001 01 01 0040 00 FC7C 00 00 0000 07 01 86002100, profileId:0104, clusterId:0001, clusterInt:1, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[86, 00, 21, 00]]
dev:152022-08-14 10:29:30.615 pm info skipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 688D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[68, 8D]]
dev:152022-08-14 10:29:30.613 pm debug descMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 688D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[68, 8D]]
dev:152022-08-14 10:29:29.809 pm info reporting configuration for Temperature Measurement (cluster 0x0402), attribute 0x0000 failed, unsupported attribute
dev:152022-08-14 10:29:29.805 pm debug descMap:[raw:catchall: 0104 0402 01 01 0040 00 FC7C 00 00 0000 07 01 86000000, profileId:0104, clusterId:0402, clusterInt:1026, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[86, 00, 00, 00]]
dev:152022-08-14 10:29:29.004 pm info skipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 668D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[66, 8D]]
dev:152022-08-14 10:29:29.001 pm debug descMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 668D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[66, 8D]]
dev:152022-08-14 10:29:28.203 pm info reporting configuration for Illuminance Measurement (cluster 0x0400), attribute 0x0000 failed, unsupported attribute
dev:152022-08-14 10:29:28.200 pm debug descMap:[raw:catchall: 0104 0400 01 01 0040 00 FC7C 00 00 0000 07 01 86000000, profileId:0104, clusterId:0400, clusterInt:1024, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[86, 00, 00, 00]]
dev:152022-08-14 10:29:27.398 pm info skipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 648D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[64, 8D]]
dev:152022-08-14 10:29:27.395 pm debug descMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 648D, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[64, 8D]]
dev:152022-08-14 10:29:26.592 pm debug skipped:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 01 100B 01 01 300086, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:true, manufacturerId:100B, command:01, direction:01, data:[30, 00, 86]]
dev:152022-08-14 10:29:26.589 pm debug descMap:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 01 100B 01 01 300086, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:true, manufacturerId:100B, command:01, direction:01, data:[30, 00, 86]]
dev:152022-08-14 10:29:26.359 pm info Master bathroom occupancy is active
dev:152022-08-14 10:29:26.357 pm debug descMap:[raw:FC7C0104060800001801, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:01, clusterInt:1030, attrInt:0]
dev:152022-08-14 10:29:25.784 pm debug descMap:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 01 100B 04 01 863000, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:true, manufacturerId:100B, command:04, direction:01, data:[86, 30, 00]]
dev:152022-08-14 10:29:24.992 pm info reporting configuration for Occupancy Sensing (cluster 0x0406) succeeded
dev:152022-08-14 10:29:24.981 pm debug descMap:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 00 0000 07 01 00, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:07, direction:01, data:[00]]
dev:152022-08-14 10:29:24.167 pm info skipped:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 6000, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[60, 00]]
dev:152022-08-14 10:29:24.164 pm debug descMap:[raw:catchall: 0000 8021 00 00 0040 00 FC7C 00 00 0000 00 00 6000, profileId:0000, clusterId:8021, clusterInt:32801, sourceEndpoint:00, destinationEndpoint:00, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:00, direction:00, data:[60, 00]]
dev:152022-08-14 10:29:23.360 pm debug skipped:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 00 0000 01 01 100086, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:01, direction:01, data:[10, 00, 86]]
dev:152022-08-14 10:29:23.356 pm debug descMap:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 00 0000 01 01 100086, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:01, direction:01, data:[10, 00, 86]]
dev:152022-08-14 10:29:22.557 pm debug descMap:[raw:catchall: 0104 0406 01 01 0040 00 FC7C 00 00 0000 04 01 861000, profileId:0104, clusterId:0406, clusterInt:1030, sourceEndpoint:01, destinationEndpoint:01, options:0040, messageType:00, dni:FC7C, isClusterSpecific:false, isManufacturerSpecific:false, manufacturerId:0000, command:04, direction:01, data:[86, 10, 00]]
dev:152022-08-14 10:29:22.394 pm warn description logging is: true
dev:152022-08-14 10:29:22.393 pm warn debug logging is: true
dev:152022-08-14 10:29:22.392 pm info updated...

1 Like

Here is where the inaccurate status of inactive is reported.

Logs

dev:152022-08-14 10:37:30.076 pm info Master bathroom occupancy is active
dev:152022-08-14 10:37:30.073 pm debugdescMap:[raw:FC7C0104060800001801, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:01, clusterInt:1030, attrInt:0]
dev:152022-08-14 10:37:21.876 pm info Master bathroom occupancy is inactive
dev:152022-08-14 10:37:21.874 pm debugdescMap:[raw:FC7C0104060800001881, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:81, clusterInt:1030, attrInt:0]
dev:152022-08-14 10:37:13.733 pm info Master bathroom occupancy is active
dev:152022-08-14 10:37:13.731 pm debugdescMap:[raw:FC7C0104060800001801, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:01, clusterInt:1030, attrInt:0]
dev:152022-08-14 10:36:49.152 pm info Master bathroom occupancy is inactive
dev:152022-08-14 10:36:49.150 pm debugdescMap:[raw:FC7C0104060800001881, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:81, clusterInt:1030, attrInt:0]
dev:152022-08-14 10:34:29.717 pm info Master bathroom occupancy is active
dev:152022-08-14 10:34:29.715 pm debugdescMap:[raw:FC7C0104060800001801, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:01, clusterInt:1030, attrInt:0]
dev:152022-08-14 10:31:46.894 pm info Master bathroom occupancy is inactive
dev:152022-08-14 10:31:46.892 pm debugdescMap:[raw:FC7C0104060800001800, dni:FC7C, endpoint:01, cluster:0406, size:08, attrId:0000, encoding:18, command:0A, value:00, clusterInt:1030, attrInt:0]

Value 81 for attribute id 000 is reported as inactive. Active is 1, and Inactive is 0. I'll ask the developers to find out what 81 means.

1 Like

The return value of 0x0406, attribute 0000 is a bitmap, with only bit 0 being used, the other bits are documented as "reserved". For whatever reason, they've also set the high bit (0x80). The driver should be masking off the low bit only and using that to determine active (set) or inactive (clear), ignoring other bits, not just doing a direct comparison.

2 Likes

I'm using the inbuild Hue Motion sensor for this. Not sure if 81 means something for a motion sensor and this is an occupancy sensor.

Thank you for your help.

1 Like