mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 16:27:08 +00:00
Move imports to top for netdata (#29362)
This commit is contained in:
parent
b462c539eb
commit
4130f2ff1a
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user