From 7f9017316b3b6f718c6b94ea7a3f15e0b6179144 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 18 Feb 2022 11:43:29 -0800 Subject: [PATCH 1/8] Bump frontend to 20220203.1 (#66827) --- homeassistant/components/frontend/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/frontend/manifest.json b/homeassistant/components/frontend/manifest.json index e29b27e9026..36f55df0932 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -3,7 +3,7 @@ "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", "requirements": [ - "home-assistant-frontend==20220203.0" + "home-assistant-frontend==20220203.1" ], "dependencies": [ "api", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index 5cded6a179d..0bf79dafd6f 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -15,7 +15,7 @@ ciso8601==2.2.0 cryptography==35.0.0 emoji==1.6.3 hass-nabucasa==0.52.0 -home-assistant-frontend==20220203.0 +home-assistant-frontend==20220203.1 httpx==0.21.3 ifaddr==0.1.7 jinja2==3.0.3 diff --git a/requirements_all.txt b/requirements_all.txt index be01347cb8b..8f3f1214dcd 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -842,7 +842,7 @@ hole==0.7.0 holidays==0.12 # homeassistant.components.frontend -home-assistant-frontend==20220203.0 +home-assistant-frontend==20220203.1 # homeassistant.components.zwave homeassistant-pyozw==0.1.10 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 587ec2ec374..c9f72b96c46 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -543,7 +543,7 @@ hole==0.7.0 holidays==0.12 # homeassistant.components.frontend -home-assistant-frontend==20220203.0 +home-assistant-frontend==20220203.1 # homeassistant.components.zwave homeassistant-pyozw==0.1.10 From 86aad35e77969a708a69d327860b393a913ddc1e Mon Sep 17 00:00:00 2001 From: Sascha Sander Date: Fri, 18 Feb 2022 15:00:49 +0100 Subject: [PATCH 2/8] Correct current temperature for tuya thermostats (#66715) Co-authored-by: Franck Nijhof --- homeassistant/components/tuya/climate.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/homeassistant/components/tuya/climate.py b/homeassistant/components/tuya/climate.py index c29c46b6bf8..700b974e3c9 100644 --- a/homeassistant/components/tuya/climate.py +++ b/homeassistant/components/tuya/climate.py @@ -353,6 +353,13 @@ class TuyaClimateEntity(TuyaEntity, ClimateEntity): if temperature is None: return None + if self._current_temperature.scale == 0 and self._current_temperature.step != 1: + # The current temperature can have a scale of 0 or 1 and is used for + # rounding, Home Assistant doesn't need to round but we will always + # need to divide the value by 10^1 in case of 0 as scale. + # https://developer.tuya.com/en/docs/iot/shift-temperature-scale-follow-the-setting-of-app-account-center?id=Ka9qo7so58efq#title-7-Round%20values + temperature = temperature / 10 + return self._current_temperature.scale_value(temperature) @property From 6ebf520a0c8f9e9c986a0be4d2ca4ad3c9cef758 Mon Sep 17 00:00:00 2001 From: epenet <6771947+epenet@users.noreply.github.com> Date: Thu, 17 Feb 2022 21:49:01 +0100 Subject: [PATCH 3/8] Ensure new samsungtv token is updated in the config_entry (#66731) Co-authored-by: epenet --- .../components/samsungtv/__init__.py | 14 +++++++++++ homeassistant/components/samsungtv/bridge.py | 25 +++++++++++++------ 2 files changed, 32 insertions(+), 7 deletions(-) diff --git a/homeassistant/components/samsungtv/__init__.py b/homeassistant/components/samsungtv/__init__.py index 212ef6c23ca..515e5c0de96 100644 --- a/homeassistant/components/samsungtv/__init__.py +++ b/homeassistant/components/samsungtv/__init__.py @@ -24,6 +24,7 @@ from homeassistant.core import Event, HomeAssistant, callback from homeassistant.exceptions import ConfigEntryNotReady import homeassistant.helpers.config_validation as cv from homeassistant.helpers.typing import ConfigType +from homeassistant.util.async_ import run_callback_threadsafe from .bridge import ( SamsungTVBridge, @@ -117,6 +118,19 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry) -> bool: # Initialize bridge bridge = await _async_create_bridge_with_updated_data(hass, entry) + # Ensure new token gets saved against the config_entry + def _update_token() -> None: + """Update config entry with the new token.""" + hass.config_entries.async_update_entry( + entry, data={**entry.data, CONF_TOKEN: bridge.token} + ) + + def new_token_callback() -> None: + """Update config entry with the new token.""" + run_callback_threadsafe(hass.loop, _update_token) + + bridge.register_new_token_callback(new_token_callback) + def stop_bridge(event: Event) -> None: """Stop SamsungTV bridge connection.""" bridge.stop() diff --git a/homeassistant/components/samsungtv/bridge.py b/homeassistant/components/samsungtv/bridge.py index d4d23a03389..64705435fc5 100644 --- a/homeassistant/components/samsungtv/bridge.py +++ b/homeassistant/components/samsungtv/bridge.py @@ -98,11 +98,16 @@ class SamsungTVBridge(ABC): self.host = host self.token: str | None = None self._remote: Remote | None = None - self._callback: CALLBACK_TYPE | None = None + self._reauth_callback: CALLBACK_TYPE | None = None + self._new_token_callback: CALLBACK_TYPE | None = None def register_reauth_callback(self, func: CALLBACK_TYPE) -> None: """Register a callback function.""" - self._callback = func + self._reauth_callback = func + + def register_new_token_callback(self, func: CALLBACK_TYPE) -> None: + """Register a callback function.""" + self._new_token_callback = func @abstractmethod def try_connect(self) -> str | None: @@ -176,10 +181,15 @@ class SamsungTVBridge(ABC): except OSError: LOGGER.debug("Could not establish connection") - def _notify_callback(self) -> None: + def _notify_reauth_callback(self) -> None: """Notify access denied callback.""" - if self._callback is not None: - self._callback() + if self._reauth_callback is not None: + self._reauth_callback() + + def _notify_new_token_callback(self) -> None: + """Notify new token callback.""" + if self._new_token_callback is not None: + self._new_token_callback() class SamsungTVLegacyBridge(SamsungTVBridge): @@ -245,7 +255,7 @@ class SamsungTVLegacyBridge(SamsungTVBridge): # This is only happening when the auth was switched to DENY # A removed auth will lead to socket timeout because waiting for auth popup is just an open socket except AccessDenied: - self._notify_callback() + self._notify_reauth_callback() raise except (ConnectionClosed, OSError): pass @@ -355,7 +365,7 @@ class SamsungTVWSBridge(SamsungTVBridge): # This is only happening when the auth was switched to DENY # A removed auth will lead to socket timeout because waiting for auth popup is just an open socket except ConnectionFailure: - self._notify_callback() + self._notify_reauth_callback() except (WebSocketException, OSError): self._remote = None else: @@ -365,6 +375,7 @@ class SamsungTVWSBridge(SamsungTVBridge): self._remote.token, ) self.token = self._remote.token + self._notify_new_token_callback() return self._remote def stop(self) -> None: From def8e933d7299796ad579a8971c756d742a5b64d Mon Sep 17 00:00:00 2001 From: Tom Harris Date: Thu, 17 Feb 2022 15:52:06 -0500 Subject: [PATCH 4/8] Bump pyinsteon to 1.0.16 (#66759) --- homeassistant/components/insteon/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/insteon/manifest.json b/homeassistant/components/insteon/manifest.json index e00a85a9823..3b0cdee1cc3 100644 --- a/homeassistant/components/insteon/manifest.json +++ b/homeassistant/components/insteon/manifest.json @@ -3,7 +3,7 @@ "name": "Insteon", "documentation": "https://www.home-assistant.io/integrations/insteon", "requirements": [ - "pyinsteon==1.0.14" + "pyinsteon==1.0.16" ], "codeowners": [ "@teharris1" diff --git a/requirements_all.txt b/requirements_all.txt index 8f3f1214dcd..82bd6422be3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1582,7 +1582,7 @@ pyialarm==1.9.0 pyicloud==0.10.2 # homeassistant.components.insteon -pyinsteon==1.0.14 +pyinsteon==1.0.16 # homeassistant.components.intesishome pyintesishome==1.7.6 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index c9f72b96c46..95fa6057b10 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -987,7 +987,7 @@ pyialarm==1.9.0 pyicloud==0.10.2 # homeassistant.components.insteon -pyinsteon==1.0.14 +pyinsteon==1.0.16 # homeassistant.components.ipma pyipma==2.0.5 From 480de899fbf3212356cc54aab3593d56daa838c5 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Thu, 17 Feb 2022 21:13:09 +0200 Subject: [PATCH 5/8] Fix webostv notify service (#66760) --- homeassistant/components/webostv/notify.py | 4 ++-- tests/components/webostv/test_notify.py | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/webostv/notify.py b/homeassistant/components/webostv/notify.py index df2ed7e5063..7348e978d02 100644 --- a/homeassistant/components/webostv/notify.py +++ b/homeassistant/components/webostv/notify.py @@ -46,8 +46,8 @@ class LgWebOSNotificationService(BaseNotificationService): if not self._client.is_connected(): await self._client.connect() - data = kwargs.get(ATTR_DATA) - icon_path = data.get(CONF_ICON, "") if data else None + data = kwargs.get(ATTR_DATA, {}) + icon_path = data.get(CONF_ICON) await self._client.send_message(message, icon_path=icon_path) except WebOsTvPairError: _LOGGER.error("Pairing with TV failed") diff --git a/tests/components/webostv/test_notify.py b/tests/components/webostv/test_notify.py index a5188545737..7e150c6eb78 100644 --- a/tests/components/webostv/test_notify.py +++ b/tests/components/webostv/test_notify.py @@ -36,6 +36,21 @@ async def test_notify(hass, client): assert client.connect.call_count == 1 client.send_message.assert_called_with(MESSAGE, icon_path=ICON_PATH) + await hass.services.async_call( + NOTIFY_DOMAIN, + TV_NAME, + { + ATTR_MESSAGE: MESSAGE, + CONF_SERVICE_DATA: { + "OTHER_DATA": "not_used", + }, + }, + blocking=True, + ) + assert client.mock_calls[0] == call.connect() + assert client.connect.call_count == 1 + client.send_message.assert_called_with(MESSAGE, icon_path=None) + async def test_notify_not_connected(hass, client, monkeypatch): """Test sending a message when client is not connected.""" From ef85afde6dc5da655ef05ab7382261815758efd1 Mon Sep 17 00:00:00 2001 From: Shay Levy Date: Fri, 18 Feb 2022 00:46:18 +0200 Subject: [PATCH 6/8] Handle default notify data in webostv (#66770) --- homeassistant/components/webostv/notify.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/webostv/notify.py b/homeassistant/components/webostv/notify.py index 7348e978d02..46f0086e0f6 100644 --- a/homeassistant/components/webostv/notify.py +++ b/homeassistant/components/webostv/notify.py @@ -46,8 +46,8 @@ class LgWebOSNotificationService(BaseNotificationService): if not self._client.is_connected(): await self._client.connect() - data = kwargs.get(ATTR_DATA, {}) - icon_path = data.get(CONF_ICON) + data = kwargs.get(ATTR_DATA) + icon_path = data.get(CONF_ICON) if data else None await self._client.send_message(message, icon_path=icon_path) except WebOsTvPairError: _LOGGER.error("Pairing with TV failed") From 474cf4be0429a4bc9e0ef8282ab5b39847ea3b55 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 18 Feb 2022 11:40:56 -0800 Subject: [PATCH 7/8] Bump aiohue to 4.2.1 (#66823) --- homeassistant/components/hue/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/hue/manifest.json b/homeassistant/components/hue/manifest.json index af346d1f8f6..318dacd3449 100644 --- a/homeassistant/components/hue/manifest.json +++ b/homeassistant/components/hue/manifest.json @@ -3,7 +3,7 @@ "name": "Philips Hue", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/hue", - "requirements": ["aiohue==4.2.0"], + "requirements": ["aiohue==4.2.1"], "ssdp": [ { "manufacturer": "Royal Philips Electronics", diff --git a/requirements_all.txt b/requirements_all.txt index 82bd6422be3..739bb68f0a3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -191,7 +191,7 @@ aiohomekit==0.6.11 aiohttp_cors==0.7.0 # homeassistant.components.hue -aiohue==4.2.0 +aiohue==4.2.1 # homeassistant.components.homewizard aiohwenergy==0.8.0 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 95fa6057b10..3def0a7de10 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -141,7 +141,7 @@ aiohomekit==0.6.11 aiohttp_cors==0.7.0 # homeassistant.components.hue -aiohue==4.2.0 +aiohue==4.2.1 # homeassistant.components.homewizard aiohwenergy==0.8.0 From 15ca244c3c22f02a5a1eb4fb402e1fcc32f27c9e Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 18 Feb 2022 11:51:56 -0800 Subject: [PATCH 8/8] Bumped version to 2022.2.9 --- homeassistant/const.py | 2 +- setup.cfg | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 87f4ff4798f..1aa0b3cc35d 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -7,7 +7,7 @@ from .backports.enum import StrEnum MAJOR_VERSION: Final = 2022 MINOR_VERSION: Final = 2 -PATCH_VERSION: Final = "8" +PATCH_VERSION: Final = "9" __short_version__: Final = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__: Final = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER: Final[tuple[int, int, int]] = (3, 9, 0) diff --git a/setup.cfg b/setup.cfg index b08c1185f15..9ce81a08a10 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = homeassistant -version = 2022.2.8 +version = 2022.2.9 author = The Home Assistant Authors author_email = hello@home-assistant.io license = Apache-2.0