Skip to content

Commit

Permalink
refactor: improve readability of value retrieval logic in EconetEntity
Browse files Browse the repository at this point in the history
  • Loading branch information
jontofront committed Dec 18, 2024
1 parent 80ede42 commit 5f08bd6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions custom_components/econet300/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,18 @@ async def async_added_to_hass(self):

# Retrieve the value from sysParams or regParams or paramsEdits
value = (
sys_params.get(expected_key) if sys_params is not None and sys_params.get(expected_key) is not None else
reg_params.get(expected_key) if reg_params is not None and reg_params.get(expected_key) is not None else
params_edits.get(expected_key) if params_edits is not None and params_edits.get(expected_key) is not None else
None
sys_params.get(expected_key)
if sys_params is not None and sys_params.get(expected_key) is not None
else (
reg_params.get(expected_key)
if reg_params is not None and reg_params.get(expected_key) is not None
else (
params_edits.get(expected_key)
if params_edits is not None
and params_edits.get(expected_key) is not None
else None
)
)
)

if value is not None:
Expand Down

0 comments on commit 5f08bd6

Please sign in to comment.