frappy_psi.sea: fix case when bool is implemented as text

introduce SeaBool for this

Change-Id: I9c6b6ee7d33f11b173d612efc044fce8a563f626
This commit is contained in:
zolliker 2024-12-10 16:29:07 +01:00
parent 41cb107f50
commit 1ae19d03b3

View File

@ -419,11 +419,24 @@ class SeaConfigCreator(SeaClient):
return reply
class SeaBool(BoolType):
"""some sea enum nodes used as boolean have text type -> accept '<integer>' also"""
def copy(self):
return SeaBool()
def __call__(self, value):
try:
value = int(value)
return super().__call__(value)
except Exception as e:
raise ReadFailedError(e) from e
SEA_TO_SECOPTYPE = {
'float': FloatRange(),
'text': StringType(),
'int': IntRange(-1 << 63, 1 << 63 - 1),
'bool': BoolType(),
'bool': SeaBool(),
'none': None,
'floatvarar': ArrayOf(FloatRange(), 0, 400), # 400 is the current limit for proper notify events in SEA
}