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

New alarm control panel state property and state enum (new as of Home Assistant Core 2024.11) #1055

Open
2 tasks done
Hedda opened this issue Oct 29, 2024 · 4 comments
Open
2 tasks done

Comments

@Hedda
Copy link

Hedda commented Oct 29, 2024

New from the Home Assistant Developer Docs is news about "New alarm control panel state property and state enum":

As of Home Assistant Core 2024.11, we have introduced the alarm_state property in the AlarmControlPanelEntity. This newly added property should be used instead of directly setting the state property.

The new alarm_state property should return its state using the new AlarmControlPanelState enum instead of as previously, setting the state using the STATE_ALARM_* constants.

There is a one-year deprecation period, and the constants will stop working from 2025.11 to ensure all custom integration authors have time to adjust.

Example:


from homeassistant.components.alarm_control_panel import AlarmControlPanelEntity, AlarmControlPanelState

class MyAlarm(AlarmControlPanelEntity):
    """My alarm."""

    @property
    def alarm_state(self) -> AlarmControlPanelState | None:
        """Return the state of the alarm."""
        if self.device.is_on():
            return AlarmControlPanelState.ARMED_AWAY
        return AlarmControlPanelState.DISARMED

More details can be found in the alarm control panel documentation.

Checklist

  • I checked for similar existing requests (both open and closed) before posting.
  • My request is generic, other users may benefit from it too.

Proposal

[clear description of what you want to see changed or added]

Additional info

[some example of how the new functionality should look like]

@nielsfaber
Copy link
Owner

Thanks for the heads-up, I will adopt this in the upcoming release.

@tomlut
Copy link

tomlut commented Nov 3, 2024

There's more that will break in 2024.11

Logger: homeassistant.const
Source: helpers/deprecation.py:222
First occurred: 12:28:37 (36 occurrences)
Last logged: 12:28:37

STATE_ALARM_ARMED_VACATION was used from alarmo, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.ARMED_VACATION instead, please report it to the author of the 'alarmo' custom integration
STATE_ALARM_DISARMED was used from alarmo, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.DISARMED instead, please report it to the author of the 'alarmo' custom integration
STATE_ALARM_TRIGGERED was used from alarmo, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.TRIGGERED instead, please report it to the author of the 'alarmo' custom integration
STATE_ALARM_PENDING was used from alarmo, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.PENDING instead, please report it to the author of the 'alarmo' custom integration
STATE_ALARM_ARMING was used from alarmo, this is a deprecated constant which will be removed in HA Core 2025.11. Use AlarmControlPanelState.ARMING instead, please report it to the author of the 'alarmo' custom integration

@nielsfaber
Copy link
Owner

@tomlut

There's more that will break in 2024.11

You mean 2025.11 🙂

@tomlut
Copy link

tomlut commented Nov 3, 2024

I could have sworn I double checked that was 2024 🤦‍♂️

Would you like me to open a separate issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants