#Entity descriptions

1 messages · Page 1 of 1 (latest)

runic prairie
#

How much entities do you have per integration?

vestal bloom
#

depends on the integration. The one I'm building right now has 3 (battery, tank level, take percentage). I have some that have 7-8

runic prairie
#

Right, let me get into bed and I'll explain

#

Okay so sometimes you have a lot of sensors which have the same logic

#

The only difference is maybe what value they get, unit of measurement, device class, name etc

#

So a design pattern that started was extracting those differences into a data carry object

vestal bloom
#

I have a lot like that actually

runic prairie
#

And make the entity generic

#

Checkout the Withings sensor platform for example

#

It has a huge list

#

But without a million separate classes

vestal bloom
#

will do. If it works the way I'm imagining it should let me remove a bunch of duplicate code, thanks!

runic prairie
#

If you want some feedback, feel free to ask in devs or slide in my dms