Skip to content

Commit

Permalink
Fix unboundlocalerror (#106)
Browse files Browse the repository at this point in the history
* Fix unboundlocalerror

* Added unittest

* Better unittest
  • Loading branch information
derjoerg authored Nov 10, 2024
1 parent 42b06ec commit cce689b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/abbfreeathome/devices/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def update_device(self, datapoint_key: str, datapoint_value: str):
datapoint_key,
datapoint_value,
)
_refreshed = None
_io_key = datapoint_key.split("/")[-1]

if _io_key in self._outputs:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,3 +89,9 @@ def test_remove_callback(base_instance):
base_instance.register_callback(callback)
base_instance.remove_callback(callback)
assert callback not in base_instance._callbacks


def test_update_device(base_instance):
"""Test when input-datapoint is provided."""

base_instance.update_device("AL_SWITCH_ON_OFF/idp0000", "1")

0 comments on commit cce689b

Please sign in to comment.