Added errorhandling for rendering

This commit is contained in:
Sebastian 2018-10-20 20:25:03 +02:00
parent b471d9cab8
commit 22646244ed
2 changed files with 9 additions and 3 deletions

View File

@ -43,7 +43,7 @@ GRAPHS = {
GraphLine('I_pv_in', 'Strom PV [A]', '#ff0000'),
GraphLine('I_load_total', 'Strom Last [A]', '#00ff00'),
],
'realy' : [
'relay' : [
GraphLine('load_switch', 'Relay', '#0000ff'),
],
'charges' : [

View File

@ -84,7 +84,10 @@ def update_graphs():
graph_params += ['DEF:%s=%s:%s:LAST' % (name, DATA_FILE, name)]
graph_params += ['LINE1:%s%s:%s' % (name, color, lable)]
rrdtool.graph(*graph_params)
try:
rrdtool.graph(*graph_params)
except rrdtool.OperationalError:
print("Failed to render current data")
# Also render Archives
graph_params = ['%s_archive.png' % graph_name, '-a',
@ -94,7 +97,10 @@ def update_graphs():
graph_params += ['DEF:%s=%s:%s:AVERAGE' % (name, DATA_FILE, name)]
graph_params += ['LINE1:%s%s:%s' % (name, color, lable)]
rrdtool.graph(*graph_params)
try:
rrdtool.graph(*graph_params)
except rrdtool.OperationalError:
print("Failed to render archive data")
def upload_graphs():