Skip to content

Context not being passed to service.call #711

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
jmot205 opened this issue Apr 2, 2025 · 0 comments
Open

Context not being passed to service.call #711

jmot205 opened this issue Apr 2, 2025 · 0 comments

Comments

@jmot205
Copy link

jmot205 commented Apr 2, 2025

I've had an ongoing issue where the context is not passed to service.call in my scripts - i.e. the logbook for a light turned on by a script or automation just reads like follows instead of including the extra information about what called it:

MyLamp turned on triggered by action Light: Turn on

But as of d0745ea I understand that the context should be automatically passed into the service.call method by the function update inside pyscript.function.Function that maps over the Function.service_call method:
cls.functions.update( { ... "service.call": cls.service_call, ... } )

Any ideas why this is not being passed through correctly? What's more is the function update of service.call seems not even to be applied, because if I explicitly pass in an example context={} to service.call I get the following error message:
Exception in <file.my_functions.light_store> line 110: service.call(self.domain(), action, context={}, **service_data) ^ MultipleInvalid: extra keys not allowed @ data['context']

So it seems that service.call doesn't want to accept a context kwarg either, let alone not populating it automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant