How to create virtual devices with multiple instances

Hi there!

I’m a programmer, but new to HA. I’d like to know if it’s possible to:

  • define virtual devices (eg a thermostat with different attributes temp_current, temp_target, status, etc)
  • create multiple instances of said virtual device (eg. thermostat_living, thermostat_upstairs, thermostat_bathroom)

I’m thinking along the lines of defining an object class with attributes and built in logic, then create multiple instances of it. Sticking with the example of the thermostat: I’d like to create a class of my_custom_nest that can hold multiple attributes and core logic, then create one instance to drive lets say my 3 dumb heaters in the living room via smart plugs, one instance that drives the upstairs heatpump, and one instance for whatever heater is in the bathroom.

So far I’ve found helper inputs to store values… but they seem to be loose single values, not that suitable for many multi-attribute entities. And I’ve put some logic together using node-red… but this seems to be explicitly tied to specific real devices, and I can’t see how to use this in an abstract way that can later be instantiated.

If there is anyone here in the community with an object-oriented programming mind, if you could point me into the right direction on the docs or the web that would awesome!

Thanks for your help,
Max

You can define a generic thermostat with users m uses sensors and switch as a bundle in background.