rytilahti / homeassistant-xiaomi-ng

3 stars 2 forks source link

Make entities conditional #10

Open SLaks opened 6 months ago

SLaks commented 6 months ago

Different Roborock vacuums support different sets of entities (eg, no mop, or no mop autowash).

We should figure out some way to only create entities for features that the particular model actually supports.

rytilahti commented 6 months ago

Yeah, this should probably be done similarly as it's done for the status reporting in the cli. That is, skip creating entities for descriptors that have a None as their value after the initial update.

API-wise it might make sense to allow "binding" status update response to the existing descriptors, to get rid of the clumsy "get_value" interface and to allow using something like descriptor.value to obtain the value.

One open question is how to handle cases where the value is only set under specific conditions, as I am fairly sure there are those, too. Create but disable/hide them by default? Track subsequent updates for new information, and initialize entities when encountering those?

SLaks commented 6 months ago

One open question is how to handle cases where the value is only set under specific conditions, as I am fairly sure there are those, too.

I don't know of any