mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 14:17:45 +00:00
Make sonos binary sensor entity creation callback functions (#113109)
This commit is contained in:
parent
629a045c37
commit
0c877339ca
@ -11,7 +11,7 @@ from homeassistant.components.binary_sensor import (
|
||||
)
|
||||
from homeassistant.config_entries import ConfigEntry
|
||||
from homeassistant.const import EntityCategory
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.core import HomeAssistant, callback
|
||||
from homeassistant.helpers.dispatcher import async_dispatcher_connect
|
||||
from homeassistant.helpers.entity_platform import AddEntitiesCallback
|
||||
|
||||
@ -32,12 +32,14 @@ async def async_setup_entry(
|
||||
) -> None:
|
||||
"""Set up Sonos from a config entry."""
|
||||
|
||||
async def _async_create_battery_entity(speaker: SonosSpeaker) -> None:
|
||||
@callback
|
||||
def _async_create_battery_entity(speaker: SonosSpeaker) -> None:
|
||||
_LOGGER.debug("Creating battery binary_sensor on %s", speaker.zone_name)
|
||||
entity = SonosPowerEntity(speaker)
|
||||
async_add_entities([entity])
|
||||
|
||||
async def _async_create_mic_entity(speaker: SonosSpeaker) -> None:
|
||||
@callback
|
||||
def _async_create_mic_entity(speaker: SonosSpeaker) -> None:
|
||||
_LOGGER.debug("Creating microphone binary_sensor on %s", speaker.zone_name)
|
||||
async_add_entities([SonosMicrophoneSensorEntity(speaker)])
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user