Use runtime_data in ping (#118332)

This commit is contained in:
Jan-Philipp Benecke 2024-05-29 08:12:54 +02:00 committed by GitHub
parent 76aa504e36
commit 2c99925286
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 17 additions and 29 deletions

View file

@ -20,7 +20,7 @@ from homeassistant.helpers.entity_platform import AddEntitiesCallback
from homeassistant.helpers.issue_registry import IssueSeverity, async_create_issue
from homeassistant.helpers.typing import ConfigType, DiscoveryInfoType
from . import PingDomainData
from . import PingConfigEntry
from .const import CONF_IMPORTED_BY, CONF_PING_COUNT, DEFAULT_PING_COUNT, DOMAIN
from .coordinator import PingUpdateCoordinator
from .entity import PingEntity
@ -76,13 +76,10 @@ async def async_setup_platform(
async def async_setup_entry(
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
hass: HomeAssistant, entry: PingConfigEntry, async_add_entities: AddEntitiesCallback
) -> None:
"""Set up a Ping config entry."""
data: PingDomainData = hass.data[DOMAIN]
async_add_entities([PingBinarySensor(entry, data.coordinators[entry.entry_id])])
async_add_entities([PingBinarySensor(entry, entry.runtime_data)])
class PingBinarySensor(PingEntity, BinarySensorEntity):