From 65b099b25aea880e62611429be6ff8687c043c87 Mon Sep 17 00:00:00 2001 From: Eric Nagley Date: Thu, 29 Nov 2018 15:08:09 -0500 Subject: [PATCH 1/3] BUGFIX: add support for extra fan speeds. --- homeassistant/components/google_assistant/trait.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index e0d12e00e305f..efc3b1a1790a2 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -717,7 +717,7 @@ def sync_attributes(self): speed = { "speed_name": mode, "speed_values": [{ - "speed_synonym": self.speed_synonyms.get(mode), + "speed_synonym": self.speed_synonyms.get(mode, [mode]), "lang": 'en' }] } From 3ac3407e96004211c5f5f3f82cf98a898ac3358b Mon Sep 17 00:00:00 2001 From: Eric Nagley Date: Thu, 29 Nov 2018 15:30:59 -0500 Subject: [PATCH 2/3] Drop extra fan speeds. Remove catch all, drop missing fan speeds. --- homeassistant/components/google_assistant/trait.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index efc3b1a1790a2..5cf325ed55f7b 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -714,10 +714,12 @@ def sync_attributes(self): modes = self.state.attributes.get(fan.ATTR_SPEED_LIST, []) speeds = [] for mode in modes: + if mode not in speed_synonyms.keys(): + continue speed = { "speed_name": mode, "speed_values": [{ - "speed_synonym": self.speed_synonyms.get(mode, [mode]), + "speed_synonym": self.speed_synonyms.get(mode), "lang": 'en' }] } From 5761cf3c6d82dba4d0c75f73df83bb7d21d690cd Mon Sep 17 00:00:00 2001 From: Eric Nagley Date: Thu, 29 Nov 2018 15:47:29 -0500 Subject: [PATCH 3/3] fix self.speed_synonyms call. Remove un-needed keys() call --- homeassistant/components/google_assistant/trait.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 5cf325ed55f7b..30fac4350d3d7 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -714,7 +714,7 @@ def sync_attributes(self): modes = self.state.attributes.get(fan.ATTR_SPEED_LIST, []) speeds = [] for mode in modes: - if mode not in speed_synonyms.keys(): + if mode not in self.speed_synonyms: continue speed = { "speed_name": mode,