Allow decimal place to be used without corr factor
This commit is contained in:
parent
9e41c495fc
commit
d84bea3621
3 changed files with 18 additions and 28 deletions
|
@ -127,15 +127,12 @@ class ArestSensor(Entity):
|
|||
if 'error' in values:
|
||||
return values['error']
|
||||
elif 'value' in values:
|
||||
if self._corr_factor is not None \
|
||||
and self._decimal_places is not None:
|
||||
return round((float(values['value']) *
|
||||
float(self._corr_factor)), self._decimal_places)
|
||||
elif self._corr_factor is not None \
|
||||
and self._decimal_places is None:
|
||||
return round(float(values['value']) * float(self._corr_factor))
|
||||
else:
|
||||
return values['value']
|
||||
value = values['value']
|
||||
if self._corr_factor is not None:
|
||||
value = float(value) * float(self._corr_factor)
|
||||
if self._decimal_places is not None:
|
||||
value = round(value, self._decimal_places)
|
||||
return value
|
||||
else:
|
||||
return values.get(self._variable, 'n/a')
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue