If brightness is not available, don't set a value (#78827)

This commit is contained in:
Joakim Plate 2022-09-20 13:57:54 +02:00 committed by GitHub
parent e05ca87cc7
commit bd0daf68e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 4 deletions

View file

@ -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

View file

@ -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,
},
},
{