Skip to content

Commit

Permalink
Select sensor ignores out of range indices
Browse files Browse the repository at this point in the history
  • Loading branch information
paulbusse committed Jul 3, 2023
1 parent daceb48 commit 86e882f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def __init__(self, entitytype: str, systemname: str, attribute: str, systemlabel
self._options = self._split(data[FORMAT])

def set_okfval(self, v):
iv = int(v)
if iv < 0 or iv >= len(self._options):
llog.info( f"{self._entityname}: option not available ({iv} out of {len(self._options)}). Ignored.")
return
super().set_okfval(self._options[int(v)])

@property
Expand Down

0 comments on commit 86e882f

Please sign in to comment.