Bump AIOSomecomfort to 0.0.6 (#87203)

* Bump to 0.0.5

* Bump aiosomecomfort to 0.0.6

* lower case aiosomecomfort

* Fix other bad imports....

---------

Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
This commit is contained in:
mkmer 2023-02-02 16:45:49 -05:00 committed by GitHub
parent e40a9822f5
commit e9c10de9a9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 47 additions and 47 deletions

View file

@ -2,7 +2,7 @@
import asyncio import asyncio
from dataclasses import dataclass from dataclasses import dataclass
import AIOSomecomfort import aiosomecomfort
from homeassistant.config_entries import ConfigEntry from homeassistant.config_entries import ConfigEntry
from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform from homeassistant.const import CONF_PASSWORD, CONF_USERNAME, Platform
@ -50,19 +50,19 @@ async def async_setup_entry(hass: HomeAssistant, config_entry: ConfigEntry) -> b
username = config_entry.data[CONF_USERNAME] username = config_entry.data[CONF_USERNAME]
password = config_entry.data[CONF_PASSWORD] password = config_entry.data[CONF_PASSWORD]
client = AIOSomecomfort.AIOSomeComfort( client = aiosomecomfort.AIOSomeComfort(
username, password, session=async_get_clientsession(hass) username, password, session=async_get_clientsession(hass)
) )
try: try:
await client.login() await client.login()
await client.discover() await client.discover()
except AIOSomecomfort.device.AuthError as ex: except aiosomecomfort.device.AuthError as ex:
raise ConfigEntryAuthFailed("Incorrect Password") from ex raise ConfigEntryAuthFailed("Incorrect Password") from ex
except ( except (
AIOSomecomfort.device.ConnectionError, aiosomecomfort.device.ConnectionError,
AIOSomecomfort.device.ConnectionTimeout, aiosomecomfort.device.ConnectionTimeout,
asyncio.TimeoutError, asyncio.TimeoutError,
) as ex: ) as ex:
raise ConfigEntryNotReady( raise ConfigEntryNotReady(
@ -114,5 +114,5 @@ class HoneywellData:
"""Shared data for Honeywell.""" """Shared data for Honeywell."""
entry_id: str entry_id: str
client: AIOSomecomfort.AIOSomeComfort client: aiosomecomfort.AIOSomeComfort
devices: dict[str, AIOSomecomfort.device.Device] devices: dict[str, aiosomecomfort.device.Device]

View file

@ -4,7 +4,7 @@ from __future__ import annotations
import datetime import datetime
from typing import Any from typing import Any
import AIOSomecomfort import aiosomecomfort
from homeassistant.components.climate import ( from homeassistant.components.climate import (
ATTR_TARGET_TEMP_HIGH, ATTR_TARGET_TEMP_HIGH,
@ -103,7 +103,7 @@ class HoneywellUSThermostat(ClimateEntity):
def __init__( def __init__(
self, self,
data: HoneywellData, data: HoneywellData,
device: AIOSomecomfort.device.Device, device: aiosomecomfort.device.Device,
cool_away_temp: int | None, cool_away_temp: int | None,
heat_away_temp: int | None, heat_away_temp: int | None,
) -> None: ) -> None:
@ -304,7 +304,7 @@ class HoneywellUSThermostat(ClimateEntity):
if mode == "heat": if mode == "heat":
await self._device.set_setpoint_heat(temperature) await self._device.set_setpoint_heat(temperature)
except AIOSomecomfort.SomeComfortError as err: except aiosomecomfort.SomeComfortError as err:
_LOGGER.error("Invalid temperature %.1f: %s", temperature, err) _LOGGER.error("Invalid temperature %.1f: %s", temperature, err)
async def async_set_temperature(self, **kwargs: Any) -> None: async def async_set_temperature(self, **kwargs: Any) -> None:
@ -317,7 +317,7 @@ class HoneywellUSThermostat(ClimateEntity):
if temperature := kwargs.get(ATTR_TARGET_TEMP_LOW): if temperature := kwargs.get(ATTR_TARGET_TEMP_LOW):
await self._device.set_setpoint_heat(temperature) await self._device.set_setpoint_heat(temperature)
except AIOSomecomfort.SomeComfortError as err: except aiosomecomfort.SomeComfortError as err:
_LOGGER.error("Invalid temperature %.1f: %s", temperature, err) _LOGGER.error("Invalid temperature %.1f: %s", temperature, err)
async def async_set_fan_mode(self, fan_mode: str) -> None: async def async_set_fan_mode(self, fan_mode: str) -> None:
@ -339,7 +339,7 @@ class HoneywellUSThermostat(ClimateEntity):
try: try:
# Get current mode # Get current mode
mode = self._device.system_mode mode = self._device.system_mode
except AIOSomecomfort.SomeComfortError: except aiosomecomfort.SomeComfortError:
_LOGGER.error("Can not get system mode") _LOGGER.error("Can not get system mode")
return return
try: try:
@ -352,7 +352,7 @@ class HoneywellUSThermostat(ClimateEntity):
await self._device.set_hold_heat(True) await self._device.set_hold_heat(True)
await self._device.set_setpoint_heat(self._heat_away_temp) await self._device.set_setpoint_heat(self._heat_away_temp)
except AIOSomecomfort.SomeComfortError: except aiosomecomfort.SomeComfortError:
_LOGGER.error( _LOGGER.error(
"Temperature out of range. Mode: %s, Heat Temperature: %.1f, Cool Temperature: %.1f", "Temperature out of range. Mode: %s, Heat Temperature: %.1f, Cool Temperature: %.1f",
mode, mode,
@ -365,7 +365,7 @@ class HoneywellUSThermostat(ClimateEntity):
try: try:
# Get current mode # Get current mode
mode = self._device.system_mode mode = self._device.system_mode
except AIOSomecomfort.SomeComfortError: except aiosomecomfort.SomeComfortError:
_LOGGER.error("Can not get system mode") _LOGGER.error("Can not get system mode")
return return
# Check that we got a valid mode back # Check that we got a valid mode back
@ -377,7 +377,7 @@ class HoneywellUSThermostat(ClimateEntity):
if mode in HEATING_MODES: if mode in HEATING_MODES:
await self._device.set_hold_heat(True) await self._device.set_hold_heat(True)
except AIOSomecomfort.SomeComfortError: except aiosomecomfort.SomeComfortError:
_LOGGER.error("Couldn't set permanent hold") _LOGGER.error("Couldn't set permanent hold")
else: else:
_LOGGER.error("Invalid system mode returned: %s", mode) _LOGGER.error("Invalid system mode returned: %s", mode)
@ -389,7 +389,7 @@ class HoneywellUSThermostat(ClimateEntity):
# Disabling all hold modes # Disabling all hold modes
await self._device.set_hold_cool(False) await self._device.set_hold_cool(False)
await self._device.set_hold_heat(False) await self._device.set_hold_heat(False)
except AIOSomecomfort.SomeComfortError: except aiosomecomfort.SomeComfortError:
_LOGGER.error("Can not stop hold mode") _LOGGER.error("Can not stop hold mode")
async def async_set_preset_mode(self, preset_mode: str) -> None: async def async_set_preset_mode(self, preset_mode: str) -> None:
@ -418,13 +418,13 @@ class HoneywellUSThermostat(ClimateEntity):
try: try:
await self._device.refresh() await self._device.refresh()
except ( except (
AIOSomecomfort.SomeComfortError, aiosomecomfort.SomeComfortError,
OSError, OSError,
): ):
try: try:
await self._data.client.login() await self._data.client.login()
except AIOSomecomfort.SomeComfortError: except aiosomecomfort.SomeComfortError:
self._attr_available = False self._attr_available = False
await self.hass.async_create_task( await self.hass.async_create_task(
self.hass.config_entries.async_reload(self._data.entry_id) self.hass.config_entries.async_reload(self._data.entry_id)

View file

@ -5,7 +5,7 @@ import asyncio
from collections.abc import Mapping from collections.abc import Mapping
from typing import Any from typing import Any
import AIOSomecomfort import aiosomecomfort
import voluptuous as vol import voluptuous as vol
from homeassistant import config_entries from homeassistant import config_entries
@ -56,12 +56,12 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
username=data[CONF_USERNAME], password=data[CONF_PASSWORD] username=data[CONF_USERNAME], password=data[CONF_PASSWORD]
) )
except AIOSomecomfort.AuthError: except aiosomecomfort.AuthError:
errors["base"] = "invalid_auth" errors["base"] = "invalid_auth"
except ( except (
AIOSomecomfort.ConnectionError, aiosomecomfort.ConnectionError,
AIOSomecomfort.ConnectionTimeout, aiosomecomfort.ConnectionTimeout,
asyncio.TimeoutError, asyncio.TimeoutError,
): ):
errors["base"] = "cannot_connect" errors["base"] = "cannot_connect"
@ -89,11 +89,11 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
if user_input is not None: if user_input is not None:
try: try:
await self.is_valid(**user_input) await self.is_valid(**user_input)
except AIOSomecomfort.AuthError: except aiosomecomfort.AuthError:
errors["base"] = "invalid_auth" errors["base"] = "invalid_auth"
except ( except (
AIOSomecomfort.ConnectionError, aiosomecomfort.ConnectionError,
AIOSomecomfort.ConnectionTimeout, aiosomecomfort.ConnectionTimeout,
asyncio.TimeoutError, asyncio.TimeoutError,
): ):
errors["base"] = "cannot_connect" errors["base"] = "cannot_connect"
@ -114,7 +114,7 @@ class HoneywellConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
async def is_valid(self, **kwargs) -> bool: async def is_valid(self, **kwargs) -> bool:
"""Check if login credentials are valid.""" """Check if login credentials are valid."""
client = AIOSomecomfort.AIOSomeComfort( client = aiosomecomfort.AIOSomeComfort(
kwargs[CONF_USERNAME], kwargs[CONF_USERNAME],
kwargs[CONF_PASSWORD], kwargs[CONF_PASSWORD],
session=async_get_clientsession(self.hass), session=async_get_clientsession(self.hass),

View file

@ -3,7 +3,7 @@
"name": "Honeywell Total Connect Comfort (US)", "name": "Honeywell Total Connect Comfort (US)",
"config_flow": true, "config_flow": true,
"documentation": "https://www.home-assistant.io/integrations/honeywell", "documentation": "https://www.home-assistant.io/integrations/honeywell",
"requirements": ["aiosomecomfort==0.0.3"], "requirements": ["aiosomecomfort==0.0.6"],
"codeowners": ["@rdfurman", "@mkmer"], "codeowners": ["@rdfurman", "@mkmer"],
"iot_class": "cloud_polling", "iot_class": "cloud_polling",
"loggers": ["somecomfort"] "loggers": ["somecomfort"]

View file

@ -5,7 +5,7 @@ from collections.abc import Callable
from dataclasses import dataclass from dataclasses import dataclass
from typing import Any from typing import Any
from AIOSomecomfort.device import Device from aiosomecomfort.device import Device
from homeassistant.components.sensor import ( from homeassistant.components.sensor import (
SensorDeviceClass, SensorDeviceClass,

View file

@ -276,7 +276,7 @@ aioskybell==22.7.0
aioslimproto==2.1.1 aioslimproto==2.1.1
# homeassistant.components.honeywell # homeassistant.components.honeywell
aiosomecomfort==0.0.3 aiosomecomfort==0.0.6
# homeassistant.components.steamist # homeassistant.components.steamist
aiosteamist==0.3.2 aiosteamist==0.3.2

View file

@ -254,7 +254,7 @@ aioskybell==22.7.0
aioslimproto==2.1.1 aioslimproto==2.1.1
# homeassistant.components.honeywell # homeassistant.components.honeywell
aiosomecomfort==0.0.3 aiosomecomfort==0.0.6
# homeassistant.components.steamist # homeassistant.components.steamist
aiosteamist==0.3.2 aiosteamist==0.3.2

View file

@ -2,7 +2,7 @@
from unittest.mock import AsyncMock, create_autospec, patch from unittest.mock import AsyncMock, create_autospec, patch
import AIOSomecomfort import aiosomecomfort
import pytest import pytest
from homeassistant.components.honeywell.const import DOMAIN from homeassistant.components.honeywell.const import DOMAIN
@ -30,7 +30,7 @@ def config_entry(config_data):
@pytest.fixture @pytest.fixture
def device(): def device():
"""Mock a somecomfort.Device.""" """Mock a somecomfort.Device."""
mock_device = create_autospec(AIOSomecomfort.device.Device, instance=True) mock_device = create_autospec(aiosomecomfort.device.Device, instance=True)
mock_device.deviceid = 1234567 mock_device.deviceid = 1234567
mock_device._data = { mock_device._data = {
"canControlHumidification": False, "canControlHumidification": False,
@ -48,7 +48,7 @@ def device():
@pytest.fixture @pytest.fixture
def device_with_outdoor_sensor(): def device_with_outdoor_sensor():
"""Mock a somecomfort.Device.""" """Mock a somecomfort.Device."""
mock_device = create_autospec(AIOSomecomfort.device.Device, instance=True) mock_device = create_autospec(aiosomecomfort.device.Device, instance=True)
mock_device.deviceid = 1234567 mock_device.deviceid = 1234567
mock_device._data = { mock_device._data = {
"canControlHumidification": False, "canControlHumidification": False,
@ -67,7 +67,7 @@ def device_with_outdoor_sensor():
@pytest.fixture @pytest.fixture
def another_device(): def another_device():
"""Mock a somecomfort.Device.""" """Mock a somecomfort.Device."""
mock_device = create_autospec(AIOSomecomfort.device.Device, instance=True) mock_device = create_autospec(aiosomecomfort.device.Device, instance=True)
mock_device.deviceid = 7654321 mock_device.deviceid = 7654321
mock_device._data = { mock_device._data = {
"canControlHumidification": False, "canControlHumidification": False,
@ -85,7 +85,7 @@ def another_device():
@pytest.fixture @pytest.fixture
def location(device): def location(device):
"""Mock a somecomfort.Location.""" """Mock a somecomfort.Location."""
mock_location = create_autospec(AIOSomecomfort.location.Location, instance=True) mock_location = create_autospec(aiosomecomfort.location.Location, instance=True)
mock_location.locationid.return_value = "location1" mock_location.locationid.return_value = "location1"
mock_location.devices_by_id = {device.deviceid: device} mock_location.devices_by_id = {device.deviceid: device}
return mock_location return mock_location
@ -94,13 +94,13 @@ def location(device):
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def client(location): def client(location):
"""Mock a somecomfort.SomeComfort client.""" """Mock a somecomfort.SomeComfort client."""
client_mock = create_autospec(AIOSomecomfort.AIOSomeComfort, instance=True) client_mock = create_autospec(aiosomecomfort.AIOSomeComfort, instance=True)
client_mock.locations_by_id = {location.locationid: location} client_mock.locations_by_id = {location.locationid: location}
client_mock.login = AsyncMock(return_value=True) client_mock.login = AsyncMock(return_value=True)
client_mock.discover = AsyncMock() client_mock.discover = AsyncMock()
with patch( with patch(
"homeassistant.components.honeywell.AIOSomecomfort.AIOSomeComfort" "homeassistant.components.honeywell.aiosomecomfort.AIOSomeComfort"
) as sc_class_mock: ) as sc_class_mock:
sc_class_mock.return_value = client_mock sc_class_mock.return_value = client_mock
yield client_mock yield client_mock

View file

@ -2,7 +2,7 @@
import asyncio import asyncio
from unittest.mock import MagicMock, patch from unittest.mock import MagicMock, patch
import AIOSomecomfort import aiosomecomfort
import pytest import pytest
from homeassistant import data_entry_flow from homeassistant import data_entry_flow
@ -39,7 +39,7 @@ async def test_show_authenticate_form(hass: HomeAssistant) -> None:
async def test_connection_error(hass: HomeAssistant, client: MagicMock) -> None: async def test_connection_error(hass: HomeAssistant, client: MagicMock) -> None:
"""Test that an error message is shown on connection fail.""" """Test that an error message is shown on connection fail."""
client.login.side_effect = AIOSomecomfort.device.ConnectionError client.login.side_effect = aiosomecomfort.device.ConnectionError
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=FAKE_CONFIG DOMAIN, context={"source": SOURCE_USER}, data=FAKE_CONFIG
) )
@ -48,7 +48,7 @@ async def test_connection_error(hass: HomeAssistant, client: MagicMock) -> None:
async def test_auth_error(hass: HomeAssistant, client: MagicMock) -> None: async def test_auth_error(hass: HomeAssistant, client: MagicMock) -> None:
"""Test that an error message is shown on login fail.""" """Test that an error message is shown on login fail."""
client.login.side_effect = AIOSomecomfort.device.AuthError client.login.side_effect = aiosomecomfort.device.AuthError
result = await hass.config_entries.flow.async_init( result = await hass.config_entries.flow.async_init(
DOMAIN, context={"source": SOURCE_USER}, data=FAKE_CONFIG DOMAIN, context={"source": SOURCE_USER}, data=FAKE_CONFIG
@ -193,7 +193,7 @@ async def test_reauth_flow_auth_error(hass: HomeAssistant, client: MagicMock) ->
assert result["type"] == FlowResultType.FORM assert result["type"] == FlowResultType.FORM
assert result["errors"] == {} assert result["errors"] == {}
client.login.side_effect = AIOSomecomfort.device.AuthError client.login.side_effect = aiosomecomfort.device.AuthError
with patch( with patch(
"homeassistant.components.honeywell.async_setup_entry", "homeassistant.components.honeywell.async_setup_entry",
return_value=True, return_value=True,
@ -211,8 +211,8 @@ async def test_reauth_flow_auth_error(hass: HomeAssistant, client: MagicMock) ->
@pytest.mark.parametrize( @pytest.mark.parametrize(
"error", "error",
[ [
AIOSomecomfort.device.ConnectionError, aiosomecomfort.device.ConnectionError,
AIOSomecomfort.device.ConnectionTimeout, aiosomecomfort.device.ConnectionTimeout,
asyncio.TimeoutError, asyncio.TimeoutError,
], ],
) )

View file

@ -2,7 +2,7 @@
from unittest.mock import create_autospec, patch from unittest.mock import create_autospec, patch
import AIOSomecomfort import aiosomecomfort
from homeassistant.components.honeywell.const import ( from homeassistant.components.honeywell.const import (
CONF_COOL_AWAY_TEMPERATURE, CONF_COOL_AWAY_TEMPERATURE,
@ -46,7 +46,7 @@ async def test_setup_multiple_thermostats_with_same_deviceid(
hass: HomeAssistant, caplog, config_entry: MockConfigEntry, device, client hass: HomeAssistant, caplog, config_entry: MockConfigEntry, device, client
) -> None: ) -> None:
"""Test Honeywell TCC API returning duplicate device IDs.""" """Test Honeywell TCC API returning duplicate device IDs."""
mock_location2 = create_autospec(AIOSomecomfort.Location, instance=True) mock_location2 = create_autospec(aiosomecomfort.Location, instance=True)
mock_location2.locationid.return_value = "location2" mock_location2.locationid.return_value = "location2"
mock_location2.devices_by_id = {device.deviceid: device} mock_location2.devices_by_id = {device.deviceid: device}
client.locations_by_id["location2"] = mock_location2 client.locations_by_id["location2"] = mock_location2

View file

@ -1,6 +1,6 @@
"""Test honeywell sensor.""" """Test honeywell sensor."""
from AIOSomecomfort.device import Device from aiosomecomfort.device import Device
from AIOSomecomfort.location import Location from aiosomecomfort.location import Location
import pytest import pytest
from homeassistant.core import HomeAssistant from homeassistant.core import HomeAssistant