Skip to content

Commit

Permalink
stateengine plugin: (re)fix web interface for overview page
Browse files Browse the repository at this point in the history
  • Loading branch information
onkelandy committed Sep 11, 2023
1 parent 17cf42d commit bdc4aef
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions stateengine/webif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,18 @@ def get_data_html(self, dataSet=None):
:param dataSet: Dataset for which the data should be returned (standard: None)
:return: dict with the data needed to update the web page.
"""

if dataSet and isinstance(dataSet, str):
if dataSet is None:
# get the new data
data = {}
for item in self.plugin.get_items():
conditionset = item.lastconditionset_name
conditionset = "-" if conditionset == "" else conditionset
data.update({item.id: {'laststate': item.laststate_name, 'lastconditionset': conditionset}})
try:
return json.dumps(data)
except Exception as e:
self.logger.error(f"get_data_html exception: {e}")
elif dataSet and isinstance(dataSet, str):
try:
dataSet = self.plugin.abitems[dataSet]
except Exception as e:
Expand All @@ -114,4 +124,6 @@ def get_data_html(self, dataSet=None):
if self.vis_enabled and dataSet.firstrun is None:
self.plugin.get_graph(dataSet, 'graph')
return json.dumps({"success": "true"})
return json.dumps({"success": "false"})
return json.dumps({"success": "false"})
else:
return {}

0 comments on commit bdc4aef

Please sign in to comment.