Skip to content

Commit

Permalink
smartmeter: updated webif
Browse files Browse the repository at this point in the history
  • Loading branch information
Morg42 committed Dec 23, 2024
1 parent 5fcca3a commit 9470e97
Show file tree
Hide file tree
Showing 2 changed files with 234 additions and 257 deletions.
17 changes: 9 additions & 8 deletions smartmeter/webif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@ def index(self, reload=None):
tmpl = self.tplenv.get_template('index.html')
return tmpl.render(p=self.plugin,
webif_pagelength=pagelength,
items=self.plugin.get_item_list(),
item_count=len(self.plugin.get_item_list()),
)
)

@cherrypy.expose
def get_data_html(self, dataSet=None):
Expand All @@ -102,9 +101,15 @@ def get_data_html(self, dataSet=None):

# add item data
for item in self.plugin.get_item_list():
item_dict = {'value': item.property.value,
item_dict = {'typ': item.property.type,
'obis_code': self.plugin.get_iattr_value(item.conf, 'obis_code', ''),
'obis_index': self.plugin.get_iattr_value(item.conf, 'obis_index', '0'),
'obis_property': self.plugin.get_iattr_value(item.conf, 'obis_property', 'value'),
'obis_vtype': self.plugin.get_iattr_value(item.conf, 'obis_vtype', '-'),
'value': item.property.value,
'last_update': item.property.last_update.strftime('%d.%m.%Y %H:%M:%S'),
'last_change': item.property.last_change.strftime('%d.%m.%Y %H:%M:%S')}
'last_change': item.property.last_change.strftime('%d.%m.%Y %H:%M:%S'),
}

data['items'][item.property.path] = item_dict

Expand Down Expand Up @@ -140,7 +145,3 @@ def submit(self, cmd=None):
self.logger.debug(f"Result for web interface: {result}")
return json.dumps(result).encode('utf-8')

@cherrypy.expose
def read_data(self):
self.plugin.query(assign_values=False)

Loading

0 comments on commit 9470e97

Please sign in to comment.