Those 40 meters is over spec’ed, 30 meters is the max for z-wave, but that is with no other 868mhz antennas nearby, which Homey does have, and perfect conditions (nothing that can interfere nearby, and nothing in between like walls, good if not perfect humidity, not too much other RF signals in the air, and a few things more)
While 5-6 meters is a little small, 8-10 is really the max (indoors) that Homey can handle in its current state (for most people), some people did do an mod to improve the range by changing the antenna out.
Inclusion is recommended to be done within 1 meter anyway, as Homey asks a lot of the device after initial pairing, way closer then 1 meter (like 10cm) is really recommended.
And a lot of things even just nearby can lower the range big time, copper wires for example, just nearby can be enough, or newer double (or triple paned) windows are awesome low frequency absorbers too.
But even a wall behind the device can be enough to lower the range.