Cleanup redundant mqtt entity constructors (#100939)

* Remove redundant mqtt entity constructors

* Remove unrelated change

* Follow up comment

* Revert changes to mqtt update platform

---------

Co-authored-by: J. Nick Koston <nick@koston.org>
This commit is contained in:
Jan Bouwhuis 2023-09-26 23:03:11 +02:00 committed by GitHub
parent d387308f3c
commit 59a26010ba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 27 additions and 275 deletions

View file

@ -130,22 +130,12 @@ class MqttSensor(MqttEntity, RestoreSensor):
_entity_id_format = ENTITY_ID_FORMAT
_attr_last_reset: datetime | None = None
_attributes_extra_blocked = MQTT_SENSOR_ATTRIBUTES_BLOCKED
_expiration_trigger: CALLBACK_TYPE | None = None
_expire_after: int | None
_expired: bool | None
_template: Callable[[ReceivePayloadType, PayloadSentinel], ReceivePayloadType]
_last_reset_template: Callable[[ReceivePayloadType], ReceivePayloadType]
def __init__(
self,
hass: HomeAssistant,
config: ConfigType,
config_entry: ConfigEntry,
discovery_data: DiscoveryInfoType | None,
) -> None:
"""Initialize the sensor."""
self._expiration_trigger: CALLBACK_TYPE | None = None
MqttEntity.__init__(self, hass, config, config_entry, discovery_data)
async def mqtt_async_added_to_hass(self) -> None:
"""Restore state for entities with expire_after set."""
last_state: State | None