Async syntax 2, camera & climate & config (#17016)
This commit is contained in:
parent
38e371c5d9
commit
8444b9ba03
22 changed files with 119 additions and 194 deletions
|
@ -1,5 +1,4 @@
|
|||
"""Http views to control the config manager."""
|
||||
import asyncio
|
||||
|
||||
from homeassistant import config_entries, data_entry_flow
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
|
@ -7,8 +6,7 @@ from homeassistant.helpers.data_entry_flow import (
|
|||
FlowManagerIndexView, FlowManagerResourceView)
|
||||
|
||||
|
||||
@asyncio.coroutine
|
||||
def async_setup(hass):
|
||||
async def async_setup(hass):
|
||||
"""Enable the Home Assistant views."""
|
||||
hass.http.register_view(ConfigManagerEntryIndexView)
|
||||
hass.http.register_view(ConfigManagerEntryResourceView)
|
||||
|
@ -44,8 +42,7 @@ class ConfigManagerEntryIndexView(HomeAssistantView):
|
|||
url = '/api/config/config_entries/entry'
|
||||
name = 'api:config:config_entries:entry'
|
||||
|
||||
@asyncio.coroutine
|
||||
def get(self, request):
|
||||
async def get(self, request):
|
||||
"""List flows in progress."""
|
||||
hass = request.app['hass']
|
||||
return self.json([{
|
||||
|
@ -64,13 +61,12 @@ class ConfigManagerEntryResourceView(HomeAssistantView):
|
|||
url = '/api/config/config_entries/entry/{entry_id}'
|
||||
name = 'api:config:config_entries:entry:resource'
|
||||
|
||||
@asyncio.coroutine
|
||||
def delete(self, request, entry_id):
|
||||
async def delete(self, request, entry_id):
|
||||
"""Delete a config entry."""
|
||||
hass = request.app['hass']
|
||||
|
||||
try:
|
||||
result = yield from hass.config_entries.async_remove(entry_id)
|
||||
result = await hass.config_entries.async_remove(entry_id)
|
||||
except config_entries.UnknownEntry:
|
||||
return self.json_message('Invalid entry specified', 404)
|
||||
|
||||
|
@ -83,8 +79,7 @@ class ConfigManagerFlowIndexView(FlowManagerIndexView):
|
|||
url = '/api/config/config_entries/flow'
|
||||
name = 'api:config:config_entries:flow'
|
||||
|
||||
@asyncio.coroutine
|
||||
def get(self, request):
|
||||
async def get(self, request):
|
||||
"""List flows that are in progress but not started by a user.
|
||||
|
||||
Example of a non-user initiated flow is a discovered Hue hub that
|
||||
|
@ -110,7 +105,6 @@ class ConfigManagerAvailableFlowView(HomeAssistantView):
|
|||
url = '/api/config/config_entries/flow_handlers'
|
||||
name = 'api:config:config_entries:flow_handlers'
|
||||
|
||||
@asyncio.coroutine
|
||||
def get(self, request):
|
||||
async def get(self, request):
|
||||
"""List available flow handlers."""
|
||||
return self.json(config_entries.FLOWS)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue