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

Add "execute" service #260

Merged
merged 4 commits into from
Oct 29, 2022
Merged

Add "execute" service #260

merged 4 commits into from
Oct 29, 2022

Conversation

exetico
Copy link
Member

@exetico exetico commented Oct 29, 2022

This service allow users to execute scripts, without having to call a "class_set" or simular, to clean things up - and prevent the usage of ie "none.none" service.

Usage is simple as:

hold_action:
  - action: call-service
    service: floorplan.execute
    service_data:
      bob: |
        > console.log("Here we go again...");
        dwojwo
        functions.testFunction2("Here we go again", entity, entities, hass, browser_mod);
      coffee: |
        > 
        try{
          console.log("this",this);
          console.log("entitiy",entity);
          console.log("elements", elements);
        }catch(e){console.log("Error", e)}

The service will execute every key within service_data, or the string provided to service_data (without any keys).

handleError is changed a bit. Now the error-message is prioritized before the error-stack. A message about "check the browser console" is added, for people without the knowledge about that.

Check this discussion, if you'd like to see my previous toughs about this:
#181 (reply in thread)

And this, if you're curious on why I changed my mind:
#252

@exetico exetico merged commit 08923a9 into master Oct 29, 2022
@exetico
Copy link
Member Author

exetico commented Oct 29, 2022

Note: Re-added property, removed by mistake (eslint asked for it)

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.

None yet

1 participant