Skip to content

Commit

Permalink
Fix WARNING - ... is unreachable: 'NoneType' object is not subscripta…
Browse files Browse the repository at this point in the history
…ble (#990)

Home assistant only reports attributes if light is on.
  • Loading branch information
rernst authored Feb 7, 2024
1 parent 39eb61c commit 6f8c099
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion BridgeEmulator/lights/protocols/homeassistant_ws.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def translate_homeassistant_state_to_diyhue_state(existing_diy_hue_state, ha_sta

diyhue_state["reachable"] = reachable
diyhue_state["on"] = is_on
if "attributes" in ha_state:
if "attributes" in ha_state and is_on: # Home assistant only reports attributes if light is on
for key, value in ha_state['attributes'].items():
if key == "brightness":
diyhue_state['bri'] = value
Expand Down

0 comments on commit 6f8c099

Please sign in to comment.