Error retrieving data from `device.zigbee_endpoints[device.fingerprinted_endpoint_id]`

Just to let people know, sometimes device.zigbee_endpoints[device.fingerprinted_endpoint_id] is null because device.fingerprinted_endpoint_id is always a number and device.zigbee_endpoints sometimes refers endpoints as numbers and sometimes as strings.

In other words, device.zigbee_endpoints[1] and device.zigbee_endpoints["1"] are different in lua.

Currently, the most safe way to retrieve data from this endpoint seems to be:

local fei = device.zigbee_endpoints[device.fingerprinted_endpoint_id] or device.zigbee_endpoints[tostring(device.fingerprinted_endpoint_id)]

Hi, @w35l3y!

Which firmware version is currently used in your Hub?
I checked with the team and they mentioned that there was a change a while ago to use all indexes as numbers, not strings.

45.11

ok, can you replicate the issue and send the info below so the team can check what happened, please?

  1. Hub logs
  1. In the IDE, enter “my hubs”
  2. Enter the corresponding Hub and go to “view utilities”
  3. Click on “send” below "send hub logs
  1. Driver logs with the null response.
  2. Your Hub ID. The one that appears in the IDE (Eg. DXXXXX)

Probably, the error is here somewhere…

image

raw_device probably contains the zigbee_endpoints with associative keys (strings)

In other words, I think child devices doesn’t receive the same treatment done above for zigbee devices.

Before calling Device.init, zigbee_endpoints is corrected.
The same doesn’t apply for child devices or generic device (last 2 conditions from the first print).
That is what I think.