Skip to content

Commit 8a65d81

Browse files
committed
Update readme
1 parent 8c6f36c commit 8a65d81

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

README.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
# Python Scripts for Home Assistant
22

33
[![hacs_badge](https://img.shields.io/badge/HACS-Custom-orange.svg)](https://github.com/custom-components/hacs)
4-
[![Donate](https://img.shields.io/badge/donate-Coffee-yellow.svg)](https://www.buymeacoffee.com/AlexxIT)
5-
[![Donate](https://img.shields.io/badge/donate-Yandex-red.svg)](https://money.yandex.ru/to/41001428278477)
64

75
Custom component for easy run Python Scripts from Home Assistant. Better version of default [python_script](https://www.home-assistant.io/integrations/python_script/) component.
86

97
## Installation
108

11-
**Method 1.** [HACS](https://hacs.xyz/) custom repo:
9+
[HACS](https://hacs.xyz/) > Integrations > 3 dots > Custom repositories > URL: `AlexxIT/PythonScriptsPro`, Category: Integration > Add > wait > PythonScriptsPro > Install
1210

13-
> HACS > Integrations > 3 dots (upper top corner) > Custom repositories > URL: `AlexxIT/PythonScriptsPro`, Category: Integration > Add > wait > PythonScriptsPro > Install
14-
15-
**Method 2.** Manually copy `python_script` folder from [latest release](https://github.com/AlexxIT/PythonScriptsPro/releases/latest) to `/config/custom_components` folder.
11+
Or manually copy `python_script` folder from [latest release](https://github.com/AlexxIT/PythonScriptsPro/releases/latest) to `custom_components` folder.
1612

1713
## Configuration
1814

@@ -41,6 +37,8 @@ python_script:
4137
- You can pass any variables to your script, just like in the standard `python_script`.
4238
- The component compile and caches the executable code for faster next launch. If you want change python file without reload HA, you can disable cache with the `cache: false` param.
4339

40+
Starting from Home Assistant [2023.7](https://www.home-assistant.io/blog/2023/07/05/release-20237/) the service will return all your script local vars with simple types as respond.
41+
4442
The following variables are available in the script:
4543
- `hass` - The [Home Assistant API](https://www.home-assistant.io/developers/development_hass_object/)
4644
- `data` - The data passed to the Python Script service call
@@ -70,10 +68,10 @@ hass.services.call('persistent_notification', 'create', {
7068
'title': data['title'],
7169
'message': f"Home Assistant starts in { data['time_val'] } seconds"
7270
})
73-
71+
out1 = 123 # some var for service respond
7472
```
7573

76-
### Run script from inline source and return data
74+
### Run script from inline source
7775

7876
Show your IP address in Notification. Using `requests` library. It is installed by default with Home Assistant.
7977

@@ -93,7 +91,6 @@ script:
9391
'title': data['title'],
9492
'message': f"My IP: { resp['ip'] }"
9593
})
96-
return_response = resp # return data
9794
```
9895
9996
### Example remote SSH-command run
@@ -223,5 +220,4 @@ sensor:
223220
)
224221
except network.NoURLAvailableError:
225222
raise MyInvalidValueError("Failed to find suitable URL for my integration")
226-
227223
```

0 commit comments

Comments
 (0)