From cdde5a37cdfb94db0b273009ef97e88577432288 Mon Sep 17 00:00:00 2001 From: Alan Tse Date: Tue, 3 Mar 2020 18:25:32 -0800 Subject: [PATCH 1/7] Fix too many device tracker updates in log for Tesla (#32426) * Fix Tesla too many device tracker updates in log * Empty commit to re-trigger build Co-authored-by: Franck Nijhof --- homeassistant/components/tesla/device_tracker.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/homeassistant/components/tesla/device_tracker.py b/homeassistant/components/tesla/device_tracker.py index 08e5d58ba6e..f39d8055b12 100644 --- a/homeassistant/components/tesla/device_tracker.py +++ b/homeassistant/components/tesla/device_tracker.py @@ -68,3 +68,8 @@ class TeslaDeviceEntity(TeslaDevice, TrackerEntity): def source_type(self): """Return the source type, eg gps or router, of the device.""" return SOURCE_TYPE_GPS + + @property + def force_update(self): + """All updates do not need to be written to the state machine.""" + return False From f04969cf30fafd6557847dc866ef4f3d0737cc12 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Mar 2020 13:56:32 -0800 Subject: [PATCH 2/7] Filter out duplicate logbook states (#32427) --- homeassistant/components/logbook/__init__.py | 11 ++++++- tests/components/logbook/test_init.py | 33 ++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/logbook/__init__.py b/homeassistant/components/logbook/__init__.py index ac45a636bf7..5d07a1fa0b5 100644 --- a/homeassistant/components/logbook/__init__.py +++ b/homeassistant/components/logbook/__init__.py @@ -199,6 +199,9 @@ def humanify(hass, events): """ domain_prefixes = tuple(f"{dom}." for dom in CONTINUOUS_DOMAINS) + # Track last states to filter out duplicates + last_state = {} + # Group events in batches of GROUP_BY_MINUTES for _, g_events in groupby( events, lambda event: event.time_fired.minute // GROUP_BY_MINUTES @@ -236,9 +239,15 @@ def humanify(hass, events): # Yield entries for event in events_batch: if event.event_type == EVENT_STATE_CHANGED: - to_state = State.from_dict(event.data.get("new_state")) + # Filter out states that become same state again (force_update=True) + # or light becoming different color + if last_state.get(to_state.entity_id) == to_state.state: + continue + + last_state[to_state.entity_id] = to_state.state + domain = to_state.domain # Skip all but the last sensor state diff --git a/tests/components/logbook/test_init.py b/tests/components/logbook/test_init.py index 70e769a54f2..750ad17b523 100644 --- a/tests/components/logbook/test_init.py +++ b/tests/components/logbook/test_init.py @@ -1484,3 +1484,36 @@ async def test_humanify_script_started_event(hass): assert event2["domain"] == "script" assert event2["message"] == "started" assert event2["entity_id"] == "script.bye" + + +async def test_humanify_same_state(hass): + """Test humanifying Script Run event.""" + state_50 = ha.State("light.kitchen", "on", {"brightness": 50}).as_dict() + state_100 = ha.State("light.kitchen", "on", {"brightness": 100}).as_dict() + state_200 = ha.State("light.kitchen", "on", {"brightness": 200}).as_dict() + + events = list( + logbook.humanify( + hass, + [ + ha.Event( + EVENT_STATE_CHANGED, + { + "entity_id": "light.kitchen", + "old_state": state_50, + "new_state": state_100, + }, + ), + ha.Event( + EVENT_STATE_CHANGED, + { + "entity_id": "light.kitchen", + "old_state": state_100, + "new_state": state_200, + }, + ), + ], + ) + ) + + assert len(events) == 1 From 91b10e875faac7a114106e6ef8ddc267231c34a6 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 3 Mar 2020 11:25:50 -0600 Subject: [PATCH 3/7] =?UTF-8?q?Properly=20define=20dependency=20for=20pvou?= =?UTF-8?q?tput=20integration=20on=20rest=20in=E2=80=A6=20(#32435)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homeassistant/components/pvoutput/manifest.json | 1 + 1 file changed, 1 insertion(+) diff --git a/homeassistant/components/pvoutput/manifest.json b/homeassistant/components/pvoutput/manifest.json index 1cc1f7aa2f6..0ca7af3485d 100644 --- a/homeassistant/components/pvoutput/manifest.json +++ b/homeassistant/components/pvoutput/manifest.json @@ -4,5 +4,6 @@ "documentation": "https://www.home-assistant.io/integrations/pvoutput", "requirements": [], "dependencies": [], + "after_dependencies": ["rest"], "codeowners": ["@fabaff"] } From a0390783bb146a051d0d3403017e4819d256d573 Mon Sep 17 00:00:00 2001 From: Achilleas Pipinellis Date: Wed, 4 Mar 2020 02:36:28 +0100 Subject: [PATCH 4/7] Fix pushover's ATTR_RETRY env variable typo (#32440) --- homeassistant/components/pushover/notify.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/pushover/notify.py b/homeassistant/components/pushover/notify.py index bc44cbeddb7..01d4d8fddde 100644 --- a/homeassistant/components/pushover/notify.py +++ b/homeassistant/components/pushover/notify.py @@ -61,7 +61,7 @@ class PushoverNotificationService(BaseNotificationService): url = data.get(ATTR_URL, None) url_title = data.get(ATTR_URL_TITLE, None) priority = data.get(ATTR_PRIORITY, None) - retry = data.get(ATTR_PRIORITY, None) + retry = data.get(ATTR_RETRY, None) expire = data.get(ATTR_EXPIRE, None) callback_url = data.get(ATTR_CALLBACK_URL, None) timestamp = data.get(ATTR_TIMESTAMP, None) From a150d6dcf3184d2347f041b5f7eb03e8dbdd1b9a Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Mar 2020 13:57:09 -0800 Subject: [PATCH 5/7] Remove hassfest blacklisted rest (#32441) * Remove blacklisted deps from hassfest deps * Whitelist all internal integrations --- .../dwd_weather_warnings/manifest.json | 1 + .../components/emulated_hue/manifest.json | 1 + script/hassfest/dependencies.py | 62 ++++++++++++------- 3 files changed, 41 insertions(+), 23 deletions(-) diff --git a/homeassistant/components/dwd_weather_warnings/manifest.json b/homeassistant/components/dwd_weather_warnings/manifest.json index 19dcf2860d7..0a9f972c84e 100644 --- a/homeassistant/components/dwd_weather_warnings/manifest.json +++ b/homeassistant/components/dwd_weather_warnings/manifest.json @@ -4,5 +4,6 @@ "documentation": "https://www.home-assistant.io/integrations/dwd_weather_warnings", "requirements": [], "dependencies": [], + "after_dependencies": ["rest"], "codeowners": [] } diff --git a/homeassistant/components/emulated_hue/manifest.json b/homeassistant/components/emulated_hue/manifest.json index c3c0302dbc3..37848e6f306 100644 --- a/homeassistant/components/emulated_hue/manifest.json +++ b/homeassistant/components/emulated_hue/manifest.json @@ -4,6 +4,7 @@ "documentation": "https://www.home-assistant.io/integrations/emulated_hue", "requirements": ["aiohttp_cors==0.7.0"], "dependencies": [], + "after_dependencies": ["http"], "codeowners": [], "quality_scale": "internal" } diff --git a/script/hassfest/dependencies.py b/script/hassfest/dependencies.py index c909b6216a9..934400533e1 100644 --- a/script/hassfest/dependencies.py +++ b/script/hassfest/dependencies.py @@ -65,7 +65,7 @@ class ImportCollector(ast.NodeVisitor): # self.hass.components.hue.async_create() # Name(id=self) - # .Attribute(attr=hass) + # .Attribute(attr=hass) or .Attribute(attr=_hass) # .Attribute(attr=hue) # .Attribute(attr=async_create) if ( @@ -78,7 +78,7 @@ class ImportCollector(ast.NodeVisitor): ) or ( isinstance(node.value.value, ast.Attribute) - and node.value.value.attr == "hass" + and node.value.value.attr in ("hass", "_hass") ) ) ): @@ -89,20 +89,47 @@ class ImportCollector(ast.NodeVisitor): ALLOWED_USED_COMPONENTS = { - # This component will always be set up - "persistent_notification", - # These allow to register things without being set up - "conversation", - "frontend", - "hassio", - "system_health", - "websocket_api", + # Internal integrations + "alert", "automation", + "conversation", "device_automation", - "zone", + "frontend", + "group", + "hassio", "homeassistant", - "system_log", + "input_boolean", + "input_datetime", + "input_number", + "input_select", + "input_text", + "persistent_notification", "person", + "script", + "shopping_list", + "sun", + "system_health", + "system_log", + "timer", + "webhook", + "websocket_api", + "zone", + # Entity integrations with platforms + "alarm_control_panel", + "binary_sensor", + "climate", + "cover", + "device_tracker", + "fan", + "image_processing", + "light", + "lock", + "media_player", + "scene", + "sensor", + "switch", + "vacuum", + "water_heater", # Other "mjpeg", # base class, has no reqs or component to load. "stream", # Stream cannot install on all systems, can be imported without reqs. @@ -121,18 +148,7 @@ IGNORE_VIOLATIONS = { # This should become a helper method that integrations can submit data to ("websocket_api", "lovelace"), ("websocket_api", "shopping_list"), - # Expose HA to external systems - "homekit", - "alexa", - "google_assistant", - "emulated_hue", - "prometheus", - "conversation", "logbook", - "mobile_app", - # These should be extracted to external package - "pvoutput", - "dwd_weather_warnings", } From 6d0684431842e971b1641c7c36bd506f2d83b325 Mon Sep 17 00:00:00 2001 From: Robert Svensson Date: Wed, 4 Mar 2020 02:32:13 +0100 Subject: [PATCH 6/7] UniFi - Fix websocket bug (#32449) --- homeassistant/components/unifi/manifest.json | 2 +- requirements_all.txt | 2 +- requirements_test_all.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/homeassistant/components/unifi/manifest.json b/homeassistant/components/unifi/manifest.json index a42b136e665..85633ebf131 100644 --- a/homeassistant/components/unifi/manifest.json +++ b/homeassistant/components/unifi/manifest.json @@ -4,7 +4,7 @@ "config_flow": true, "documentation": "https://www.home-assistant.io/integrations/unifi", "requirements": [ - "aiounifi==13" + "aiounifi==14" ], "dependencies": [], "codeowners": [ diff --git a/requirements_all.txt b/requirements_all.txt index 3cae53619bf..111450d0193 100644 --- a/requirements_all.txt +++ b/requirements_all.txt @@ -199,7 +199,7 @@ aiopylgtv==0.3.3 aioswitcher==2019.4.26 # homeassistant.components.unifi -aiounifi==13 +aiounifi==14 # homeassistant.components.wwlln aiowwlln==2.0.2 diff --git a/requirements_test_all.txt b/requirements_test_all.txt index 42e71a8996e..26fd8eccdb2 100644 --- a/requirements_test_all.txt +++ b/requirements_test_all.txt @@ -78,7 +78,7 @@ aiopylgtv==0.3.3 aioswitcher==2019.4.26 # homeassistant.components.unifi -aiounifi==13 +aiounifi==14 # homeassistant.components.wwlln aiowwlln==2.0.2 From 4080d6a822b3474393e695daaa462c49cf7f4cc8 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Tue, 3 Mar 2020 18:26:19 -0800 Subject: [PATCH 7/7] Bumped version to 0.106.5 --- homeassistant/const.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/const.py b/homeassistant/const.py index fd4ac8cc1a1..aca7adc28a5 100644 --- a/homeassistant/const.py +++ b/homeassistant/const.py @@ -1,7 +1,7 @@ """Constants used by Home Assistant components.""" MAJOR_VERSION = 0 MINOR_VERSION = 106 -PATCH_VERSION = "4" +PATCH_VERSION = "5" __short_version__ = f"{MAJOR_VERSION}.{MINOR_VERSION}" __version__ = f"{__short_version__}.{PATCH_VERSION}" REQUIRED_PYTHON_VER = (3, 7, 0)