Z2M "custom" sensor - keep value alive until next update

Hi.

I’ve configured a custom attribute for a door lock sensor, in fromZigbee.js and exposed it to Home Assistant discovery.
The sensor works and the attribute returns the correct value, but it’s value is cleared in HA. I would like the attribute to show last value until next update.

tried setting the following in Z2M configuration.yaml, but no luck.

    retain: true
    retention: 900

From History ;
Screenshot 2021-03-23 at 14.10.37