From 829777a2114238fbc48d1bce6ec62bc72b5d08dd 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 4f2971c01fa..a05e8ebe4aa 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 684a6db2640..a7b061f2ec8 100644 --- a/tests/components/google_assistant/test_smart_home.py +++ b/tests/components/google_assistant/test_smart_home.py @@ -381,7 +381,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, @@ -725,7 +725,6 @@ async def test_execute_times_out(hass, report_state, on, brightness, value): "states": { "on": on, "online": True, - "brightness": brightness, }, }, {