Skip to content

Commit fe0d419

Browse files
dlashuaraman325
authored andcommitted
allow context on short form service calls
1 parent b5f7b9e commit fe0d419

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

custom_components/pyscript/function.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,12 @@ def get(cls, name):
239239
return None
240240

241241
async def service_call(*args, **kwargs):
242-
await cls.hass.services.async_call(domain, service, kwargs)
242+
if "context" in kwargs and isinstance(kwargs["context"], Context):
243+
context = kwargs["context"]
244+
del kwargs["context"]
245+
await cls.hass.services.async_call(domain, service, kwargs, False, context)
246+
else:
247+
await cls.hass.services.async_call(domain, service, kwargs)
243248

244249
return service_call
245250

0 commit comments

Comments
 (0)