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

fix(alarm): address HA 2025.x deprecations #171

Merged
merged 5 commits into from
Nov 14, 2024

Conversation

andreapier
Copy link
Contributor

@andreapier andreapier commented Nov 11, 2024

Related Issues

Proposed Changes:

I recently started to look into this component and noticed that it is notifying a few deprecations, so I thought I could help fixing those

Testing:

This only relates to HA changes so no new test is needed (in my opinion)

Extra Notes (optional):

The deprecations I fixed are:

  • Added respx package, otherwise tests were not running at all (I believe this was introduced in HA 2014.8), commit 8a78ef3
  • STATE_ALARM_ARMED_AWAY was used from , this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.ARMED_AWAY instead (fixed in commit 96c62d7)
  • Detected code that uses async_config_entry_first_refresh, which is only supported when entry state is ConfigEntryState.SETUP_IN_PROGRESS, but it is in state ConfigEntryState.NOT_LOADED, This will stop working in Home Assistant 2025.11 (fixed in b709f13)
  • Detected that custom integration calls async_forward_entry_setup for integration, econnect_metronet with title: e-Connect/Metronet Alarm and entry_id: , which is deprecated and will stop working in Home Assistant 2025.6, await async_forward_entry_setups instead at custom_components/econnect_metronet/init.py, line 136 (fixed in commit 5b07471)
  • <class 'custom_components.econnect_metronet.alarm_control_panel.EconnectAlarm'>) is setting state directly which will stop working in HA Core 2025.11. Entities should implement the 'alarm_state' property and return its state using the AlarmControlPanelState enum, please report it to the custom integration author (fixed in commit 65118ca)

One thing I was not sure about (but figured out I would try and if you don't agree I could go back and fix it) is about "Fix alarm_state deprecation for HA Core 2025.11". Before my changes the state was "unavailable" before the first state update. Now it is None (we can now only return enum values defined in AlarmControlPanelState, and there is no value for unedefined).
Is it ok for you?

Checklist

  • Related issues and proposed changes are filled
  • Tests are defining the correct and expected behavior
  • Code is well-documented via docstrings

@palazzem
Copy link
Owner

Thank you very much @andreapier ! I'll take a look at it today, so when it's ready I can ship a new release! Thank you very much for looking into this!

@coveralls
Copy link

coveralls commented Nov 11, 2024

Pull Request Test Coverage Report for Build 11775441334

Details

  • 15 of 16 (93.75%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.6%) to 91.226%

Changes Missing Coverage Covered Lines Changed/Added Lines %
custom_components/econnect_metronet/init.py 0 1 0.0%
Totals Coverage Status
Change from base Build 9319809415: -0.6%
Covered Lines: 707
Relevant Lines: 775

💛 - Coveralls

@andreapier
Copy link
Contributor Author

Thank you very much @andreapier ! I'll take a look at it today, so when it's ready I can ship a new release! Thank you very much for looking into this!

Hi, any news?

@palazzem
Copy link
Owner

Hello @andreapier ! I've scheduled time tomorrow morning, as I would like to fix other things after reviewing your PR and ship a new version. I'll give you feedback as soon as tomorrow morning! Thanks again!

@palazzem palazzem changed the title Fix alarm panel deprecations fix(alarm): address HA 2025.x deprecations Nov 14, 2024
@palazzem palazzem added this to the 2.4.1 milestone Nov 14, 2024
Copy link
Owner

@palazzem palazzem left a comment

Choose a reason for hiding this comment

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

Thank you very much for addressing these deprecations! Your changes look good, and I only left two questions before we can merge. Regarding GitHub actions:

  • Coveralls fails, but it's because you removed 2 untested lines and then you added 1 new line (ref) so we can ignore the fact it fails
  • I run all other actions and they pass, I don't know why GitHub is not getting the result

Anyway, if you can just answer both questions to be 100% sure, I'll merge everything and will start the release process. Thank you again!

pyproject.toml Show resolved Hide resolved
tests/conftest.py Show resolved Hide resolved
Copy link
Owner

@palazzem palazzem left a comment

Choose a reason for hiding this comment

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

Everything looks good, thanks for taking the time to investigate these deprecations, taking the time to do the change and for answering my questions!

I'm going to ship a 2.4.1 beta before the final release just to do some testing before a stable release. Also, feel free to join our Discord channel as I'm easy to reach out there! https://discord.gg/NSmAPWw8tE

Thanks again!

@palazzem palazzem merged commit 88491c7 into palazzem:main Nov 14, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

calls async_forward_entry_setup (deprecation)
3 participants