Update asyncio docs
This commit is contained in:
parent
71f5bc3886
commit
cf7a48d61e
1 changed files with 16 additions and 1 deletions
|
@ -19,7 +19,22 @@ So if you are making calls to the core (the hass object) from within a callback
|
|||
|
||||
## {% linkable_title Implementing an async component %}
|
||||
|
||||
We currently do not support async setup for components. We do however support using async functions as service handlers. Just define your handlers as a callback or coroutine and register them as usual.
|
||||
To make a component async, implement an async_setup.
|
||||
|
||||
```python
|
||||
def setup(hass, config):
|
||||
# Setup your component outside of the event loop.
|
||||
```
|
||||
|
||||
Will turn into:
|
||||
|
||||
```python
|
||||
import asyncio
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_setup(hass, config):
|
||||
# Setup your component inside of the event loop.
|
||||
```
|
||||
|
||||
## {% linkable_title Implementing an async platform %}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue