Use shorthand attrs in template integration (#100301)

This commit is contained in:
Jan Bouwhuis 2023-09-13 19:30:43 +02:00 committed by GitHub
parent d17957ac1a
commit 0d33cba823
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 87 deletions

View file

@ -14,7 +14,6 @@ from homeassistant.components.binary_sensor import (
DOMAIN as BINARY_SENSOR_DOMAIN,
ENTITY_ID_FORMAT,
PLATFORM_SCHEMA,
BinarySensorDeviceClass,
BinarySensorEntity,
)
from homeassistant.config_entries import ConfigEntry
@ -236,9 +235,7 @@ class BinarySensorTemplate(TemplateEntity, BinarySensorEntity, RestoreEntity):
ENTITY_ID_FORMAT, object_id, hass=hass
)
self._device_class: BinarySensorDeviceClass | None = config.get(
CONF_DEVICE_CLASS
)
self._attr_device_class = config.get(CONF_DEVICE_CLASS)
self._template = config[CONF_STATE]
self._state: bool | None = None
self._delay_cancel = None
@ -321,11 +318,6 @@ class BinarySensorTemplate(TemplateEntity, BinarySensorEntity, RestoreEntity):
"""Return true if sensor is on."""
return self._state
@property
def device_class(self) -> BinarySensorDeviceClass | None:
"""Return the sensor class of the binary sensor."""
return self._device_class
class TriggerBinarySensorEntity(TriggerEntity, BinarySensorEntity, RestoreEntity):
"""Sensor entity based on trigger data."""