Skip to content

Commit c58f232

Browse files
committed
isort, black, pep (except line lenght)
1 parent c894187 commit c58f232

File tree

7 files changed

+370
-295
lines changed

7 files changed

+370
-295
lines changed

custom_components/plugwise-beta/__init__.py

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,10 @@
11
"""Plugwise components for Home Assistant Core."""
22
import asyncio
33
import logging
4-
5-
import voluptuous as vol
64
from datetime import timedelta
75
from typing import Optional
86

9-
from Plugwise_Smile.Smile import Smile
10-
11-
from homeassistant.config_entries import ConfigEntry
12-
from homeassistant.core import HomeAssistant, callback
13-
from homeassistant.helpers.event import async_track_time_interval
14-
from homeassistant.helpers import device_registry as dr
15-
16-
from homeassistant.helpers.aiohttp_client import async_get_clientsession
17-
7+
import voluptuous as vol
188
from homeassistant.components.climate.const import (
199
HVAC_MODE_AUTO,
2010
HVAC_MODE_HEAT,
@@ -23,6 +13,12 @@
2313
SUPPORT_PRESET_MODE,
2414
SUPPORT_TARGET_TEMPERATURE,
2515
)
16+
from homeassistant.config_entries import ConfigEntry
17+
from homeassistant.core import HomeAssistant, callback
18+
from homeassistant.helpers import device_registry as dr
19+
from homeassistant.helpers.aiohttp_client import async_get_clientsession
20+
from homeassistant.helpers.event import async_track_time_interval
21+
from Plugwise_Smile.Smile import Smile
2622

2723
from .const import DOMAIN
2824

@@ -32,7 +28,7 @@
3228
HVAC_MODES_1 = [HVAC_MODE_HEAT, HVAC_MODE_AUTO]
3329
HVAC_MODES_2 = [HVAC_MODE_HEAT_COOL, HVAC_MODE_AUTO]
3430

35-
SUPPORT_FLAGS = (SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE)
31+
SUPPORT_FLAGS = SUPPORT_TARGET_TEMPERATURE | SUPPORT_PRESET_MODE
3632

3733
_LOGGER = logging.getLogger(__name__)
3834

@@ -52,18 +48,20 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
5248
# hass.data[DOMAIN][entry.entry_id] = MyApi(...)
5349

5450
websession = async_get_clientsession(hass, verify_ssl=False)
55-
api = Smile(host=entry.data.get("host"),
56-
password=entry.data.get("password"),
57-
websession=websession)
51+
api = Smile(
52+
host=entry.data.get("host"),
53+
password=entry.data.get("password"),
54+
websession=websession,
55+
)
5856

5957
await api.connect()
6058

61-
if api._smile_type == 'power':
62-
update_interval=timedelta(seconds=10)
59+
if api._smile_type == "power":
60+
update_interval = timedelta(seconds=10)
6361
else:
64-
update_interval=timedelta(seconds=60)
62+
update_interval = timedelta(seconds=60)
6563

66-
_LOGGER.debug("Plugwise async update interval %s",update_interval)
64+
_LOGGER.debug("Plugwise async update interval %s", update_interval)
6765

6866
hass.data.setdefault(DOMAIN, {})[entry.entry_id] = {
6967
"api": api,
@@ -72,9 +70,9 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
7270
),
7371
}
7472

75-
_LOGGER.debug("Plugwise gateway is %s",api._gateway_id)
73+
_LOGGER.debug("Plugwise gateway is %s", api._gateway_id)
7674
device_registry = await dr.async_get_registry(hass)
77-
_LOGGER.debug("Plugwise device registry %s",device_registry)
75+
_LOGGER.debug("Plugwise device registry %s", device_registry)
7876
result = device_registry.async_get_or_create(
7977
config_entry_id=entry.entry_id,
8078
identifiers={(DOMAIN, api._gateway_id)},
@@ -83,15 +81,15 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool:
8381
model=api._smile_name,
8482
sw_version=api._smile_version[0],
8583
)
86-
_LOGGER.debug("Plugwise device registry %s",result)
87-
#connections={(dr.CONNECTION_NETWORK_MAC, config.mac)},
88-
#model=config.modelid,
89-
#sw_version=config.swversion,
84+
_LOGGER.debug("Plugwise device registry %s", result)
85+
# connections={(dr.CONNECTION_NETWORK_MAC, config.mac)},
86+
# model=config.modelid,
87+
# sw_version=config.swversion,
9088

91-
#_LOGGER.debug("Plugwise async entry hass data %s",hass.data[DOMAIN])
89+
# _LOGGER.debug("Plugwise async entry hass data %s",hass.data[DOMAIN])
9290
# hass.data[DOMAIN][entry.entry_id] = api
9391

94-
for component in PLATFORMS: #api._platforms
92+
for component in PLATFORMS: # api._platforms
9593
hass.async_create_task(
9694
hass.config_entries.async_forward_entry_setup(entry, component)
9795
)
@@ -173,11 +171,10 @@ async def async_refresh_all(self, _now: Optional[int] = None) -> None:
173171
return
174172

175173
_LOGGER.debug("Plugwise Smile updating data using: %s", self.update_method)
176-
#await self.hass.async_add_executor_job(
177-
# getattr(self.api, self.update_method)
178-
#)
174+
# await self.hass.async_add_executor_job(
175+
# getattr(self.api, self.update_method)
176+
# )
179177
await self.api.full_update_device()
180178

181179
for update_callback in self.listeners:
182180
update_callback()
183-

0 commit comments

Comments
 (0)