Clean up homematicip cloud (#22589)

* Code Cleanup

- removed unused constants
- more icons on binary_sensor groups
- alligned  code for device_state_attributes
- fixed temperature unit origin for weather

* removed icons
pull/22597/head^2
Markus Jankowski 2019-03-31 21:18:45 +02:00 committed by Martin Hjelmare
parent 842a36dc9e
commit 5abfc84382
6 changed files with 6 additions and 24 deletions

View File

@ -12,9 +12,6 @@ _LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['homematicip_cloud']
HMIP_ZONE_AWAY = 'EXTERNAL'
HMIP_ZONE_HOME = 'INTERNAL'
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):

View File

@ -10,8 +10,6 @@ from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
_LOGGER = logging.getLogger(__name__)
STATE_BOOST = 'Boost'
HA_STATE_TO_HMIP = {
STATE_AUTO: 'AUTOMATIC',
STATE_MANUAL: 'MANUAL',

View File

@ -13,7 +13,6 @@ _LOGGER = logging.getLogger(__name__)
ATTR_ENERGY_COUNTER = 'energy_counter_kwh'
ATTR_POWER_CONSUMPTION = 'power_consumption'
ATTR_PROFILE_MODE = 'profile_mode'
async def async_setup_platform(
@ -77,13 +76,9 @@ class HomematicipLightMeasuring(HomematicipLight):
"""Return the state attributes of the generic device."""
attr = super().device_state_attributes
if self._device.currentPowerConsumption > 0.05:
attr.update({
ATTR_POWER_CONSUMPTION:
round(self._device.currentPowerConsumption, 2)
})
attr.update({
ATTR_ENERGY_COUNTER: round(self._device.energyCounter, 2)
})
attr[ATTR_POWER_CONSUMPTION] = \
round(self._device.currentPowerConsumption, 2)
attr[ATTR_ENERGY_COUNTER] = round(self._device.energyCounter, 2)
return attr
@ -168,10 +163,7 @@ class HomematicipNotificationLight(HomematicipGenericDevice, Light):
"""Return the state attributes of the generic device."""
attr = super().device_state_attributes
if self.is_on:
attr.update({
ATTR_COLOR_NAME:
self._channel.simpleRGBColorState
})
attr[ATTR_COLOR_NAME] = self._channel.simpleRGBColorState
return attr
@property

View File

@ -12,8 +12,6 @@ _LOGGER = logging.getLogger(__name__)
DEPENDENCIES = ['homematicip_cloud']
ATTR_TEMPERATURE_OFFSET = 'temperature_offset'
ATTR_VALVE_STATE = 'valve_state'
ATTR_VALVE_POSITION = 'valve_position'
ATTR_WIND_DIRECTION = 'wind_direction'
ATTR_WIND_DIRECTION_VARIATION = 'wind_direction_variation_in_degree'

View File

@ -10,10 +10,6 @@ DEPENDENCIES = ['homematicip_cloud']
_LOGGER = logging.getLogger(__name__)
ATTR_POWER_CONSUMPTION = 'power_consumption'
ATTR_ENERGIE_COUNTER = 'energie_counter'
ATTR_PROFILE_MODE = 'profile_mode'
async def async_setup_platform(
hass, config, async_add_entities, discovery_info=None):

View File

@ -3,6 +3,7 @@
import logging
from homeassistant.components.weather import WeatherEntity
from homeassistant.const import TEMP_CELSIUS
from . import DOMAIN as HMIPC_DOMAIN, HMIPC_HAPID, HomematicipGenericDevice
@ -55,7 +56,7 @@ class HomematicipWeatherSensor(HomematicipGenericDevice, WeatherEntity):
@property
def temperature_unit(self):
"""Return the unit of measurement."""
return self.hass.config.units.temperature_unit
return TEMP_CELSIUS
@property
def humidity(self):