mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Move imports in apcupsd component (#27803)
This commit is contained in:
parent
56c13503c3
commit
447d99a1ae
@ -1,7 +1,8 @@
|
|||||||
"""Support for APCUPSd via its Network Information Server (NIS)."""
|
"""Support for APCUPSd via its Network Information Server (NIS)."""
|
||||||
import logging
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from apcaccess import status
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import CONF_HOST, CONF_PORT
|
from homeassistant.const import CONF_HOST, CONF_PORT
|
||||||
@ -64,7 +65,6 @@ class APCUPSdData:
|
|||||||
|
|
||||||
def __init__(self, host, port):
|
def __init__(self, host, port):
|
||||||
"""Initialize the data object."""
|
"""Initialize the data object."""
|
||||||
from apcaccess import status
|
|
||||||
|
|
||||||
self._host = host
|
self._host = host
|
||||||
self._port = port
|
self._port = port
|
||||||
|
@ -1,12 +1,13 @@
|
|||||||
"""Support for APCUPSd sensors."""
|
"""Support for APCUPSd sensors."""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from apcaccess.status import ALL_UNITS
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
|
||||||
from homeassistant.components import apcupsd
|
from homeassistant.components import apcupsd
|
||||||
from homeassistant.const import TEMP_CELSIUS, CONF_RESOURCES, POWER_WATT
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
|
from homeassistant.const import CONF_RESOURCES, POWER_WATT, TEMP_CELSIUS
|
||||||
|
import homeassistant.helpers.config_validation as cv
|
||||||
from homeassistant.helpers.entity import Entity
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
@ -135,7 +136,6 @@ def infer_unit(value):
|
|||||||
Split the unit off the end of the value and return the value, unit tuple
|
Split the unit off the end of the value and return the value, unit tuple
|
||||||
pair. Else return the original value and None as the unit.
|
pair. Else return the original value and None as the unit.
|
||||||
"""
|
"""
|
||||||
from apcaccess.status import ALL_UNITS
|
|
||||||
|
|
||||||
for unit in ALL_UNITS:
|
for unit in ALL_UNITS:
|
||||||
if value.endswith(unit):
|
if value.endswith(unit):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user