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

HA 2024 climate compatibility changes #1231

Conversation

litinoveweedle
Copy link

This is PR containing compatibility fixes for recent HA climate changes. Those shall fix warning and error as bellow.

Changes summary:
replacement of HVAC_MODE_
corrected SUPPORTED_FEATURES
added ClimateEntityFeature flags

as per:
https://developers.home-assistant.io/docs/core/entity/climate/ https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation/ https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded/

Related errors and warnings:

Log details (WARNING)
Logger: homeassistant.components.climate
Source: components/climate/__init__.py:361
integration: Climate (documentation, issues)
First occurred: 3:19:30 PM (7 occurrences)
Last logged: 3:19:30 PM

Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) implements HVACMode(s): off, heat, cool, heat_cool, dry, fan_only and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please report it to the author of the 'smartir' custom integration



Logger: homeassistant.components.climate
Source: components/climate/__init__.py:361
integration: Climate (documentation, issues)
First occurred: 4:41:50 PM (4 occurrences)
Last logged: 4:41:51 PM

Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) does not set ClimateEntityFeature.TURN_OFF but implements the turn_off method. Please report it to the author of the 'smartir' custom integration
Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) does not set ClimateEntityFeature.TURN_ON but implements the turn_on method. Please report it to the author of the 'smartir' custom integration
Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) implements HVACMode(s): off, heat, cool, heat_cool, dry, fan_only and therefore implicitly supports the turn_on/turn_off methods without setting the proper ClimateEntityFeature. Please report it to the author of the 'smartir' custom integration
Entity climate.heating_dhw (<class 'custom_components.climate_template.climate.TemplateClimate'>) implements HVACMode(s): heat, 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/jcwillox/hass-template-climate/issues




Logger: homeassistant.helpers.entity
Source: helpers/entity.py:1597
First occurred: 4:41:50 PM (1 occurrences)
Last logged: 4:41:50 PM

Entity None (<class 'custom_components.smartir.climate.SmartIRClimate'>) 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 report it to the author of the 'smartir' custom integration and reference https://developers.home-assistant.io/blog/2023/12/28/support-feature-magic-numbers-deprecation




Logger: homeassistant.components.climate.const
Source: helpers/deprecation.py:205
integration: Climate (documentation, issues)
First occurred: 4:41:49 PM (9 occurrences)
Last logged: 4:41:49 PM

HVAC_MODE_FAN_ONLY was used from smartir, 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 'smartir' custom integration
HVAC_MODE_AUTO was used from smartir, 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 'smartir' custom integration
SUPPORT_TARGET_TEMPERATURE was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use ClimateEntityFeature.TARGET_TEMPERATURE instead, please report it to the author of the 'smartir' custom integration
SUPPORT_FAN_MODE was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use ClimateEntityFeature.FAN_MODE instead, please report it to the author of the 'smartir' custom integration
SUPPORT_SWING_MODE was used from smartir, this is a deprecated constant which will be removed in HA Core 2025.1. Use ClimateEntityFeature.SWING_MODE instead, please report it to the author of the 'smartir' custom integration

@vassilis-panos
Copy link
Member

What _enable_turn_on_off_backwards_compatibility = False is?

@ThanhCN0
Copy link

ThanhCN0 commented Apr 6, 2024

What _enable_turn_on_off_backwards_compatibility = False is?

It appears to be a flag required for to stop the warnings, needed only until the 2025.1 release.
https://developers.home-assistant.io/blog/2024/01/24/climate-climateentityfeatures-expanded/#:~:text=Integrations%20should%20set,deprecation%20has%20ended.

@litinoveweedle
Copy link
Author

Hello,

unfortunately HA compatibility check are implemented incorrectly. So without stopping the check by explicitly setting:

_enable_turn_on_off_backwards_compatibility = False

errors and warning are still present even if compatibility is fixed, see those reports

But anyway when proposed compatibility changes are implemented in the integration, it is mandatory to set the flag to false as check are not needed anymore.

Honestly I would today put the flag into init code differently, probably as:

self._enable_turn_on_off_backwards_compatibility = False

inside of:

def __init__(self, hass, config, device_data):

so please to move it few lines down as it make better sense. ;-)

@litinoveweedle litinoveweedle deleted the HA_climate_compatibility branch June 1, 2024 22:48
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.

None yet

3 participants