mool / home-assistant-bgh-smart

BGH Smart integration for Home Assistant
15 stars 8 forks source link

Utilizando constantes deprecadas que serán removidas a partir de HA Core 2025.1 #19

Closed GAFL-Knight closed 1 day ago

GAFL-Knight commented 5 days ago

Estimado @mool desde ya muchas gracias por este desarrollo tan útil.

Seguramente ya estás al tanto, pero por las dudas cargo este ISSUE a fin de tener seguimiento. A partir de la versión 2005.1 del Core de HA, varias constantes utilizadas en esta integración dejarán de estar disponible, por lo cual es necesario realizar los ajustes necesarios en el código para garantizar la continuidad de la integración.

A continuación copio los distintos mensajes del LOG de HA con las advertencias del caso:

ADVERTENCIA 1:

Registrador: homeassistant.components.climate.const
Fuente: helpers/deprecation.py:197
integración: Climate (documentación, problemas)
Ocurrió por primera vez: 16:27:13 (8 ocurrencias)
Último inicio de sesión: 16:27:13

HVAC_MODE_COOL was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.COOL instead, please report it to the author of the 'bgh_smart' custom integration
HVAC_MODE_FAN_ONLY was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.FAN_ONLY instead, please report it to the author of the 'bgh_smart' custom integration
HVAC_MODE_DRY was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.DRY instead, please report it to the author of the 'bgh_smart' custom integration
HVAC_MODE_AUTO was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.AUTO instead, please report it to the author of the 'bgh_smart' custom integration
HVAC_MODE_OFF was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use HVACMode.OFF instead, please report it to the author of the 'bgh_smart' custom integration

ADVERTENCIA 2:

Registrador: homeassistant.const
Fuente: helpers/deprecation.py:197
Ocurrió por primera vez: 16:27:13 (2 ocurrencias)
Último inicio de sesión: 16:27:13

TEMP_CELSIUS was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.CELSIUS instead, please report it to the author of the 'bgh_smart' custom integration
TEMP_FAHRENHEIT was used from bgh_smart, this is a deprecated constant which will be removed in HA Core 2025.1. Use UnitOfTemperature.FAHRENHEIT instead, please report it to the author of the 'bgh_smart' custom integration

ADVERTENCIA 3:

Registrador: homeassistant.helpers.entity
Fuente: helpers/entity.py:1637
Ocurrió por primera vez: 16:27:14 (1 ocurrencias)
Último inicio de sesión: 16:27:14

Entity None (<class 'custom_components.bgh_smart.climate.BghHVAC'>) is using deprecated supported features values which will be removed in HA Core 2025.1. Instead it should use <ClimateEntityFeature.TARGET_TEMPERATURE|FAN_MODE: 9>, please create a bug report at https://github.com/mool/home-assistant-bgh-smart/issues and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation

ADVERTENCIA 4:

Registrador: homeassistant.components.climate
Fuente: components/climate/__init__.py:370
integración: Climate (documentación, problemas)
Ocurrió por primera vez: 16:27:14 (1 ocurrencias)
Último inicio de sesión: 16:27:14

Entity None (<class 'custom_components.bgh_smart.climate.BghHVAC'>) implements HVACMode(s): auto, cool, heat, dry, fan_only, off and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please create a bug report at https://github.com/mool/home-assistant-bgh-smart/issues

Desde ya muchas gracias.

GAFL-Knight commented 1 day ago

Hola a todos.

Me puse a trabajar con estos mensajes de error y logré resolver el misterio. Estuve viendo la documentación de HA y un ejemplo de otra integración de HACS con el código ya actualizado que utiliza las mismas constantes y pude ver como estaba resuelto. Por lo tanto adjunto el archivo que deben reemplazar que es climate.py que se encuentra en el directorio de HA custom_components\bgh_smart. Como no puedo subir un archivo Python (extensión py), para poder aplicar el cambio deberían hacer lo siguiente:

  1. Realizar una copia de seguridad del HA por cualquier eventualidad.
  2. Renombrar el archivo custom_components\bgh_smart\climate.py por custom_components\bgh_smart\climate-org.py. esto es por si hay algún problema, poder recuperar el archivo original.
  3. Copiar el archivo adjunto climate.txt' encustom_components\bgh_smart`.
  4. Renombrar el archivo custom_components\bgh_smart\climate.txt por custom_components\bgh_smart\climate.py. Con esto volvemos a obtener el archivo en Python.
  5. Reiniciar HA.

climate.txt

Yo ya lo tengo implementado en mi HA sin problemas y está funcionando muy bien. Espero disfruten de esta integración que realmente anda muy bien gracias a @mool .