Remove ToggleEntity inheritance from Alert (#80185)

This commit is contained in:
Franck Nijhof 2022-10-12 20:13:05 +02:00 committed by GitHub
parent c6340856e9
commit fc32071562
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,7 +3,7 @@ from __future__ import annotations
from collections.abc import Callable from collections.abc import Callable
from datetime import timedelta from datetime import timedelta
from typing import Any, final from typing import Any
import voluptuous as vol import voluptuous as vol
@ -29,7 +29,7 @@ from homeassistant.const import (
from homeassistant.core import Event, HomeAssistant, ServiceCall from homeassistant.core import Event, HomeAssistant, ServiceCall
from homeassistant.helpers import service from homeassistant.helpers import service
import homeassistant.helpers.config_validation as cv import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import ToggleEntity from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import ( from homeassistant.helpers.event import (
async_track_point_in_time, async_track_point_in_time,
async_track_state_change_event, async_track_state_change_event,
@ -164,7 +164,7 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
return True return True
class Alert(ToggleEntity): class Alert(Entity):
"""Representation of an alert.""" """Representation of an alert."""
_attr_should_poll = False _attr_should_poll = False
@ -220,10 +220,8 @@ class Alert(ToggleEntity):
hass, [watched_entity_id], self.watched_entity_change hass, [watched_entity_id], self.watched_entity_change
) )
@final # type: ignore[misc]
@property @property
# pylint: disable=overridden-final-method def state(self) -> str:
def state(self) -> str: # type: ignore[override]
"""Return the alert status.""" """Return the alert status."""
if self._firing: if self._firing:
if self._ack: if self._ack: