Catch ValueError if a gauge is down
This commit is contained in:
parent
7a72b94b37
commit
a73daa18f4
1 changed files with 5 additions and 1 deletions
|
|
@ -40,6 +40,10 @@ class Split(Filter):
|
||||||
unit = txt.split(':')[-1].split()[1]
|
unit = txt.split(':')[-1].split()[1]
|
||||||
if unit == u"W/m":
|
if unit == u"W/m":
|
||||||
unit = u"W/m²"
|
unit = u"W/m²"
|
||||||
|
try:
|
||||||
|
value = float(value)
|
||||||
|
except ValueError:
|
||||||
|
value = NotAvailable
|
||||||
return [value, unit][self.mode]
|
return [value, unit][self.mode]
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -60,6 +64,6 @@ class StartPage(HTMLPage):
|
||||||
|
|
||||||
def obj_lastvalue(self):
|
def obj_lastvalue(self):
|
||||||
lastvalue = GaugeMeasure()
|
lastvalue = GaugeMeasure()
|
||||||
lastvalue.level = float(Split(CleanText('.'), 0)(self))
|
lastvalue.level = Split(CleanText('.'), 0)(self)
|
||||||
lastvalue.alarm = NotAvailable
|
lastvalue.alarm = NotAvailable
|
||||||
return lastvalue
|
return lastvalue
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue