Skip to content

Commit

Permalink
Fix dp_value function when value is 0 #121
Browse files Browse the repository at this point in the history
  • Loading branch information
xZetsubou committed Jan 30, 2024
1 parent 328825b commit 6be5558
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions custom_components/localtuya/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,12 @@ def dp_value(self, key):
"""Return cached value for DPS index or Entity Config Key."""
requested_dp = str(key)
# If requested_dp in DP ID, get cached value.
if value := self._status.get(requested_dp):
if (value := self._status.get(requested_dp)) or value is not None:
return value

# If requested_dp is an config key get config dp then get cached value.
if conf_key := self._config.get(requested_dp):
if value := self._status.get(conf_key):
if (conf_key := self._config.get(requested_dp)) or conf_key is not None:
if (value := self._status.get(conf_key)) or value is not None:
return value

if value is None:
Expand Down

0 comments on commit 6be5558

Please sign in to comment.