Always provide brightness value (#28228)
HA will remove attribute when light is off, but google expect all trait data all the time.
This commit is contained in:
1 parent
ecf2e9c0ab
commit
5fd9b474dc
2 files changed
+3
-1
No files matched your search
@@ -185,6 +185,8 @@ class BrightnessTrait(_Trait):
|
||||
brightness = self.state.attributes.get(light.ATTR_BRIGHTNESS)
|
||||
if brightness is not None:
|
||||
response["brightness"] = int(100 * (brightness / 255))
|
||||
else:
|
||||
response["brightness"] = 0
|
||||
|
||||
return response
|
||||
|
||||
|
||||
@@ -226,7 +226,7 @@ async def test_query_message(hass):
|
||||
"payload": {
|
||||
"devices": {
|
||||
"light.non_existing": {"online": False},
|
||||
"light.demo_light": {"on": False, "online": True},
|
||||
"light.demo_light": {"on": False, "online": True, "brightness": 0},
|
||||
"light.another_light": {
|
||||
"on": True,
|
||||
"online": True,
|
||||
|
||||
Reference in new issue
Block a user