Does Hub 0.41.x only support integer in case of endpoint?

In the case of Hub 0.41, it seems that only integers are allowed for the end point, is this correct?

device:send(zcl_clusters.OnOff.server.commands.Off(device):to_endpoint(1)) – it works
device:send(zcl_clusters.OnOff.server.commands.Off(device):to_endpoint(1.0)) – it does not work, but work on hub 40

Hi, @zambobmaz!

What is the endpoint number to which you want to send this command?
When you use 1, the value is converted to hex (0x01)

Decimal number(double type) was used directly without hex conversion since I thought if I don’t use the “0x” prefix, the endpoint will automatically convert to hexadecimal even if it has decimal point.

In the hub 40 version, the double type value(I mean value has decimal point) was also converted to hex, but it seems that the conversion is not possible in hub 41.

– component_id = “switch1”
local ep = component_id:match(“switch(%d)”) – it will return 1.0
math.floor(ep) – hub 41 need this logic(or tonumber) to remove decimal point

From the sample code in the Edge documentation (the link below), it is recommended to use tonumber() function after component_id:match().

    local ep_num = component_id:match("switch(%d)")
    return ep_num and tonumber(ep_num) or device.fingerprinted_endpoint_id
1 Like

It would be nice if it worked regardless of decimal point. I’ll have to use a tonumner anyway.