Rename Services to Actions in integrations: P (#33824)

* Rename Services to Actions in integrations: P

* Update source/_integrations/python_script.markdown

---------

Co-authored-by: c0ffeeca7 <38767475+c0ffeeca7@users.noreply.github.com>
This commit is contained in:
Franck Nijhof
2024-07-17 07:00:54 +02:00
committed by GitHub
parent bdb4c8a7b2
commit c5f4b246f0
17 changed files with 88 additions and 88 deletions

View File

@@ -9,13 +9,13 @@ ha_domain: python_script
ha_integration_type: integration
---
This integration allows you to write Python scripts that are exposed as services in Home Assistant. Each Python file created in the `<config>/python_scripts/` folder will be exposed as a service. The content is not cached so you can easily develop: edit file, save changes, call service. The scripts are run in a sandboxed environment. The following variables are available in the sandbox:
This integration allows you to write Python scripts that are exposed as actions in Home Assistant. Each Python file created in the `<config>/python_scripts/` folder will be exposed as an action. The content is not cached so you can easily develop: edit file, save changes, perform action. The scripts are run in a sandboxed environment. The following variables are available in the sandbox:
| Name | Description |
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `hass` | The Home Assistant object. Access is only allowed to call services, set/remove states and fire events. [API reference][hass-api] |
| `data` | The data passed to the Python Script service call. |
| `logger` | A logger to allow you to log messages: `logger.info()`, `logger.warning()`, `logger.error()`. [API reference][logger-api] |
| `hass` | The Home Assistant object. Access is only allowed to perform actions, set/remove states and fire events. [API reference][hass-api] |
| `data` | The data passed to the Python Script action. |
| `logger` | A logger to allow you to log messages: `logger.info()`, `logger.warning()`, `logger.error()`. [API reference][logger-api] |
| `time` | The stdlib `time` available as limited access. |
| `datetime` | The stdlib `datetime` available as limited access. |
| `dt_util` | The ` homeassistant.util.dt` module. |
@@ -55,7 +55,7 @@ logger.info("Hello {} at {}".format(name, time.time()))
```
- Start Home Assistant to reload the script configuration.
- Call your new {% my developer_call_service service="python_script.hello_world" %} service (with parameters) from the {% my developer_services %}, using the YAML mode.
- Call your new {% my developer_call_service service="python_script.hello_world" %} action (with parameters) from the {% my developer_services %}, using the YAML mode.
```yaml
service: python_script.hello_world
@@ -178,11 +178,11 @@ turn_on_light:
For more examples, visit the [Scripts section](https://community.home-assistant.io/c/projects/scripts) in our forum.
## Services
## Actions
Available services: `reload`.
Available actions: `reload`.
### Service `python_script.reload`
### Action `python_script.reload`
Reload all available python_scripts from the `<config>/python_scripts` folder, as a quicker alternative to restarting Home Assistant.
@@ -190,4 +190,4 @@ Use this when creating a new Python script, or after updating the `<config>/pyth
You don't have to call this service when you change an existing Python script.
This service takes no service data attributes.
This service takes no data attributes.