Reorganize HTTP component (#4575)
* Move HTTP to own folder * Break HTTP into middlewares * Lint * Split tests per middleware * Clean up HTTP tests * Make HomeAssistantViews more stateless * Lint * Make HTTP setup async
This commit is contained in:
parent
58b85b2e0e
commit
32ffd006fa
35 changed files with 1318 additions and 1084 deletions
|
@ -97,6 +97,7 @@ class NetioApiView(HomeAssistantView):
|
|||
@callback
|
||||
def get(self, request, host):
|
||||
"""Request handler."""
|
||||
hass = request.app['hass']
|
||||
data = request.GET
|
||||
states, consumptions, cumulated_consumptions, start_dates = \
|
||||
[], [], [], []
|
||||
|
@ -119,7 +120,7 @@ class NetioApiView(HomeAssistantView):
|
|||
ndev.start_dates = start_dates
|
||||
|
||||
for dev in DEVICES[host].entities:
|
||||
self.hass.async_add_job(dev.async_update_ha_state())
|
||||
hass.async_add_job(dev.async_update_ha_state())
|
||||
|
||||
return self.json(True)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue