Move imports in elkm1 component (#27982)

This commit is contained in:
Diefferson Koderer Môro authored and cgtobi committed 2019-10-20 23:37:52 +02:00
1 parent ef8f88e25a
commit ce00d06cbd
4 files changed
+15 -55

No files matched your search

+8 -15
View File
@@ -1,4 +1,12 @@
"""Support for control of ElkM1 sensors."""
from elkm1_lib.const import (
SettingFormat,
ZoneLogicalStatus,
ZonePhysicalStatus,
ZoneType,
)
from elkm1_lib.util import pretty_const, username
from . import DOMAIN as ELK_DOMAIN, ElkEntity, create_elk_entities
@@ -79,8 +87,6 @@ class ElkKeypad(ElkSensor):
@property
def device_state_attributes(self):
"""Attributes of the sensor."""
from elkm1_lib.util import username
attrs = self.initial_attrs()
attrs["area"] = self._element.area + 1
attrs["temperature"] = self._element.temperature
@@ -140,8 +146,6 @@ class ElkSetting(ElkSensor):
@property
def device_state_attributes(self):
"""Attributes of the sensor."""
from elkm1_lib.const import SettingFormat
attrs = self.initial_attrs()
attrs["value_format"] = SettingFormat(self._element.value_format).name.lower()
return attrs
@@ -153,8 +157,6 @@ class ElkZone(ElkSensor):
@property
def icon(self):
"""Icon to use in the frontend."""
from elkm1_lib.const import ZoneType
zone_icons = {
ZoneType.FIRE_ALARM.value: "fire",
ZoneType.FIRE_VERIFIED.value: "fire",
@@ -181,8 +183,6 @@ class ElkZone(ElkSensor):
@property
def device_state_attributes(self):
"""Attributes of the sensor."""
from elkm1_lib.const import ZoneLogicalStatus, ZonePhysicalStatus, ZoneType
attrs = self.initial_attrs()
attrs["physical_status"] = ZonePhysicalStatus(
self._element.physical_status
@@ -199,8 +199,6 @@ class ElkZone(ElkSensor):
@property
def temperature_unit(self):
"""Return the temperature unit."""
from elkm1_lib.const import ZoneType
if self._element.definition == ZoneType.TEMPERATURE.value:
return self._temperature_unit
return None
@@ -208,8 +206,6 @@ class ElkZone(ElkSensor):
@property
def unit_of_measurement(self):
"""Return the unit of measurement."""
from elkm1_lib.const import ZoneType
if self._element.definition == ZoneType.TEMPERATURE.value:
return self._temperature_unit
if self._element.definition == ZoneType.ANALOG_ZONE.value:
@@ -217,9 +213,6 @@ class ElkZone(ElkSensor):
return None
def _element_changed(self, element, changeset):
from elkm1_lib.const import ZoneLogicalStatus, ZoneType
from elkm1_lib.util import pretty_const
if self._element.definition == ZoneType.TEMPERATURE.value:
self._state = temperature_to_state(self._element.temperature, -60)
elif self._element.definition == ZoneType.ANALOG_ZONE.value: