Release 0.47

This commit is contained in:
Paulus Schoutsen 2017-06-17 12:09:03 -07:00
parent 52f2dda864
commit 8fc3193a39
11 changed files with 597 additions and 25 deletions

View file

@ -12,7 +12,16 @@ ha_category: Automation
ha_release: 0.47
---
This component 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 with access to the `hass` object, the service call data as `data` and a logger as `logger`.
This component 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:
| 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-api]: https://home-assistant.io/developers/development_hass_object/
[logger-api]: https://docs.python.org/3.4/library/logging.html#logger-objects
## {% linkable_title Writing your first script %}