How to add sensor dynmically

Hi,

My integration adds sensor (entities) on startup. I want to be able to add more sensors after startup, eg, from service request.

Is it possible to add entities after the integration completed the setup? which function should I call to add entities?

Thx

I’ve kind of the same demand. Did you already found a method to do this?

You might look at the source code for the mqtt integration. Using a discovery message you can add (sensors, switches,…) without having to restart HA. So it is possible.
Another example is the rflink integration.

2 Likes