Multiple entities for a single device

Hi, everybody!
I’m new to HA and development in HA, but hope someone can halp me to find a solution.

I have thermostat BHT-6000 and adopted local tuya solution for current version 0.107.7. Everthing works, but device returns not only ambient temperature, it returns also floor temperature. The Thermostat Card shows only one temperature. As I understand, more easier to add sensor, to display floor temperature, but I wan’t to double poll requests to device, because device in one request returns ambient and floor temperature. I want connect to one device to entities: climate and sensor. I tried to find some example fo solution, but failed. It would be nice if someone guide me to solution or some examples.

Valera

Are you asking how to structure the integration code to handle one API call and feed the resulting data to two separate entities?

Hi!

You are quite right, that’s what I looking for. But I feel, that I have to read all topics in documentation again and again, because seems, that I don’t understand some core concepts.
For example:
I have a device - thermostat moes BHT-6000
To communicate with it I use python package pytuya
To represent device in HA I use platform localtuya (./custom_components/localtuya/)
I want to see device in HA as climate, so I create file in localtuya directory: climate.py
With definition of class:
class TuyaClimate(ClimateDevice)
in it.
And I create in config file folowing records:

climate bedroom:
    platform: localtuya
    host: ...
    ...

And I can’t understand, how to map this things to description in documentation Entity
I suggest, that:
“Python lib for protocol (external)” is package pytuya
“Entity platform” - climate.py
“Component” - records in config
But what than - “Entity component” and “Platform”?

And with this suggestion, I can’t figure out, how to represent my device as sensor.

I would be very appreciate if you can explain this.

Valera

I can’t wrap my head around that diagram either. I suspect it is out of date as component isn’t used at all anymore as far as I know and a lot of configuration is done outside of configuration.yaml these days.

When you inherit from ClimateEntity (Note that I think this used to be called ClimateDevice), it in turn inherits from Entity.

https://github.com/home-assistant/core/blob/7035a6da9fb40f9a0233bb6b35bdf61b74c8d5b7/homeassistant/components/climate/__init__.py#L167

Hi!

Thank you for your answer. It helps me to find decision close to my needs - HASS-sonoff-ewelink and now I solved problem for one device, but I have two different devices but my platform supports only one, so now I’m seeking decision for this problem.

Valera.