mirror of
https://github.com/home-assistant/core.git
synced 2025-07-20 19:57:07 +00:00
Using call_from_config in Universal Media Player
Changed universal media player to use the call_from_config helper to call services specified in the configuration file. This was done to copy what is done in the Alexa and Automation components.
This commit is contained in:
parent
59456f20fb
commit
ee4543d739
@ -12,6 +12,7 @@ from copy import copy
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from homeassistant.helpers.event import track_state_change
|
from homeassistant.helpers.event import track_state_change
|
||||||
|
from homeassistant.helpers.service import call_from_config
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
STATE_IDLE, STATE_ON, STATE_OFF, CONF_NAME,
|
STATE_IDLE, STATE_ON, STATE_OFF, CONF_NAME,
|
||||||
@ -178,11 +179,8 @@ class UniversalMediaPlayer(MediaPlayerDevice):
|
|||||||
def _override_or_child_service(self, service_name, **service_data):
|
def _override_or_child_service(self, service_name, **service_data):
|
||||||
""" calls either a specified or active child's service """
|
""" calls either a specified or active child's service """
|
||||||
if service_name in self._cmds:
|
if service_name in self._cmds:
|
||||||
cmd_data = self._cmds[service_name]
|
call_from_config(
|
||||||
domain, service = cmd_data[CONF_SERVICE].split('.', 1)
|
self.hass, self._cmds[service_name], blocking=True)
|
||||||
self.hass.services.call(domain, service,
|
|
||||||
cmd_data[CONF_SERVICE_DATA],
|
|
||||||
blocking=True)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
self._child_service(service_name, **service_data)
|
self._child_service(service_name, **service_data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user