mirror of
https://github.com/home-assistant/core
synced 2024-10-04 07:58:43 +02:00
Pass context to on/off scripts (#40254)
This commit is contained in:
parent
2d08708c3b
commit
11bbc14530
@ -208,7 +208,7 @@ class LgTVDevice(MediaPlayerEntity):
|
||||
def turn_on(self):
|
||||
"""Turn on the media player."""
|
||||
if self._on_action_script:
|
||||
self._on_action_script.run()
|
||||
self._on_action_script.run(context=self._context)
|
||||
|
||||
def volume_up(self):
|
||||
"""Volume up the media player."""
|
||||
|
@ -96,7 +96,7 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
class PhilipsTVMediaPlayer(MediaPlayerEntity):
|
||||
"""Representation of a Philips TV exposing the JointSpace API."""
|
||||
|
||||
def __init__(self, tv, name, on_script):
|
||||
def __init__(self, tv: PhilipsTV, name: str, on_script: Script):
|
||||
"""Initialize the Philips TV."""
|
||||
self._tv = tv
|
||||
self._name = name
|
||||
@ -193,7 +193,7 @@ class PhilipsTVMediaPlayer(MediaPlayerEntity):
|
||||
def turn_on(self):
|
||||
"""Turn on the device."""
|
||||
if self._on_script:
|
||||
self._on_script.run()
|
||||
self._on_script.run(context=self._context)
|
||||
self._update_soon(DELAY_ACTION_ON)
|
||||
|
||||
def turn_off(self):
|
||||
|
@ -117,7 +117,7 @@ class WolSwitch(SwitchEntity):
|
||||
def turn_off(self, **kwargs):
|
||||
"""Turn the device off if an off action is present."""
|
||||
if self._off_script is not None:
|
||||
self._off_script.run()
|
||||
self._off_script.run(context=self._context)
|
||||
|
||||
def update(self):
|
||||
"""Check if device is on and update the state."""
|
||||
|
Loading…
Reference in New Issue
Block a user