Skip to content

Makes alarm_control_panels more flexible on Android auto#6374

Open
poupounetjoyeux wants to merge 5 commits intohome-assistant:mainfrom
poupounetjoyeux:main
Open

Makes alarm_control_panels more flexible on Android auto#6374
poupounetjoyeux wants to merge 5 commits intohome-assistant:mainfrom
poupounetjoyeux:main

Conversation

@poupounetjoyeux
Copy link

@poupounetjoyeux poupounetjoyeux commented Feb 2, 2026

Summary

If alarm has code but not required for arming allows arming alarm (arm_away)

Impact only Android Auto part of the application

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

If alarm has code but not required for arming allows arming alarm
Keep the logic for disarming regarding the has code
Move the logic inside Entity.kt
Copy link

@home-assistant home-assistant bot left a comment

Choose a reason for hiding this comment

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

Hi @poupounetjoyeux

It seems you haven't yet signed a CLA. Please do so here.

Once you do that we will be able to review and accept this pull request.

Thanks!

@home-assistant home-assistant bot marked this pull request as draft February 2, 2026 20:08
@home-assistant
Copy link

home-assistant bot commented Feb 2, 2026

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

@jpelgrom
Copy link
Member

jpelgrom commented Feb 2, 2026

Please sign the CLA to proceed.

At a quick glance your check in alarmCanBeArmedWithoutCode seems to be inverted.

@poupounetjoyeux
Copy link
Author

Hello @jpelgrom,
Thank you for the quick react,
To not disturb you until the PR is really ready (want to test a little bit the default code handling from my car) I will uses the ready for review button

@poupounetjoyeux poupounetjoyeux force-pushed the main branch 2 times, most recently from b739402 to 78a971f Compare February 5, 2026 14:11
Move methods to an util class to make them simpler to test
Fix reversed condition in alarmCanBeArmedWithoutCode()
@poupounetjoyeux poupounetjoyeux marked this pull request as ready for review February 5, 2026 14:14
@poupounetjoyeux
Copy link
Author

Hello!

The change is now ready and tested

gridItem.setLoading(entity.isExecuting())
} else {
if (entity.domain !in NOT_ACTIONABLE_DOMAINS || canNavigate(entity) || alarmHasNoCode(entity)) {
if (entity.domain !in NOT_ACTIONABLE_DOMAINS || canNavigate(entity)) {
Copy link
Member

Choose a reason for hiding this comment

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

When it is not possible to interact with an entity, there should be no click listener at all.

Otherwise this can result in users not knowing why nothing is happening when they tap on it and the UI shows it was tapped, unlike other entities you cannot interact with. It also creates accessibility problems as it appears interactable while it's not.

Copy link
Member

Choose a reason for hiding this comment

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

I like the idea of adding these to a different file (Entity.kt is very long), but maybe consider

  • putting it in the same package as Entity.kt as it all requires one
  • consider making it extension functions so it is more like the other functions 'from outside'

Copy link
Author

Choose a reason for hiding this comment

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

Don't know if the new place is OK for you?

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test

class AlarmControlPanelEntityTest {
Copy link
Member

Choose a reason for hiding this comment

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

Try to rewrite your test titles using given, when, then structure.

Add some methods for more reliability
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants