Skip to content

Context not being passed to service.call #711

Open
@jmot205

Description

@jmot205

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions