I’m building a custom component for a security hub. It connects to the server via uart protocol. The hub itself has some sensors and transmits telemetry (voltage, rssi, etc).
The hub can handle some number of devices (pairing between hub and device should be done by user via the console). Each device has its own set of sensors. Device periodically transmits its telemetry data by radio to the hub.
So, overall schema looks like this:
What I cannot understand is how to manage the device list.
Say, the user adds the hub via UI in config flow. No problem with that - I have all credentials I need, so I can set up the hub in
__init__.py with device registry. But then the hub starts to receive data from attached devices, meaning that it should somehow register new device and boot up its sensors. But how?
I can easily do it in my code, but I cannot understand how to do it in homeassistant. It can add new device dynamically, but It doesn’t allow me to register its sensors.