From bd0daf68e0377f5afe188c035ced801712dc12d8 Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Tue, 20 Sep 2022 13:57:54 +0200 Subject: [PATCH] If brightness is not available, don't set a value (#78827) --- homeassistant/components/google_assistant/trait.py | 2 -- tests/components/google_assistant/test_smart_home.py | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/homeassistant/components/google_assistant/trait.py b/homeassistant/components/google_assistant/trait.py index 8c253523561..d7b6b45de87 100644 --- a/homeassistant/components/google_assistant/trait.py +++ b/homeassistant/components/google_assistant/trait.py @@ -260,8 +260,6 @@ class BrightnessTrait(_Trait): brightness = self.state.attributes.get(light.ATTR_BRIGHTNESS) if brightness is not None: response["brightness"] = round(100 * (brightness / 255)) - else: - response["brightness"] = 0 return response diff --git a/tests/components/google_assistant/test_smart_home.py b/tests/components/google_assistant/test_smart_home.py index eefa163bdd8..3306cbbaf5a 100644 --- a/tests/components/google_assistant/test_smart_home.py +++ b/tests/components/google_assistant/test_smart_home.py @@ -383,7 +383,7 @@ async def test_query_message(hass): "payload": { "devices": { "light.non_existing": {"online": False}, - "light.demo_light": {"on": False, "online": True, "brightness": 0}, + "light.demo_light": {"on": False, "online": True}, "light.another_light": { "on": True, "online": True, @@ -727,7 +727,6 @@ async def test_execute_times_out(hass, report_state, on, brightness, value): "states": { "on": on, "online": True, - "brightness": brightness, }, }, {