Black
This commit is contained in:
parent
da05dfe708
commit
4de97abc3a
2676 changed files with 163166 additions and 140084 deletions
|
@ -2,20 +2,20 @@
|
|||
import logging
|
||||
|
||||
from homeassistant.components.fan import (
|
||||
SPEED_HIGH, SPEED_LOW, SPEED_MEDIUM, SPEED_OFF, SUPPORT_SET_SPEED,
|
||||
FanEntity)
|
||||
SPEED_HIGH,
|
||||
SPEED_LOW,
|
||||
SPEED_MEDIUM,
|
||||
SPEED_OFF,
|
||||
SUPPORT_SET_SPEED,
|
||||
FanEntity,
|
||||
)
|
||||
from homeassistant.helpers.dispatcher import dispatcher_connect
|
||||
|
||||
from . import DOMAIN, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, ComfoConnectBridge
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
SPEED_MAPPING = {
|
||||
0: SPEED_OFF,
|
||||
1: SPEED_LOW,
|
||||
2: SPEED_MEDIUM,
|
||||
3: SPEED_HIGH
|
||||
}
|
||||
SPEED_MAPPING = {0: SPEED_OFF, 1: SPEED_LOW, 2: SPEED_MEDIUM, 3: SPEED_HIGH}
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||
|
@ -44,8 +44,7 @@ class ComfoConnectFan(FanEntity):
|
|||
self.schedule_update_ha_state()
|
||||
|
||||
# Register for dispatcher updates
|
||||
dispatcher_connect(
|
||||
hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, _handle_update)
|
||||
dispatcher_connect(hass, SIGNAL_COMFOCONNECT_UPDATE_RECEIVED, _handle_update)
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
|
@ -55,7 +54,7 @@ class ComfoConnectFan(FanEntity):
|
|||
@property
|
||||
def icon(self):
|
||||
"""Return the icon to use in the frontend."""
|
||||
return 'mdi:air-conditioner'
|
||||
return "mdi:air-conditioner"
|
||||
|
||||
@property
|
||||
def supported_features(self) -> int:
|
||||
|
@ -65,7 +64,7 @@ class ComfoConnectFan(FanEntity):
|
|||
@property
|
||||
def speed(self):
|
||||
"""Return the current fan mode."""
|
||||
from pycomfoconnect import (SENSOR_FAN_SPEED_MODE)
|
||||
from pycomfoconnect import SENSOR_FAN_SPEED_MODE
|
||||
|
||||
try:
|
||||
speed = self._ccb.data[SENSOR_FAN_SPEED_MODE]
|
||||
|
@ -90,11 +89,14 @@ class ComfoConnectFan(FanEntity):
|
|||
|
||||
def set_speed(self, speed: str):
|
||||
"""Set fan speed."""
|
||||
_LOGGER.debug('Changing fan speed to %s.', speed)
|
||||
_LOGGER.debug("Changing fan speed to %s.", speed)
|
||||
|
||||
from pycomfoconnect import (
|
||||
CMD_FAN_MODE_AWAY, CMD_FAN_MODE_LOW, CMD_FAN_MODE_MEDIUM,
|
||||
CMD_FAN_MODE_HIGH)
|
||||
CMD_FAN_MODE_AWAY,
|
||||
CMD_FAN_MODE_LOW,
|
||||
CMD_FAN_MODE_MEDIUM,
|
||||
CMD_FAN_MODE_HIGH,
|
||||
)
|
||||
|
||||
if speed == SPEED_OFF:
|
||||
self._ccb.comfoconnect.cmd_rmi_request(CMD_FAN_MODE_AWAY)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue