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)]
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.
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.