nielsfaber / alarmo

Easy to use alarm system integration for Home Assistant
1.41k stars 119 forks source link

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

Open Hedda opened 4 weeks ago

Hedda commented 4 weeks ago

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

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 commented 4 weeks ago

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

tomlut commented 3 weeks ago

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 commented 3 weeks ago

@tomlut

There's more that will break in 2024.11

You mean 2025.11 🙂

tomlut commented 3 weeks ago

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

Would you like me to open a separate issue?

mogultekin commented 1 week ago

Also the names of the notifications are ordered by name. The newly added notifications always appears at the end of the list. The workaround lets you to save the notification.

Hedda commented 1 week ago

Also the names of the notifications are ordered by name. The newly added notifications always appears at the end of the list. The workaround lets you to save the notification.

FYI, sounds like there is ongoing work to rewrite notify, see architecture discussion and PR links here: