fustom / ariston-remotethermo-home-assistant-v3

Ariston NET remotethermo integration for Home Assistant based on API
MIT License
160 stars 38 forks source link

Expose temperature from zone thermostat as entity #224

Closed LuisDiazUgena closed 9 months ago

LuisDiazUgena commented 1 year ago

Hi,

It would be nice to have the thermostat temperature as an entity.

Right now is "embedded" on the climate entity by itself and can't be used in other things directly.

Having it exposed would allow us to use another thermostat beside the generic one. (i.e: better thermostat integration).

LuisDiazUgena commented 1 year ago

Hi!

I have been diggin into the code and found that the Sensor entities are represented on const.py file and I think something like this would work adding to ARISTON_SENSOR_TYPES (@ line 193 in const.py file)

AristonSensorEntityDescription(
        key=DeviceProperties.CH_DETECTED_TEMP,
        name=f"{NAME} CH detected temp",
        device_class=SensorDeviceClass.TEMPERATURE,
        state_class=SensorStateClass.MEASUREMENT,
        get_native_value=lambda entity: entity.device.ch_detected_temp_value,
        get_native_unit_of_measurement=lambda entity: entity.device.ch_detected_temp_unit,
        system_types=[SystemType.GALEVO],
    ), 

Probably ch_detected_temp in get_native_value and get_native_unit_of_measurement would't work. I'm trying to find out how to get those values, but this is my first time looking into an integration code and I'm kinda lost (you know, read the code first, then the docs kinda behaviour).

Any tips on how to get the proper naming for this?

4139GGN commented 11 months ago

Hello Luis!

I tried as you mentioned, but I didn't get any results.

system_types=[SystemType.VELIS],

This was another change I tried with my model. But I didn't get any new entities either.

LuisDiazUgena commented 11 months ago

Hi @4139GGN,

that code was not intended to be implemented straight away. Has mentioned on my comment:

Probably ch_detected_temp in get_native_value and get_native_unit_of_measurement would't work. I'm trying to find out how to get those values, but this is my first time looking into an integration code and I'm kinda lost (you know, read the code first, then the docs kinda behaviour).

That was a placeholder to show out how it could be. To be able to expose those values, we need to figure out the correct way to get the get_native_value and get_native_unit_of_measurement properties.

Maybe @fustom could help us.

fustom commented 9 months ago

Hi! Use template sensor to do that.

Settings -> Devices & services -> Helpers -> Create helper -> Template -> Template a sensor Add the name for a new sensor. Add state template: {{ state_attr('your climate entitity id', 'current_temperature') }} Click submit.

LuisDiazUgena commented 9 months ago

Thanks, that works perfectly. Maybe it will be nice to have posted on the readme