Migrate to async_get_current_platform everywhere (#50034)
This commit is contained in:
parent
672d2e332f
commit
2ed386f9e6
69 changed files with 71 additions and 76 deletions
|
@ -70,7 +70,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
entities.append(AdvantageAirZone(instance, ac_key, zone_key))
|
||||
async_add_entities(entities)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
ADVANTAGE_AIR_SERVICE_SET_MYZONE,
|
||||
{},
|
||||
|
|
|
@ -33,7 +33,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
entities.append(AdvantageAirZoneSignal(instance, ac_key, zone_key))
|
||||
async_add_entities(entities)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
ADVANTAGE_AIR_SERVICE_SET_TIME_TO,
|
||||
{vol.Required("minutes"): cv.positive_int},
|
||||
|
|
|
@ -59,7 +59,7 @@ async def async_setup_entry(
|
|||
|
||||
async_add_entities(cameras)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
for service, method in CAMERA_SERVICES.items():
|
||||
platform.async_register_entity_service(service, {}, method)
|
||||
|
||||
|
|
|
@ -56,8 +56,7 @@ async def async_setup_entry(
|
|||
)
|
||||
async_add_entities([entity])
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_ALARM_TOGGLE_CHIME,
|
||||
{
|
||||
|
|
|
@ -261,7 +261,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
if hass.services.has_service(ANDROIDTV_DOMAIN, SERVICE_ADB_COMMAND):
|
||||
return
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
async def service_adb_command(service):
|
||||
"""Dispatch service calls to target entities."""
|
||||
|
|
|
@ -21,7 +21,7 @@ async def async_setup_entry(hass, config, async_add_entities):
|
|||
|
||||
async_add_entities(entities)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(SERVICE_TRIGGER, {}, "trigger_camera")
|
||||
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
device = ChannelsPlayer(config[CONF_NAME], config[CONF_HOST], config[CONF_PORT])
|
||||
async_add_entities([device], True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SEEK_FORWARD,
|
||||
|
|
|
@ -63,7 +63,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities) -> None:
|
|||
gateway = get_gateway_from_config_entry(hass, config_entry)
|
||||
gateway.entities[DOMAIN] = set()
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
@callback
|
||||
def async_add_alarm_control_panel(sensors=gateway.api.sensors.values()) -> None:
|
||||
|
|
|
@ -113,7 +113,7 @@ async def async_setup_entry(
|
|||
)
|
||||
|
||||
# Register additional services
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_GET_COMMAND,
|
||||
{vol.Required(ATTR_COMMAND): cv.string},
|
||||
|
|
|
@ -122,7 +122,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(hass.data[DYSON_FAN_DEVICES])
|
||||
|
||||
# Register custom services
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_NIGHT_MODE, SET_NIGHT_MODE_SCHEMA, "set_night_mode"
|
||||
)
|
||||
|
|
|
@ -181,7 +181,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
|
||||
async_add_entities(devices, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
def create_vacation_service(service):
|
||||
"""Create a vacation on the target thermostat."""
|
||||
|
|
|
@ -65,7 +65,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
create_elk_entities(elk_data, elk.areas, "area", ElkArea, entities)
|
||||
async_add_entities(entities, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_ALARM_ARM_VACATION,
|
||||
|
|
|
@ -39,7 +39,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
create_elk_entities(elk_data, elk.zones, "zone", ElkZone, entities)
|
||||
async_add_entities(entities, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SENSOR_COUNTER_REFRESH,
|
||||
|
|
|
@ -72,7 +72,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
projector, config_entry.title, unique_id
|
||||
)
|
||||
async_add_entities([projector_entity], True)
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SELECT_CMODE,
|
||||
{vol.Required(ATTR_CMODE): vol.All(cv.string, vol.Any(*CMODE_LIST_SET))},
|
||||
|
|
|
@ -31,7 +31,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
entities.append(FloSwitch(device))
|
||||
async_add_entities(entities)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_AWAY_MODE, {}, "async_set_mode_away"
|
||||
|
|
|
@ -90,7 +90,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Add a Foscam IP camera from a config entry."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_PTZ,
|
||||
{
|
||||
|
|
|
@ -44,7 +44,7 @@ async def async_setup_platform(
|
|||
)
|
||||
|
||||
# Register custom services
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SVC_SET_SWITCH_OVERRIDE,
|
||||
|
|
|
@ -42,7 +42,7 @@ async def async_setup_entry(
|
|||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up Guardian switches based on a config entry."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
for service_name, schema, method in [
|
||||
(SERVICE_DISABLE_AP, {}, "async_disable_ap"),
|
||||
|
|
|
@ -70,7 +70,7 @@ async def async_setup_entry(
|
|||
device = HarmonyRemote(data, default_activity, delay_secs, harmony_conf_file)
|
||||
async_add_entities([device])
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SYNC,
|
||||
|
|
|
@ -67,7 +67,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
entities.append(HiveClimateEntity(hive, dev))
|
||||
async_add_entities(entities, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
"boost_heating",
|
||||
|
|
|
@ -53,7 +53,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
entities.append(HiveWaterHeater(hive, dev))
|
||||
async_add_entities(entities, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_BOOST_HOT_WATER,
|
||||
|
|
|
@ -159,7 +159,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
return
|
||||
|
||||
# Store platform for later.
|
||||
platform = hass.data[DATA_PLATFORM] = entity_platform.current_platform.get()
|
||||
platform = hass.data[DATA_PLATFORM] = entity_platform.async_get_current_platform()
|
||||
|
||||
async def reload_config(call):
|
||||
"""Reload the scene config."""
|
||||
|
|
|
@ -405,7 +405,7 @@ def async_unload_services(hass: HomeAssistant):
|
|||
@callback
|
||||
def async_setup_light_services(hass: HomeAssistant):
|
||||
"""Create device-specific services for the ISY Integration."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_ON_LEVEL, SERVICE_SET_VALUE_SCHEMA, SERVICE_SET_ON_LEVEL
|
||||
|
|
|
@ -97,7 +97,7 @@ async def async_setup_entry(
|
|||
# connect to register any further components
|
||||
async_dispatcher_connect(hass, DISPATCH_CONTROLLER_DISCOVERED, init_controller)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
IZONE_SERVICE_AIRFLOW_MIN,
|
||||
IZONE_SERVICE_AIRFLOW_SCHEMA,
|
||||
|
|
|
@ -146,7 +146,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
hass.data[DOMAIN][host] = media_player
|
||||
async_add_entities([media_player], update_before_add=True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_MODE,
|
||||
|
|
|
@ -226,7 +226,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up the Kodi media player platform."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_ADD_MEDIA, KODI_ADD_MEDIA_SCHEMA, "async_add_media_to_playlist"
|
||||
)
|
||||
|
|
|
@ -175,7 +175,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
# Priority 3: default interface
|
||||
interfaces = [{}]
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
lifx_manager = LIFXManager(hass, platform, async_add_entities)
|
||||
hass.data[DATA_LIFX_MANAGER] = lifx_manager
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ async def async_setup_entry(
|
|||
|
||||
async_add_entities(entities, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_RESET_WASTE_DRAWER,
|
||||
{},
|
||||
|
|
|
@ -105,7 +105,7 @@ async def async_setup_entry(
|
|||
|
||||
async_add_entities(entities, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_HOLD_TIME,
|
||||
|
|
|
@ -84,7 +84,7 @@ async def async_setup_entry(
|
|||
True,
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_VANE_HORIZONTAL,
|
||||
{vol.Required(CONF_POSITION): cv.string},
|
||||
|
|
|
@ -82,7 +82,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
first_run = hass.data[DOMAIN][config_entry.entry_id][FIRST_RUN]
|
||||
async_add_entities(entities, first_run)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
def _call_service(entities, service_call):
|
||||
for entity in entities:
|
||||
|
|
|
@ -116,7 +116,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
|
||||
async_add_entities(entities)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_ABSOLUTE_POSITION,
|
||||
SET_ABSOLUTE_POSITION_SCHEMA,
|
||||
|
|
|
@ -87,7 +87,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
_LOGGER.debug("Adding vacuums %s", dev)
|
||||
async_add_entities(dev, True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
assert platform is not None
|
||||
|
||||
platform.async_register_entity_service(
|
||||
|
|
|
@ -99,7 +99,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
|
||||
await data_handler.unregister_data_class(CAMERA_DATA_CLASS_NAME, None)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_PERSONS_HOME,
|
||||
|
|
|
@ -158,7 +158,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
|
||||
await data_handler.unregister_data_class(HOMEDATA_DATA_CLASS_NAME, None)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
if home_data is not None:
|
||||
platform.async_register_entity_service(
|
||||
|
|
|
@ -108,7 +108,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
nexia_home = nexia_data[NEXIA_DEVICE]
|
||||
coordinator = nexia_data[UPDATE_COORDINATOR]
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_HUMIDIFY_SETPOINT,
|
||||
|
|
|
@ -50,9 +50,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
)
|
||||
async_add_entities(entities)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
assert platform is not None
|
||||
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
"lock_n_go",
|
||||
{
|
||||
|
|
|
@ -65,7 +65,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
entity = NX584Alarm(name, alarm_client, url)
|
||||
async_add_entities([entity])
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_BYPASS_ZONE,
|
||||
|
|
|
@ -47,7 +47,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(entities)
|
||||
|
||||
# register service
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_SPEED,
|
||||
|
|
|
@ -44,7 +44,7 @@ from .const import (
|
|||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up the ONVIF camera video stream."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
# Create PTZ service
|
||||
platform.async_register_entity_service(
|
||||
|
|
|
@ -53,7 +53,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities([entity])
|
||||
openhome_data.add(device.Uuid())
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_INVOKE_PIN,
|
||||
|
|
|
@ -37,7 +37,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
async_dispatcher_connect(hass, f"{DOMAIN}_new_{LOCK_DOMAIN}", async_add_lock)
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_USERCODE,
|
||||
|
|
|
@ -35,7 +35,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
async_add_entities(switches, True)
|
||||
|
||||
# register service
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_DISABLE,
|
||||
{
|
||||
|
|
|
@ -140,7 +140,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
|
||||
if has_flex_sched:
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_ZONE_MOISTURE,
|
||||
{vol.Required(ATTR_PERCENT): cv.positive_int},
|
||||
|
|
|
@ -113,7 +113,7 @@ async def async_setup_entry(
|
|||
hass: HomeAssistant, entry: ConfigEntry, async_add_entities: AddEntitiesCallback
|
||||
) -> None:
|
||||
"""Set up RainMachine switches based on a config entry."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
alter_program_schema = {vol.Required(CONF_PROGRAM_ID): cv.positive_int}
|
||||
alter_zone_schema = {vol.Required(CONF_ZONE_ID): cv.positive_int}
|
||||
|
|
|
@ -14,7 +14,7 @@ SERVICE_UNBYPASS_ZONE = "unbypass_zone"
|
|||
|
||||
async def async_setup_entry(hass, config_entry, async_add_entities):
|
||||
"""Set up the Risco alarm control panel."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(SERVICE_BYPASS_ZONE, {}, "async_bypass_zone")
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_UNBYPASS_ZONE, {}, "async_unbypass_zone"
|
||||
|
|
|
@ -66,7 +66,7 @@ async def async_setup_entry(hass, entry, async_add_entities):
|
|||
unique_id = coordinator.data.info.serial_number
|
||||
async_add_entities([RokuMediaPlayer(unique_id, coordinator)], True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SEARCH,
|
||||
|
|
|
@ -72,7 +72,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
media_players = set()
|
||||
|
||||
# Register entity services
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_TRANSFER,
|
||||
{vol.Required(ATTR_TRANSFER): cv.entity_id},
|
||||
|
|
|
@ -58,7 +58,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
host = config.get(CONF_HOST)
|
||||
port = config.get(CONF_PORT, CONTROL_PORT)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(SERVICE_SNAPSHOT, {}, "snapshot")
|
||||
platform.async_register_entity_service(SERVICE_RESTORE, {}, "async_restore")
|
||||
platform.async_register_entity_service(
|
||||
|
|
|
@ -82,7 +82,7 @@ async def async_setup_entry(
|
|||
songpal_entity = SongpalEntity(name, device)
|
||||
async_add_entities([songpal_entity], True)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SET_SOUND_SETTING,
|
||||
{vol.Required(PARAM_NAME): cv.string, vol.Required(PARAM_VALUE): cv.string},
|
||||
|
|
|
@ -151,7 +151,7 @@ async def async_setup_entry(
|
|||
async_add_entities: AddEntitiesCallback,
|
||||
) -> None:
|
||||
"""Set up Sonos from a config entry."""
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
@callback
|
||||
def async_create_entities(speaker: SonosSpeaker) -> None:
|
||||
|
|
|
@ -210,7 +210,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
asyncio.create_task(_discovery())
|
||||
|
||||
# Register entity services
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_CALL_METHOD,
|
||||
{
|
||||
|
|
|
@ -91,7 +91,7 @@ async def async_setup_platform(
|
|||
device_data = hass.data[DOMAIN][DATA_DEVICE]
|
||||
async_add_entities([SwitcherControl(hass.data[DOMAIN][DATA_DEVICE])])
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_AUTO_OFF_NAME,
|
||||
|
|
|
@ -81,7 +81,7 @@ async def async_setup_entry(
|
|||
tado = hass.data[DOMAIN][entry.entry_id][DATA]
|
||||
entities = await hass.async_add_executor_job(_generate_entities, tado)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_CLIMATE_TIMER,
|
||||
|
|
|
@ -68,7 +68,7 @@ async def async_setup_entry(
|
|||
tado = hass.data[DOMAIN][entry.entry_id][DATA]
|
||||
entities = await hass.async_add_executor_job(_generate_entities, tado)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_WATER_HEATER_TIMER,
|
||||
|
|
|
@ -27,7 +27,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
UpbLight(upb.devices[dev], unique_id, upb) for dev in upb.devices
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_LIGHT_FADE_START, UPB_BRIGHTNESS_RATE_SCHEMA, "async_light_fade_start"
|
||||
|
|
|
@ -20,7 +20,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
unique_id = config_entry.entry_id
|
||||
async_add_entities(UpbLink(upb.links[link], unique_id, upb) for link in upb.links)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_LINK_DEACTIVATE, {}, "async_link_deactivate"
|
||||
|
|
|
@ -94,7 +94,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
|
||||
async_add_entities(meters)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_CALIBRATE_METER,
|
||||
|
|
|
@ -13,7 +13,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import EVENT_HOMEASSISTANT_STOP
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.entity_platform import current_platform
|
||||
from homeassistant.helpers.entity_platform import async_get_current_platform
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import CONF_GIID, DOMAIN, LOGGER, SERVICE_CAPTURE_SMARTCAM
|
||||
|
@ -28,7 +28,7 @@ async def async_setup_entry(
|
|||
"""Set up Verisure sensors based on a config entry."""
|
||||
coordinator: VerisureDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
platform = current_platform.get()
|
||||
platform = async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_CAPTURE_SMARTCAM,
|
||||
{},
|
||||
|
|
|
@ -12,7 +12,7 @@ from homeassistant.config_entries import ConfigEntry
|
|||
from homeassistant.const import ATTR_CODE, STATE_LOCKED, STATE_UNLOCKED
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers.entity import DeviceInfo, Entity
|
||||
from homeassistant.helpers.entity_platform import current_platform
|
||||
from homeassistant.helpers.entity_platform import async_get_current_platform
|
||||
from homeassistant.helpers.update_coordinator import CoordinatorEntity
|
||||
|
||||
from .const import (
|
||||
|
@ -36,7 +36,7 @@ async def async_setup_entry(
|
|||
"""Set up Verisure alarm control panel from a config entry."""
|
||||
coordinator: VerisureDataUpdateCoordinator = hass.data[DOMAIN][entry.entry_id]
|
||||
|
||||
platform = current_platform.get()
|
||||
platform = async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_DISABLE_AUTOLOCK,
|
||||
{},
|
||||
|
|
|
@ -104,7 +104,7 @@ async def async_setup_platform(
|
|||
]
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_VICARE_MODE,
|
||||
|
|
|
@ -120,7 +120,7 @@ async def async_setup_entry(
|
|||
entity = VizioDevice(config_entry, device, name, device_class, apps_coordinator)
|
||||
|
||||
async_add_entities([entity], update_before_add=True)
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_UPDATE_SETTING, UPDATE_SETTING_SCHEMA, "async_update_setting"
|
||||
)
|
||||
|
|
|
@ -81,7 +81,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
]
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
# This will call WemoHumidifier.set_humidity(target_humidity=VALUE)
|
||||
platform.async_register_entity_service(
|
||||
|
|
|
@ -143,7 +143,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
"Timeout. No infrared command captured", title="Xiaomi Miio Remote"
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_LEARN,
|
||||
|
|
|
@ -150,7 +150,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
mirobo = MiroboVacuum(name, vacuum, config_entry, unique_id)
|
||||
entities.append(mirobo)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_START_REMOTE_CONTROL,
|
||||
|
|
|
@ -152,7 +152,7 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
|
|||
async_add_entities(entities)
|
||||
|
||||
# Register Service 'select_scene'
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SELECT_SCENE,
|
||||
{vol.Required(ATTR_SCENE): cv.string},
|
||||
|
|
|
@ -375,7 +375,7 @@ def _async_setup_services(hass: HomeAssistant):
|
|||
)
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_MODE,
|
||||
|
|
|
@ -50,8 +50,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
|
|||
)
|
||||
hass.data[DATA_ZHA][DATA_ZHA_DISPATCHERS].append(unsub)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
assert platform
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service( # type: ignore
|
||||
SERVICE_SET_LOCK_USER_CODE,
|
||||
|
|
|
@ -68,8 +68,7 @@ async def async_setup_entry(
|
|||
)
|
||||
)
|
||||
|
||||
platform = entity_platform.current_platform.get()
|
||||
assert platform
|
||||
platform = entity_platform.async_get_current_platform()
|
||||
|
||||
platform.async_register_entity_service(
|
||||
SERVICE_SET_LOCK_USERCODE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue