Change unnecessary Sonos coroutine to callback (#60643)

This commit is contained in:
jjlawren 2021-11-30 10:35:29 -06:00 committed by GitHub
parent 97c04d2e67
commit de9e48174f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,6 +3,7 @@ from __future__ import annotations
from homeassistant.components.number import NumberEntity from homeassistant.components.number import NumberEntity
from homeassistant.const import ENTITY_CATEGORY_CONFIG from homeassistant.const import ENTITY_CATEGORY_CONFIG
from homeassistant.core import callback
from homeassistant.helpers.dispatcher import async_dispatcher_connect from homeassistant.helpers.dispatcher import async_dispatcher_connect
from .const import SONOS_CREATE_LEVELS from .const import SONOS_CREATE_LEVELS
@ -16,7 +17,8 @@ LEVEL_TYPES = ("bass", "treble")
async def async_setup_entry(hass, config_entry, async_add_entities): async def async_setup_entry(hass, config_entry, async_add_entities):
"""Set up the Sonos number platform from a config entry.""" """Set up the Sonos number platform from a config entry."""
async def _async_create_entities(speaker: SonosSpeaker) -> None: @callback
def _async_create_entities(speaker: SonosSpeaker) -> None:
entities = [] entities = []
for level_type in LEVEL_TYPES: for level_type in LEVEL_TYPES:
entities.append(SonosLevelEntity(speaker, level_type)) entities.append(SonosLevelEntity(speaker, level_type))