Move imports for ebusd component (#27979)

pull/27982/head
Diefferson Koderer Môro 2019-10-20 16:16:04 -03:00 committed by Franck Nijhof
parent 8356d92f04
commit ca0a4a8750
3 changed files with 5 additions and 9 deletions

View File

@ -3,13 +3,14 @@ from datetime import timedelta
import logging
import socket
import ebusdpy
import voluptuous as vol
from homeassistant.const import (
CONF_NAME,
CONF_HOST,
CONF_PORT,
CONF_MONITORED_CONDITIONS,
CONF_NAME,
CONF_PORT,
)
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.discovery import load_platform
@ -66,7 +67,6 @@ def setup(hass, config):
try:
_LOGGER.debug("Ebusd integration setup started")
import ebusdpy
ebusdpy.init(server_address)
hass.data[DOMAIN] = EbusdData(server_address, circuit)
@ -98,8 +98,6 @@ class EbusdData:
@Throttle(MIN_TIME_BETWEEN_UPDATES)
def update(self, name, stype):
"""Call the Ebusd API to update the data."""
import ebusdpy
try:
_LOGGER.debug("Opening socket to ebusd %s", name)
command_result = ebusdpy.read(
@ -116,8 +114,6 @@ class EbusdData:
def write(self, call):
"""Call write methon on ebusd."""
import ebusdpy
name = call.data.get("name")
value = call.data.get("value")

View File

@ -1,5 +1,5 @@
"""Constants for ebus component."""
from homeassistant.const import ENERGY_KILO_WATT_HOUR, TEMP_CELSIUS, PRESSURE_BAR
from homeassistant.const import ENERGY_KILO_WATT_HOUR, PRESSURE_BAR, TEMP_CELSIUS
DOMAIN = "ebusd"
TIME_SECONDS = "seconds"

View File

@ -1,6 +1,6 @@
"""Support for Ebusd sensors."""
import logging
import datetime
import logging
from homeassistant.helpers.entity import Entity
import homeassistant.util.dt as dt_util