Version 1.4.0 (latest on PyPi)
When I read some parameters via pyebus they return a value on 'None' rather than the correct value. Reading the same parameter via ebusctl works correctly.
For example 'WaterPressure' should return a value in this example of 1.951 (bar)
I've narrowed it down to the decode() function in the IntType class (types.py)
def decode(self, value):
"""Decode `value`."""
if value not in ("-", ""):
if self.divider and self.divider > 0:
value = float(value)
else:
value = int(value)
if value < self.min_:
raise ValueError(f"Value {value} deceeds lower limit of {self.min_}")
if value > self.max_:
raise ValueError(f"Value {value} exceeds upper limit of {self.max_}")
return value
else:
return None
In this case:
value = '1.951'
self.divider = 1000000
self.min_ = -3.2767e-5
self.max_ = 3.2767e-5
So clearly here the problem is that value is greater than self.max_ and the result is rejected.
I'm not certain how this is supposed to work - but I would speculate that self.min_ and self.max_ should be multiplied by self.divider before the bounds are checked as follows:
if value < self.min_ * self.divider:
raise ValueError(f"Value {value} deceeds lower limit of {self.min_ * self.divider}")
if value > self.max_ * self.divider:
raise ValueError(f"Value {value} exceeds upper limit of {self.max_ * self.divider}")
return value
But I don't know if that's how it's supposed to work, or what the side effects of that change might be.
Version 1.4.0 (latest on PyPi)
When I read some parameters via pyebus they return a value on 'None' rather than the correct value. Reading the same parameter via ebusctl works correctly.
For example 'WaterPressure' should return a value in this example of 1.951 (bar)
I've narrowed it down to the decode() function in the IntType class (types.py)
In this case:
value = '1.951'
self.divider = 1000000
self.min_ = -3.2767e-5
self.max_ = 3.2767e-5
So clearly here the problem is that value is greater than self.max_ and the result is rejected.
I'm not certain how this is supposed to work - but I would speculate that self.min_ and self.max_ should be multiplied by self.divider before the bounds are checked as follows:
But I don't know if that's how it's supposed to work, or what the side effects of that change might be.