diff --git a/jsonread/webif/__init__.py b/jsonread/webif/__init__.py
index f7bf64677..f71cb20dd 100755
--- a/jsonread/webif/__init__.py
+++ b/jsonread/webif/__init__.py
@@ -26,15 +26,12 @@
import datetime
import time
import os
+import json
from lib.item import Items
from lib.model.smartplugin import SmartPluginWebIf
-# ------------------------------------------
-# Webinterface of the plugin
-# ------------------------------------------
-
import cherrypy
import csv
from jinja2 import Environment, FileSystemLoader
@@ -69,8 +66,10 @@ def index(self, reload=None):
:return: contents of the template after beeing rendered
"""
tmpl = self.tplenv.get_template('index.html')
+ pagelength = self.plugin.get_parameter_value('webif_pagelength')
# add values to be passed to the Jinja2 template eg: tmpl.render(p=self.plugin, interface=interface, ...)
return tmpl.render(p=self.plugin,
+ webif_pagelength=pagelength,
items=self.plugin._items,
item_count=0)
@@ -89,14 +88,10 @@ def get_data_html(self, dataSet=None):
# get the new data
data = {}
- # data['item'] = {}
- # for i in self.plugin.items:
- # data['item'][i]['value'] = self.plugin.getitemvalue(i)
- #
- # return it as json the the web page
- # try:
- # return json.dumps(data)
- # except Exception as e:
- # self.logger.error("get_data_html exception: {}".format(e))
+ for item in self.plugin._items.keys():
+ data[item.property.path] = item.property.value
+ try:
+ return json.dumps(data)
+ except Exception as e:
+ self.logger.error("get_data_html exception: {}".format(e))
return {}
-
diff --git a/jsonread/webif/templates/index.html b/jsonread/webif/templates/index.html
index d8c1918f3..5e977be97 100755
--- a/jsonread/webif/templates/index.html
+++ b/jsonread/webif/templates/index.html
@@ -3,7 +3,7 @@
{% set logo_frame = false %}
-{% set update_interval = 0 %}
+{% set update_interval = 30000 %}
-{% block buttons %}
-{% if 1==2 %}
-
-
-
-{% endif %}
-{% endblock %}
-
-
{% set tabcount = 3 %}
-
-
{% set item_count = p._items|length %}
{% if item_count==0 %}
{% set start_tab = 1 %}
@@ -111,28 +97,19 @@
-->
{% set tab2title = "" ~ item_count ~ " " ~ _("Items definiert") ~ "" %}
{% block bodytab2 %}
-
-
-
-
-
- {{ _('Item') }} |
- {{ _('jsonread_filter') }} |
- {{ _('Wert') }} |
-
-
+
+
{% for item in p._items %}
-
- {{ item._path }} |
- {{ p.get_iattr_value(item.conf, 'jsonread_filter') }} |
- {{ item() }} |
+
|
+ {{ item._path }} |
+ {{ p.get_iattr_value(item.conf, 'jsonread_filter') }} |
+ {{ item() }} |
{% endfor %}
-
-
+
{% endblock bodytab2 %}