[Edge Driver] Hue Motion Sensor (No Hue Bridge)

I had to try discovery quite a few times but it eventually started working. It is still reporting that warning about 0x0500. These are the first 4 lines that are always logged during discovery of a device

2022-05-11T20:36:16.966968324+00:00 DEBUG Hue Motion  driver device thread event handled
2022-05-11T20:36:26.672370992+00:00 TRACE Hue Motion  Received event with handler device_lifecycle
2022-05-11T20:36:26.811300659+00:00 WARN Hue Motion  Device does not support cluster 0x0500 not adding configured attribute
2022-05-11T20:36:26.817912659+00:00 INFO Hue Motion  Device does not support cluster 0x0500 not adding monitored attribute

As @orangebucket said, almost all zigbee motion sensors will have the 0x0500 cluster, as well as many smoke sensors.

It identifies the device as being available for use in a security system, and is technically the IAS zone cluster Where IAS stands for “intruder alarm system. “

The IAS Zone cluster provides an interface to an IAS Zone device, which provides security alarm triggers for a zone or region of a building (e.g. fire detection). The cluster allows an IAS Zone device to be configured/controlled from a CIE (Control and Indicating Equipment) device. The server side of the cluster is implemented on the IAS Zone device and the client side is implemented on the CIE device. The IAS Zone device is detailed in the ZigBee Devices User Guide (JN-UG-3114).
The cluster supports the following functionality:
 Up to two alarm types per zone, Alarm1 and Alarm2
 ‘Low battery’ reports
 Supervision of the IAS network

See section 37 of the spec.

I might be wrong, but I don’t think smartthings actually does anything with IAS zones. But it will be part of the device’s supported cluster list.

And all of that said, if I recall correctly, when the first Hue motion sensors were released they were considered part of a lighting system, not a security system, and didn’t have the 0 x 0500 cluster. But I don’t know if that’s still true. :thinking:

1 Like

The message is occurring because the driver is registering for the default handler of the motionSensor capability rather than the occupancySensor capability. It is then modifying the cluster configuration to remap the motion event.

[capabilities.motionSensor.ID] = {
				cluster = clusters.OccupancySensing.ID,
				attribute = clusters.OccupancySensing.attributes.Occupancy.ID,
				minimum_interval = 1,
				maximum_interval = 300,
				data_type = data_types.Bitmap8

Why not just use the occupancySensor handler instead?

Hi @blueyetisoftware,

It can be done in the both ways.
The 0x0406 cluster and its accupancy attributes do not have defaults for configuration, monitoring and management, so need to make a custom obfiguration and handlers to manage it.

Surely, I don’t know, the error may come from the fact that the code IAS zone auto_enroll will be reflected in the driver template and since it does not support that cluster, it shows the error that has no importance.

ias_zone_configuration_method = constants.IAS_ZONE_CONFIGURE_TYPE.AUTO_ENROLL_RESPONSE

If so, it can be removed, if the driver is only for that device.

I’m also curious about the code that works around the illuminance measurement. Here is the code in the default handler:

function illuminance_measurement_defaults.illuminance_attr_handler(driver, device, value, zb_rx)
  local lux_value = math.floor(math.pow(10, (value.value - 1) / 10000))
  device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, capabilities.illuminanceMeasurement.illuminance(lux_value))

and here is the code in this driver

local function illuminance_attr_handler(driver, device, value, zb_rx)
	-- illuminance handler is explicitly defined because of the error in the default built-in zigbee handler.
	local lux_value = math.floor(10 ^ ((value.value - 1) / 10000))

The calculation looks the same to me. What are you working around with this? A problem in emitting the event?

I also have it like this in my drivers, because the first egde libraries didn’t work math.pow() and it had to be done like this, I don’t know if it’s already fixed, I haven’t changed it either

1 Like

There was a bug in the Edge driver in the earlier version of the ST hub firmware. Now, it is fixed in the latest ST hub firmware, but some hubs haven’t get the latest firmware yet.


I must be missing something. I see these defaults available for occupancySensor

-- Copyright 2021 SmartThings
-- Licensed under the Apache License, Version 2.0 (the "License");
-- you may not use this file except in compliance with the License.
-- You may obtain a copy of the License at
--     http://www.apache.org/licenses/LICENSE-2.0
-- Unless required by applicable law or agreed to in writing, software
-- distributed under the License is distributed on an "AS IS" BASIS,
-- See the License for the specific language governing permissions and
-- limitations under the License.
local zcl_clusters = require "st.zigbee.zcl.clusters"
local capabilities = require "st.capabilities"

--- @class st.zigbee.defaults.occupancySensor
--- @field public zigbee_handlers table
--- @field public attribute_configurations table
--- @field public capability_handlers table
local occupancy_sensor_defaults = {}

--- Default handler for occupancy attribute on the occupancy sensing cluster
--- This converts the Bitmap8 value of the occupancy attribute to OccupancySensor.occupancy occupied if bit 1 is set
--- unoccupied otherwise
--- @param driver ZigbeeDriver The current driver running containing necessary context for execution
--- @param device st.zigbee.Device The device this message was received from containing identifying information
--- @param value st.zigbee.data_types.Bitmap8 the value of the occupancy attribute on the OccupancySensing cluster
--- @param zb_rx st.zigbee.ZigbeeMessageRx the full message this report came in
function occupancy_sensor_defaults.occupancy_attr_handler(driver, device, value, zb_rx)
  local attr = capabilities.occupancySensor.occupancy
  device:emit_event_for_endpoint(zb_rx.address_header.src_endpoint.value, ((value.value & 0x01) ~= 0) and attr.occupied() or attr.unoccupied())

--- @class st.zigbee.defaults.occupancySensor.OccupancyConfiguration
--- @field public cluster number OccupancySensing ID 0x0406
--- @field public attribute number Occupancy ID 0x0000
--- @field public minimum_interval number 0 seconds
--- @field public maximum_interval number 3600 seconds (1 hour)
--- @field public data_type st.zigbee.data_types.Bitmap8 the Bitmap8 class
local occupancy_configuration = {
  cluster = zcl_clusters.OccupancySensing.ID,
  attribute = zcl_clusters.OccupancySensing.attributes.Occupancy.ID,
  minimum_interval = 0,
  maximum_interval = 3600,
  data_type = zcl_clusters.OccupancySensing.attributes.Occupancy.base_type,

occupancy_sensor_defaults.default_occupancy_configuration = occupancy_configuration

occupancy_sensor_defaults.attribute_configurations = {

occupancy_sensor_defaults.zigbee_handlers = {
  global = {},
  cluster = {},
  attr = {
    [zcl_clusters.OccupancySensing] = {
      [zcl_clusters.OccupancySensing.attributes.Occupancy] = occupancy_sensor_defaults.occupancy_attr_handler,
occupancy_sensor_defaults.capability_handlers = {}

return occupancy_sensor_defaults

You are right, I was writing from memory with my mobile and I got confused with another cluster.

In any case, what I wanted to say is that can use the motionSensor capability using a custom handler with the messages received from the occupancy attribute and emit the motion and no motion events.