-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
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
Support Konnected Pro alarm panel, embrace async, leverage latest HA features/architecture #30894
Support Konnected Pro alarm panel, embrace async, leverage latest HA features/architecture #30894
Conversation
This pull request needs to be manually signed off by @balloob before it can get merged. |
Hey there @heythisisnate, mind taking a look at this pull request as its been labeled with a integration ( |
This PR is too big to be reviewed in one piece. Please break it up into multiple sequential PRs. I suggest this order.
|
@MartinHjelmare Understand the request. I'm concerned about the feasibility of breaking this into multiple PR's while maintaining functionality. Several of the changes have circular dependencies on others. The previous discovery mechanism was integrated into the init module code which was migrated to the The new panel module provides the async support for the updated async konnected pypi module. All the tests were written for the refactored code (anything touched in this effort received test coverage) - non existed before. The tests will not function with the previous codebase and adding them as an independent PR would require a lot of code that would be immediately discarded. Is it possible to make an exception on reviewing this PR size knowing this is a one time large refactor that won't be repeated in future iterations of this component? |
The tests should not be written to be dependent on the implementation. If we use the core interfaces to set up the tests and don't interact with the entity directly, this will work, and we can change the implementation without changing the tests for the most part. I still think my suggested order is the best. You might have to add intermediate code to make each step work independently. In total it will still be faster to do it this way. I know from experience. Before doing anything though, we should get a green light from @balloob to work on this integration. |
Maybe change and do the refactor to panel last. I haven't looked at what that module does, so this part I'm not sure about. |
This PR is ok to move on, but Martin is right. Please first upgrade the existing integration to use a config entry, then a followup PR to add support for the Pro panel. |
I'll do the review after Konnected offered to sponsor me for that particular work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've started looking at the tests in general. As I said earlier we want to use the core interfaces. Patching should preferably be done in the periphery to make the tests robust for changes in our implementation.
I'll look at the rest now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I've looked at most of it now.
The main points are:
- Use unique_id api for config entries and flows. This will simplify a lot.
- A config flow should not store data in hass.data. The config flow should be contained besides being able to update config entry data via config entries api.
- All optional config options should be part of a separate options flow. We want the main flow to be minimal.
- Always use core interfaces to set up tests and assert state.
Going to address PR feedback via a sequence of commits. |
It's ok to store things in hass.data, but it should not be updated from the config flow. We should eg create a new client in |
@MartinHjelmare Commit 2683d28 updates the config flow to utilize the options flow and unique ID, along with addressing the test comments from the last PR. Adding extra tests and migrating sections of code is the culprit for most of the large diff. The main changes were
I'm hitting one experience issue with the options flow. The frontend doesn't support showing titles and descriptions in the options flow like it does in config flows. You can see the differences in the links below. Do you know if this is intentional? I'd like to confirm whether the options dialog could be enhanced to mimic the config flow dialog before I modify field names to replace the missing title/description. |
I don't know the frontend very well. @balloob? |
Yeah that's a frontend thing. I think my initial thinking was that all options flows are going to be one page, so why even bother asking people to set a title. Nowadays we have a couple of flows with more pages. PR to fix it: home-assistant/frontend#4598 |
708e77a
to
94c1950
Compare
Latest changes look good! I'll do another round when the config validation is updated. |
…Pro board support and tests
deea20e
to
c8f76f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
Are we ready to merge? |
@MartinHjelmare ok to merge |
Description:
This PR updates the Konnected component to support the soon to be released Konnected Alarm Panel Pro. It also brings the Konnected component up to date with the latest HA architecture and features. Notable changes are...
panel.py
).All changes are backward compatible with existing
configuration.yaml
based configs. The yaml based configs will be imported into a config entry if a matching entry does not exist.Pull request with documentation for home-assistant.io (if applicable): home-assistant/home-assistant.io#11785
Checklist:
tox
. Your PR cannot be merged unless tests passIf user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
python3 -m script.hassfest
.requirements_all.txt
by runningpython3 -m script.gen_requirements_all
..coveragerc
.If the code does not interact with devices: