Restore an auto discovered entity

Hi,

I have an (multiple) rflink device, and I’m trying to modify original integration to handle more than one gateway.

Anyways, while doing my tests, I found that :

  • for the entities state to restore properly, entities had to have a unique_id which is not the case actually. Ok check, I’ve added a unique_id attribute. without it, auto-discovered entities aren’t even present at restart

  • but then, devices I declare in configuration.yaml get a proper state restored … but then auto-discovered entities get restored but in an “unavailable” state.

I’m guessing that it’s because there is no config entry anywhere for them, and then a “state” restored on an “unknown entity” has no sense …

but .storage/core.entity_registry lists my device just there …

Soooooo by a developper’s point of view. The real question is : if the integration detects new entities and adds them on the fly … is it then possible to save those new entities as concrete yaml config entries somewhere in configuration.yaml for example ? in order to re-add thoses entities at reboot ?

for example here :

switch has been declared through yaml, light has been discovered by pressing the remote’s button, and then HA has been restarted … switch is usable, light is not usable.