Simple: add a unique_id to the yaml created sensor. Note that there are two ways to create a binary sensor in yaml though. The old way does not provide the possibility, the new format does. So you may need to convert it to the new format.
Sorry, are categories provided for sensors? For automations -yes, for sensors - do not remember (cannot check it now).
(honestly, see no need to use categories at all since labels are supported)