Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update select.py for AIR_OUTSIDE_TPT #19

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hexCut
Copy link

@hexCut hexCut commented Sep 9, 2024

No description provided.



# Nuova classe per il sensore della temperatura esterna (AIR_OUTSIDE_TPT)
class AldesProductOutsideTempSensor(AldesProductEntity, SensorEntity):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, move this class and its async_setup_entry to a different class. Something like sensor.py.


from .const import DOMAIN, PRODUCT_COORDINATORS
from .entity import AldesProductDataUpdateCoordinator, AldesProductEntity

async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback) -> None:
coordinators = hass.data[DOMAIN][entry.entry_id][PRODUCT_COORDINATORS]
async_add_entities(AldesProductEntityModeSelect(coordinator) for coordinator in coordinators)

async_add_entities(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Create another async_setup_entry in the new sensor.py file.

[
AldesProductEntityModeSelect(coordinator) for coordinator in coordinators
] + [
AldesProductOutsideTempSensor(coordinator) for coordinator in coordinators # Aggiungi il sensore per la temperatura esterna
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sensor is not supported by all the products in https://github.com/aalmazanarbs/hassio_aldes/blob/master/aldes/product.py#L20, please, make it conditional and invoke async_add_entities if the product support it.

[
AldesProductEntityModeSelect(coordinator) for coordinator in coordinators
] + [
AldesProductOutsideTempSensor(coordinator) for coordinator in coordinators # Aggiungi il sensore per la temperatura esterna
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, change code comments to english.


@property
def native_value(self):
return self.coordinator.product.air_outside_tpt # Restituisce il valore della temperatura esterna
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this code comment, self explanatory with native_value.


@property
def native_value(self):
return self.coordinator.product.air_outside_tpt # Restituisce il valore della temperatura esterna
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

air_outside_tpt is not present in AldesProduct, you must provide a way to get this value.


@property
def native_unit_of_measurement(self):
return "°C"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it always °C? or it is configurable by Aldes App? If it is always in °C ok, but take care of because °F is also other possible value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Request to integrate new temperature and fan speed data into the Aldes plugin sensors
2 participants