From f8d547f2d3df84735441fbe6c8bab0cb6fab489d Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Tue, 14 Jul 2020 10:31:34 -1000 Subject: [PATCH] Adjust history as all scripts can now be canceled (#37820) --- homeassistant/components/history/__init__.py | 15 +-------------- tests/components/history/test_init.py | 2 -- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/homeassistant/components/history/__init__.py b/homeassistant/components/history/__init__.py index 4267127e209..9354800b843 100644 --- a/homeassistant/components/history/__init__.py +++ b/homeassistant/components/history/__init__.py @@ -73,12 +73,9 @@ IGNORE_DOMAINS = ("zone", "scene") NEED_ATTRIBUTE_DOMAINS = { "climate", "humidifier", - "script", "thermostat", "water_heater", } -SCRIPT_DOMAIN = "script" -ATTR_CAN_CANCEL = "can_cancel" QUERY_STATES = [ States.domain, @@ -380,17 +377,7 @@ def _sorted_states_to_json( domain = split_entity_id(ent_id)[0] ent_results = result[ent_id] if not minimal_response or domain in NEED_ATTRIBUTE_DOMAINS: - if domain == SCRIPT_DOMAIN: - ent_results.extend( - [ - native_state - for native_state in (LazyState(db_state) for db_state in group) - if native_state.attributes.get(ATTR_CAN_CANCEL) - ] - ) - else: - ent_results.extend(LazyState(db_state) for db_state in group) - continue + ent_results.extend(LazyState(db_state) for db_state in group) # With minimal response we only provide a native # State for the first and last response. All the states diff --git a/tests/components/history/test_init.py b/tests/components/history/test_init.py index b50ea339683..e9544ce9035 100644 --- a/tests/components/history/test_init.py +++ b/tests/components/history/test_init.py @@ -690,7 +690,6 @@ class TestComponentHistory(unittest.TestCase): therm = "thermostat.test" therm2 = "thermostat.test2" zone = "zone.home" - script_nc = "script.cannot_cancel_this_one" script_c = "script.can_cancel_this_one" def set_state(entity_id, state, **kwargs): @@ -732,7 +731,6 @@ class TestComponentHistory(unittest.TestCase): set_state(mp, "YouTube", attributes={"media_title": str(sentinel.mt3)}) # This state will be skipped because domain is excluded set_state(zone, "zoning") - set_state(script_nc, "off") states[script_c].append( set_state(script_c, "off", attributes={"can_cancel": True}) )