Add context to scripts run by template entities (#17329)

This commit is contained in:
Paulus Schoutsen 2018-10-15 11:38:49 +02:00 committed by GitHub
parent 0bf10b0b09
commit ac79ff9e24
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 26 additions and 21 deletions

View file

@ -151,11 +151,11 @@ class SwitchTemplate(SwitchDevice):
async def async_turn_on(self, **kwargs):
"""Fire the on action."""
await self._on_script.async_run()
await self._on_script.async_run(context=self._context)
async def async_turn_off(self, **kwargs):
"""Fire the off action."""
await self._off_script.async_run()
await self._off_script.async_run(context=self._context)
async def async_update(self):
"""Update the state from the template."""