"Warning: Custom components are deprecated, not recommended for new configurations and will be removed from ESPHome in a future release. Please look at creating a real ESPHome component and “importing” it into your configuration with External Components."
Just to flag this up though I don't see a date specified for this to happen.
https://esphome.io/components/sensor/custom.html
"Warning: Custom components are deprecated, not recommended for new configurations and will be removed from ESPHome in a future release. Please look at creating a real ESPHome component and “importing” it into your configuration with External Components."