Move imports for ebusd component (#27979)
parent
8356d92f04
commit
ca0a4a8750
|
@ -3,13 +3,14 @@ from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
import socket
|
import socket
|
||||||
|
|
||||||
|
import ebusdpy
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_NAME,
|
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PORT,
|
|
||||||
CONF_MONITORED_CONDITIONS,
|
CONF_MONITORED_CONDITIONS,
|
||||||
|
CONF_NAME,
|
||||||
|
CONF_PORT,
|
||||||
)
|
)
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.discovery import load_platform
|
from homeassistant.helpers.discovery import load_platform
|
||||||
|
@ -66,7 +67,6 @@ def setup(hass, config):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_LOGGER.debug("Ebusd integration setup started")
|
_LOGGER.debug("Ebusd integration setup started")
|
||||||
import ebusdpy
|
|
||||||
|
|
||||||
ebusdpy.init(server_address)
|
ebusdpy.init(server_address)
|
||||||
hass.data[DOMAIN] = EbusdData(server_address, circuit)
|
hass.data[DOMAIN] = EbusdData(server_address, circuit)
|
||||||
|
@ -98,8 +98,6 @@ class EbusdData:
|
||||||
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
@Throttle(MIN_TIME_BETWEEN_UPDATES)
|
||||||
def update(self, name, stype):
|
def update(self, name, stype):
|
||||||
"""Call the Ebusd API to update the data."""
|
"""Call the Ebusd API to update the data."""
|
||||||
import ebusdpy
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_LOGGER.debug("Opening socket to ebusd %s", name)
|
_LOGGER.debug("Opening socket to ebusd %s", name)
|
||||||
command_result = ebusdpy.read(
|
command_result = ebusdpy.read(
|
||||||
|
@ -116,8 +114,6 @@ class EbusdData:
|
||||||
|
|
||||||
def write(self, call):
|
def write(self, call):
|
||||||
"""Call write methon on ebusd."""
|
"""Call write methon on ebusd."""
|
||||||
import ebusdpy
|
|
||||||
|
|
||||||
name = call.data.get("name")
|
name = call.data.get("name")
|
||||||
value = call.data.get("value")
|
value = call.data.get("value")
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
"""Constants for ebus component."""
|
"""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"
|
DOMAIN = "ebusd"
|
||||||
TIME_SECONDS = "seconds"
|
TIME_SECONDS = "seconds"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
"""Support for Ebusd sensors."""
|
"""Support for Ebusd sensors."""
|
||||||
import logging
|
|
||||||
import datetime
|
import datetime
|
||||||
|
import logging
|
||||||
|
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
import homeassistant.util.dt as dt_util
|
import homeassistant.util.dt as dt_util
|
||||||
|
|
Loading…
Reference in New Issue