Skip to content
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

Added device_id to script function arguments #172

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

DevelopIdeas
Copy link

Allows for use of device_id inside service / script functions
Screenshot 2024-03-14 at 23 55 30

Allows for use of device_id inside service / script functions
@jekalmin
Copy link
Owner

Thanks for your contribution!

I agree that it would be a nice feature to make device_id available to use in functions.
However, it would override device_id if it's used in parameters of spec.

I think it would be better if we change two things:

  1. Create reserved word which contains any data, such as user_input or exposed_entities, needed for users. The reserved word can be something like _params, _args, or word starting with _, so that it reduces possibility of conflict. Then your function should look like this.

    - service: python_script.play_music
      data:
        device_id: '{{_params.user_input.device_id}}'
        ...
  2. Make it available not only to script function but also to any functions.
    (Probably move your code to here and here would work)

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

Successfully merging this pull request may close these issues.

2 participants