Move imports to top for netdata (#29362)

pull/29381/head
springstan 2019-12-04 00:46:16 +01:00 committed by Paulus Schoutsen
parent b462c539eb
commit 4130f2ff1a
1 changed files with 2 additions and 2 deletions

View File

@ -2,6 +2,8 @@
from datetime import timedelta
import logging
from netdata import Netdata
from netdata.exceptions import NetdataError
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
@ -53,7 +55,6 @@ PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Set up the Netdata sensor."""
from netdata import Netdata
name = config.get(CONF_NAME)
host = config.get(CONF_HOST)
@ -154,7 +155,6 @@ class NetdataData:
@Throttle(MIN_TIME_BETWEEN_UPDATES)
async def async_update(self):
"""Get the latest data from the Netdata REST API."""
from netdata.exceptions import NetdataError
try:
await self.api.get_allmetrics()