Skip to content

Commit

Permalink
files formatted with black
Browse files Browse the repository at this point in the history
  • Loading branch information
luismalddonado authored and jnimmo committed Mar 8, 2024
1 parent 39ec37d commit 06e6c83
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 17 deletions.
1 change: 1 addition & 0 deletions custom_components/intesisbox/IntesisBoxEmulator.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Emulates an IntesisBox device on TCP port 3310."""

import asyncio

MODE_AUTO = "AUTO"
Expand Down
41 changes: 24 additions & 17 deletions custom_components/intesisbox/climate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
For more details about this platform, please refer to the documentation at
https://github.com/jnimmo/hass-intesisbox
"""

import asyncio
from datetime import timedelta
import logging

import voluptuous as vol

from homeassistant.components.climate import PLATFORM_SCHEMA, ClimateEntity, HVACMode, ClimateEntityFeature
from homeassistant.components.climate import (
PLATFORM_SCHEMA,
ClimateEntity,
HVACMode,
ClimateEntityFeature,
)
from homeassistant.components.climate.const import (
ATTR_HVAC_MODE,
)
Expand Down Expand Up @@ -47,21 +53,21 @@
SCAN_INTERVAL = timedelta(seconds=300)

MAP_OPERATION_MODE_TO_HA = {
'AUTO': HVACMode.HEAT_COOL,
'FAN': HVACMode.FAN_ONLY,
'HEAT': HVACMode.HEAT,
'DRY': HVACMode.DRY,
'COOL': HVACMode.COOL,
'OFF': HVACMode.OFF
"AUTO": HVACMode.HEAT_COOL,
"FAN": HVACMode.FAN_ONLY,
"HEAT": HVACMode.HEAT,
"DRY": HVACMode.DRY,
"COOL": HVACMode.COOL,
"OFF": HVACMode.OFF,
}
MAP_OPERATION_MODE_TO_IB = {v: k for k, v in MAP_OPERATION_MODE_TO_HA.items()}

MAP_STATE_ICONS = {
HVACMode.HEAT: 'mdi:white-balance-sunny',
HVACMode.HEAT_COOL: 'mdi:cached',
HVACMode.COOL: 'mdi:snowflake',
HVACMode.DRY: 'mdi:water-off',
HVACMode.FAN_ONLY: 'mdi:fan',
HVACMode.HEAT: "mdi:white-balance-sunny",
HVACMode.HEAT_COOL: "mdi:cached",
HVACMode.COOL: "mdi:snowflake",
HVACMode.DRY: "mdi:water-off",
HVACMode.FAN_ONLY: "mdi:fan",
}

FAN_MODE_I_TO_E = {
Expand All @@ -83,14 +89,16 @@
async def async_setup_platform(hass, config, async_add_entities, discovery_info=None):
"""Create the Intesisbox climate devices."""
from . import intesisbox

controller = intesisbox.IntesisBox(config[CONF_HOST], loop=hass.loop)
controller.connect()
while not controller.is_connected:
await asyncio.sleep(0.1)

name = config.get(CONF_NAME)
unique_id = config.get(CONF_UNIQUE_ID)
async_add_entities([IntesisBoxAC(controller, name, unique_id)],True)
async_add_entities([IntesisBoxAC(controller, name, unique_id)], True)


async def async_setup_entry(hass, entry, async_add_entities):
controller = hass.data[DOMAIN][entry.entry_id]
Expand Down Expand Up @@ -143,10 +151,10 @@ def __init__(

# Setup feature support
self._base_features = ClimateEntityFeature.TARGET_TEMPERATURE

self._base_features |= ClimateEntityFeature.TURN_ON
self._base_features |= ClimateEntityFeature.TURN_OFF

if len(self._fan_list) > 0:
self._base_features |= ClimateEntityFeature.FAN_MODE

Expand All @@ -161,7 +169,6 @@ def __init__(
if len(self._swing_list) > 2:
self._swing_list.append(SWING_LIST_BOTH)


_LOGGER.debug("Finished setting up climate entity!")
self._controller.add_update_callback(self.update_callback)

Expand Down Expand Up @@ -406,4 +413,4 @@ def target_temperature(self):
@property
def supported_features(self):
"""Return the list of supported features."""
return self._base_features
return self._base_features
1 change: 1 addition & 0 deletions custom_components/intesisbox/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Config flow to configure the Intesisbox integration."""

import logging

import voluptuous as vol
Expand Down

0 comments on commit 06e6c83

Please sign in to comment.