From a3692859e90aca5242ce82d617d527b5abd89920 Mon Sep 17 00:00:00 2001 From: Khole Date: Wed, 30 Sep 2020 23:02:42 +0100 Subject: [PATCH 1/8] Update Pyhiveapi Library Version (#40804) * Update Pyhiveapi Library Version This fixs an issue caused by a change in authentication method by hive * Update Library Version --- homeassistant/components/hive/manifest.json | 2 +- requirements_all.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/hive/manifest.json b/homeassistant/components/hive/manifest.json index 060a1a0a200..f8fb9bc8c2a 100644 --- a/homeassistant/components/hive/manifest.json +++ b/homeassistant/components/hive/manifest.json @@ -2,6 +2,6 @@ "domain": "hive", "name": "Hive", "documentation": "https://www.home-assistant.io/integrations/hive", - "requirements": ["pyhiveapi==0.2.20.1"], + "requirements": ["pyhiveapi==0.2.20.2"], "codeowners": ["@Rendili", "@KJonline"] } diff --git a/requirements_all.txt b/requirements_all.txt index 6aa3e39b844..b8ff2d8ea33 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1401,7 +1401,7 @@ pyheos==0.6.0 pyhik==0.2.7 # homeassistant.components.hive -pyhiveapi==0.2.20.1 +pyhiveapi==0.2.20.2 # homeassistant.components.homematic pyhomematic==0.1.68 From 60fe64d1198164ffc12b3912fcb9546394f2c9e2 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 8 Oct 2020 09:09:50 -0500 Subject: [PATCH 2/8] Ensure recorder commit can retry after encountering invalid data (#41426) --- homeassistant/components/recorder/__init__.py | 3 +- tests/components/recorder/test_init.py | 39 +++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/recorder/__init__.py b/homeassistant/components/recorder/__init__.py index 63d466fa4d1..9630f94d807 100644 --- a/homeassistant/components/recorder/__init__.py +++ b/homeassistant/components/recorder/__init__.py @@ -494,7 +494,8 @@ class Recorder(threading.Thread): for dbstate in self._pending_expunge: # Expunge the state so its not expired # until we use it later for dbstate.old_state - self.event_session.expunge(dbstate) + if dbstate in self.event_session: + self.event_session.expunge(dbstate) self._pending_expunge = [] self.event_session.commit() except Exception as err: diff --git a/tests/components/recorder/test_init.py b/tests/components/recorder/test_init.py index 08af027bce3..c33455c0858 100644 --- a/tests/components/recorder/test_init.py +++ b/tests/components/recorder/test_init.py @@ -4,6 +4,7 @@ from datetime import datetime, timedelta import unittest import pytest +from sqlalchemy.exc import OperationalError from homeassistant.components.recorder import ( CONFIG_SCHEMA, @@ -452,3 +453,41 @@ def test_run_information(hass_recorder): class CannotSerializeMe: """A class that the JSONEncoder cannot serialize.""" + + +def test_saving_state_with_exception(hass, hass_recorder, caplog): + """Test saving and restoring a state.""" + hass = hass_recorder() + + entity_id = "test.recorder" + state = "restoring_from_db" + attributes = {"test_attr": 5, "test_attr_10": "nice"} + + def _throw_if_state_in_session(*args, **kwargs): + for obj in hass.data[DATA_INSTANCE].event_session: + if isinstance(obj, States): + raise OperationalError( + "insert the state", "fake params", "forced to fail" + ) + + with patch("time.sleep"), patch.object( + hass.data[DATA_INSTANCE].event_session, + "flush", + side_effect=_throw_if_state_in_session, + ): + hass.states.set(entity_id, "fail", attributes) + wait_recording_done(hass) + + assert "Error executing query" in caplog.text + assert "Error saving events" not in caplog.text + + caplog.clear() + hass.states.set(entity_id, state, attributes) + wait_recording_done(hass) + + with session_scope(hass=hass) as session: + db_states = list(session.query(States)) + assert len(db_states) >= 1 + + assert "Error executing query" not in caplog.text + assert "Error saving events" not in caplog.text From 0a55f024a48952d49767a1657b9419fdcf4959ae Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 8 Oct 2020 12:31:46 +0200 Subject: [PATCH 3/8] Downgrade Paho MQTT to 1.5.0 (#41479) --- homeassistant/components/mqtt/manifest.json | 2 +- homeassistant/package_constraints.txt | 2 +- requirements_all.txt | 2 ++ requirements_test_all.txt | 3 +-- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/mqtt/manifest.json b/homeassistant/components/mqtt/manifest.json index 4d44090a4e3..8b293eb06f6 100644 --- a/homeassistant/components/mqtt/manifest.json +++ b/homeassistant/components/mqtt/manifest.json @@ -3,7 +3,7 @@ "name": "MQTT", "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/mqtt", - "requirements": ["paho-mqtt==1.5.1"], + "requirements": ["paho-mqtt==1.5.0"], "dependencies": ["http"], "codeowners": ["@home-assistant/core", "@emontnemery"] } diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index cdda546a4e1..fd250ec7661 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -17,7 +17,7 @@ home-assistant-frontend==20201001.1 importlib-metadata==1.6.0;python_version<'3.8' jinja2>=2.11.2 netdisco==2.8.2 -paho-mqtt==1.5.1 +paho-mqtt==1.5.0 pillow==7.2.0 pip>=8.0.3 python-slugify==4.0.1 diff --git a/requirements_all.txt b/requirements_all.txt index b8ff2d8ea33..e8e013bba35 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1058,6 +1058,8 @@ orvibo==1.1.1 ovoenergy==1.1.7 # homeassistant.components.mqtt +paho-mqtt==1.5.0 + # homeassistant.components.shiftr paho-mqtt==1.5.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index deff4c9aafc..12f7ecf4661 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -499,8 +499,7 @@ openerz-api==0.1.0 ovoenergy==1.1.7 # homeassistant.components.mqtt -# homeassistant.components.shiftr -paho-mqtt==1.5.1 +paho-mqtt==1.5.0 # homeassistant.components.panasonic_viera panasonic_viera==0.3.6 From cc4d71f942697f1272f7869e9109a63531eca4cf Mon Sep 17 00:00:00 2001 From: cgtobi Date: Thu, 8 Oct 2020 15:08:15 +0200 Subject: [PATCH 4/8] Bump pyatmo version to 4.1.0 (#41487) --- homeassistant/components/netatmo/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/netatmo/manifest.json b/homeassistant/components/netatmo/manifest.json index b7205431bb5..12c9220c361 100644 --- a/homeassistant/components/netatmo/manifest.json +++ b/homeassistant/components/netatmo/manifest.json @@ -3,7 +3,7 @@ "name": "Netatmo", "documentation": "https://www.home-assistant.io/integrations/netatmo", "requirements": [ - "pyatmo==4.0.0" + "pyatmo==4.1.0" ], "after_dependencies": [ "cloud", diff --git a/requirements_all.txt b/requirements_all.txt index e8e013bba35..9cd48fab164 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -1252,7 +1252,7 @@ pyarlo==0.2.3 pyatag==0.3.4.4 # homeassistant.components.netatmo -pyatmo==4.0.0 +pyatmo==4.1.0 # homeassistant.components.atome pyatome==0.1.1 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 12f7ecf4661..60e53a0b1b5 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -615,7 +615,7 @@ pyarlo==0.2.3 pyatag==0.3.4.4 # homeassistant.components.netatmo -pyatmo==4.0.0 +pyatmo==4.1.0 # homeassistant.components.blackbird pyblackbird==0.5 From 22f76a93636a32e1788249205ea4d7dab5e55028 Mon Sep 17 00:00:00 2001 From: Guido Schmitz Date: Thu, 8 Oct 2020 16:48:05 +0200 Subject: [PATCH 5/8] Fix async_unload_entry for devolo Home Control (#41488) --- .../components/devolo_home_control/__init__.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/homeassistant/components/devolo_home_control/__init__.py b/homeassistant/components/devolo_home_control/__init__.py index c955bf77096..69327f96510 100644 --- a/homeassistant/components/devolo_home_control/__init__.py +++ b/homeassistant/components/devolo_home_control/__init__.py @@ -1,4 +1,5 @@ """The devolo_home_control integration.""" +import asyncio from functools import partial from devolo_home_control_api.homecontrol import HomeControl @@ -71,8 +72,13 @@ async def async_setup_entry(hass: HomeAssistantType, entry: ConfigEntry) -> bool async def async_unload_entry(hass, config_entry): """Unload a config entry.""" - unload = await hass.config_entries.async_forward_entry_unload( - config_entry, "switch" + unload = all( + await asyncio.gather( + *[ + hass.config_entries.async_forward_entry_unload(config_entry, platform) + for platform in PLATFORMS + ] + ) ) await hass.async_add_executor_job( From 90d88748250f016beaf7b8f480ec53ce0ffb2e0e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 8 Oct 2020 16:00:34 +0200 Subject: [PATCH 6/8] Update frontend to 20201001.2 (#41491) --- 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 6732f6e99c3..fd3d4a497ab 100644 --- a/homeassistant/components/frontend/manifest.json +++ b/homeassistant/components/frontend/manifest.json @@ -2,7 +2,7 @@ "domain": "frontend", "name": "Home Assistant Frontend", "documentation": "https://www.home-assistant.io/integrations/frontend", - "requirements": ["home-assistant-frontend==20201001.1"], + "requirements": ["home-assistant-frontend==20201001.2"], "dependencies": [ "api", "auth", diff --git a/homeassistant/package_constraints.txt b/homeassistant/package_constraints.txt index fd250ec7661..c510ded1e5f 100644 --- a/homeassistant/package_constraints.txt +++ b/homeassistant/package_constraints.txt @@ -13,7 +13,7 @@ defusedxml==0.6.0 distro==1.5.0 emoji==0.5.4 hass-nabucasa==0.37.0 -home-assistant-frontend==20201001.1 +home-assistant-frontend==20201001.2 importlib-metadata==1.6.0;python_version<'3.8' jinja2>=2.11.2 netdisco==2.8.2 diff --git a/requirements_all.txt b/requirements_all.txt index 9cd48fab164..c291319b2f3 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -753,7 +753,7 @@ hole==0.5.1 holidays==0.10.3 # homeassistant.components.frontend -home-assistant-frontend==20201001.1 +home-assistant-frontend==20201001.2 # homeassistant.components.zwave homeassistant-pyozw==0.1.10 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 60e53a0b1b5..a977daa08e0 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -376,7 +376,7 @@ hole==0.5.1 holidays==0.10.3 # homeassistant.components.frontend -home-assistant-frontend==20201001.1 +home-assistant-frontend==20201001.2 # homeassistant.components.zwave homeassistant-pyozw==0.1.10 From 26ba956242abdde17c1a6bb8320b31bf90882a0e Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 8 Oct 2020 15:48:36 +0000 Subject: [PATCH 7/8] Bumped version to 0.116.1 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index 35b4b234597..bbf942c94d3 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 116 -PATCH_VERSION = "0" +PATCH_VERSION = "1" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 7, 1) From 3a1ee2f654f6d19dd44943c8c4601a8ac09e184b Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 8 Oct 2020 10:58:52 -0500 Subject: [PATCH 8/8] Add missing on states to media player groups (#41496) --- homeassistant/components/media_player/group.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/homeassistant/components/media_player/group.py b/homeassistant/components/media_player/group.py index b612165fa19..6ecf90fc0a1 100644 --- a/homeassistant/components/media_player/group.py +++ b/homeassistant/components/media_player/group.py @@ -2,16 +2,22 @@ from homeassistant.components.group import GroupIntegrationRegistry -from homeassistant.const import STATE_OFF +from homeassistant.const import ( + STATE_IDLE, + STATE_OFF, + STATE_ON, + STATE_PAUSED, + STATE_PLAYING, +) from homeassistant.core import callback from homeassistant.helpers.typing import HomeAssistantType -from . import STATE_IDLE, STATE_PLAYING - @callback def async_describe_on_off_states( hass: HomeAssistantType, registry: GroupIntegrationRegistry ) -> None: """Describe group on off states.""" - registry.on_off_states({STATE_PLAYING, STATE_IDLE}, STATE_OFF) + registry.on_off_states( + {STATE_ON, STATE_PAUSED, STATE_PLAYING, STATE_IDLE}, STATE_OFF + )