[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))
end

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))
	device:emit_event(capabilities.illuminanceMeasurement.illuminance(lux_value))
end

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.

2 Likes

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,
-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-- 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())
end

--- @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_configuration
}

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.

Just noticed that when i unpaired and repaired one of my version SML003 Indoor Hue Motion sensors, it repaired using this driver, yeah!!! So it looks like the fingerprint is now added, Thanks! Update: I spent my Saturday repairing all my Hue Motion Sensors, all work perfectly with this updated Driver.

1 Like

And I just added my outdoor sensor, also works great!

Best Buy has the Hue Sensors for 35.99 and 39.99 for rewards members this weekend. I got four more and have replaced all but two of my Aqara sensors, I am tired of them going missing everytime the hub restarts.

3 Likes

I’m using the Edge Driver for my SML003 Hue Motion Sensor. However, I can’t change the motion sensitivity. Additionally, my Hue sensors only show up in IF statements and not Then. I was trying to set up an automation to prevent my sensor from working if the TV was on, to avoid turning on lights. However, my sensors do not appear on my then statements.

I’m using the Aeotec version 3 firmware version 000.044.00009

Has anyone else run into this issue?

EBF

I accomplished that by creating a Virtual presence sensor. When I go to bed, turn on the virtual presence sensor with a zigbee button on the head board or Miss Google, then add a prerequisite to the motion sensor routines to only work when the Virtual presence sensor is set to not present. I also have one in my Computer/Den to do just what you want.

David, thanks for the idea I will have to figure out how to set up a virtual presence switch. I just found it weird that my other motion sensors work fine except for the hue one.

EBF

I installed the Hue Motion driver and re-paired one of my Hue motion sensors… and it paired, and used the driver, but its stuck with no history and motion active. Has been like this for about 30 minutes. Any troubleshooting tips?

-EDIT-

So I removed it again and re-paired it. It’s now showing status updates. But when I try to add it to Routines I get a network error trying to save the routine.
Also battery status has gone down to 13% it was at 90% before removing it originally.

—-
After several hours it updated the battery levels to 60% and seems to be functioning properly.

Both of my hue motion sensors went offline today. I was able to delete and re-paired with smartthings. They are correctly using edge driver, but there is no motion being detected. Any ideas on how to fix or any others having this same issue?

-Edit-
I have repaired after several hours and now motion is working correctly.