I’m trying to write my first custom integration to control my home thermostats.
I’m looking for some guidance (any similar examples would be great) on how I’m supposed to structure my integration to model my scenario
My house has multiple thermostats.
Each thermostat has a mode it can be in (e.g. Day, Night, Vacation), and multiple values representing its current state (e.g. Current Temp, Target Temp, Is heating currently on or off)
I have an API which I can call, and it returns all of the above data for all thermostats in one go.
Changing the mode for 1 or more thermostats can be done with a single (or multiple) calls to the API.
How should I model this? My understanding so far is that I should have a single component (platform?). This then calls the API on installation to discover the devices, where it adds a device for each thermostat. Each thermostat/device should implement a
ClimateEntity which exposes the various properties and services.
(Climate)Entity can implement
async def async_update(self):, which implies each entity is called separately to update it’s value. I dont want to hit the API loads of times when I can just call it once - is this supported in some implicit way or do I have to wrangle this myself?
Any guidance on getting started much appreciated