diff --git a/sml2/__init__.py b/sml2/__init__.py
index 93ff85896..e1bf6d2fa 100755
--- a/sml2/__init__.py
+++ b/sml2/__init__.py
@@ -2,7 +2,7 @@
# vim: set encoding=utf-8 tabstop=4 softtabstop=4 shiftwidth=4 expandtab
#########################################################################
# Copyright 2012-2014 Oliver Hinckel github@ollisnet.de
-# Copyright 2018-2021 Bernd.Meiners@mail.de
+# Copyright 2018-2023 Bernd.Meiners@mail.de
# Copyright 2022-2022 Julian Scholle julian.scholle@googlemail.com
#########################################################################
#
@@ -35,6 +35,7 @@
import traceback
from smllib import SmlStreamReader
from smllib import const as smlConst
+from .const import FURTHER_OBIS_NAMES
from lib.module import Modules
from lib.item import Items
@@ -95,7 +96,7 @@ def connection_lost(self, exc):
self.smlx.logger.error("Connection so serial device was closed")
self.smlx.connected = False
- PLUGIN_VERSION = '2.0.0'
+ PLUGIN_VERSION = '2.0.1'
def __init__(self, sh):
"""
@@ -135,6 +136,8 @@ def __init__(self, sh):
self.init_webinterface(WebInterface)
self.task = None
self.values = {}
+ self.obis_names = { **smlConst.OBIS_NAMES, **FURTHER_OBIS_NAMES }
+ self.obis_units = smlConst.UNITS
def run(self):
"""
@@ -339,8 +342,8 @@ def parse_data(self):
obis_code = sml_entry.obis.obis_code
if obis_code not in self.values:
self.values[obis_code] = dict()
- self.values[obis_code]['name'] = smlConst.OBIS_NAMES.get(sml_entry.obis)
- self.values[obis_code]['unit'] = smlConst.UNITS.get(sml_entry.unit)
+ self.values[obis_code]['name'] = self.obis_names.get(sml_entry.obis)
+ self.values[obis_code]['unit'] = self.obis_units.get(sml_entry.unit)
if obis_code in self._items:
if 'valueReal' in self._items[obis_code]:
for item in self._items[obis_code]['valueReal']:
diff --git a/sml2/const.py b/sml2/const.py
new file mode 100644
index 000000000..0cda73469
--- /dev/null
+++ b/sml2/const.py
@@ -0,0 +1,15 @@
+#!/usr/bin/env python3
+
+FURTHER_OBIS_NAMES = {
+ '010000020000': 'Firmware Version, Firmware Prüfsumme CRC, Datum',
+ '0100010800ff': 'Bezug Zählerstand Total',
+ '0100010801ff': 'Bezug Zählerstand Tarif 1',
+ '0100010802ff': 'Bezug Zählerstand Tarif 2',
+ '0100011100ff': 'Total-Zählerstand',
+ '0100020800ff': 'Einspeisung Zählerstand Total',
+ '0100020801ff': 'Einspeisung Zählerstand Tarif 1',
+ '0100020802ff': 'Einspeisung Zählerstand Tarif 2',
+ '0100600100ff': 'Server-ID',
+ '010060320101': 'Hersteller-Identifikation',
+ '0100605a0201': 'Prüfsumme',
+}
diff --git a/sml2/plugin.yaml b/sml2/plugin.yaml
index 5ec3a4801..40e59a7de 100755
--- a/sml2/plugin.yaml
+++ b/sml2/plugin.yaml
@@ -12,7 +12,7 @@ plugin:
documentation: https://www.smarthomeng.de/developer/plugins/smlx/user_doc.html
support: https://knx-user-forum.de/forum/supportforen/smarthome-py/39119-sml-plugin-datenblock-größenfehler
restartable: True
- version: 2.0.0 # Plugin version
+ version: 2.0.1 # Plugin version
sh_minversion: 1.4.2 # minimum shNG version to use this plugin
#sh_maxversion: # maximum shNG version to use this plugin (leave empty if latest)
multi_instance: True # plugin supports multi instance
diff --git a/sml2/webif/__init__.py b/sml2/webif/__init__.py
index 631616238..e6d04003c 100755
--- a/sml2/webif/__init__.py
+++ b/sml2/webif/__init__.py
@@ -71,10 +71,7 @@ def index(self, reload=None):
"""
tmpl = self.tplenv.get_template('index.html')
# Setting pagelength (max. number of table entries per page) for web interface
- try:
- pagelength = self.plugin.webif_pagelength
- except Exception:
- pagelength = 100
+ 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,
diff --git a/sml2/webif/templates/index.html b/sml2/webif/templates/index.html
index bc5db2265..f7746f2b4 100755
--- a/sml2/webif/templates/index.html
+++ b/sml2/webif/templates/index.html
@@ -8,16 +8,16 @@
{% block pluginstyles %}
{% endblock pluginstyles %}
@@ -27,54 +27,34 @@
-->
{% block pluginscripts %}
{% endblock pluginscripts %}
{% block headtable %}
-{{ webif_pagelength }}
-
@@ -152,16 +130,16 @@
Set the tab title
-->
{% set tab1title = "" ~ p.get_shortname() ~ " Items (" ~ item_count ~ ")" %}
-{% set tab2title = "" ~ p.get_shortname() ~ " Obis Data" %}
+{% set tab2title = "" ~ p.get_shortname() ~ " verfügbare Obis Daten" %}
{% if '1-0:1.8.0*255' in p.values %}
- {% set tab3title = "" ~ p.get_shortname() ~ " Zählerstatus" %}
+ {% set tab3title = "" ~ p.get_shortname() ~ " Zählerstatus" %}
{% else %}
- {% set tab3title = "hidden" %}
+ {% set tab3title = "hidden" %}
{% endif %}
{% if maintenance %}
- {% set tab4title = "" ~ p.get_shortname() ~ " Maintenance" %}
+ {% set tab4title = "" ~ p.get_shortname() ~ " Maintenance" %}
{% else %}
- {% set tab4title = "hidden" %}
+ {% set tab4title = "hidden" %}
{% endif %}
{% block bodytab1 %}
-
-
-
-
- {{ _('Item') }} |
- {{ _('Attribut') }} |
- {{_('Typ')}} |
- {{_('Wert')}} |
- {{_('Letztes Update')}} |
- {{_('Letzter Change')}} |
-
-
-
- {% for item in items %}
-
- {{ item._path }} |
- {{ p.get_iattr_value(item.conf, 'sml_obis') }} |
- {{ item._type }} |
- .{{ item._value }} |
- {{ item.property.last_update.strftime('%d.%m.%Y %H:%M:%S') }} |
- {{ item.property.last_change.strftime('%d.%m.%Y %H:%M:%S') }} |
-
- {% endfor %}
-
-
-
-
+
+
+ |
+ {{ _('Item') }} |
+ {{ _('Attribut') }} |
+ {{_('Typ')}} |
+ {{_('Wert')}} |
+ {{_('Letztes Update')}} |
+ {{_('Letzter Change')}} |
+
+
+
+ {% for item in items %}
+ |
+ {{ item._path }} |
+ {{ p.get_iattr_value(item.conf, 'sml_obis') }} |
+ {{ item._type }} |
+ .{{ item._value }} |
+ {{ item.property.last_update.strftime('%d.%m.%Y %H:%M:%S') }} |
+ {{ item.property.last_change.strftime('%d.%m.%Y %H:%M:%S') }} |
+
+ {% endfor %}
+
+
{% endblock bodytab1 %}
{% block bodytab2 %}
-
-
-
OBIS Raw data
-
-
-
- {{ _('OBIS Codes') }} |
- {{ _('Data') }} |
- {{ _('Unit') }} |
-
-
-
- {% for entry in p.values %}
-
- {{ entry }} |
- {{ p.values[entry]['name'] }} |
- {{ p.values[entry]['unit'] }} |
-
- {% endfor %}
-
-
+
+ OBIS Raw data
+
+
+ |
+ {{ _('OBIS Codes') }} |
+ {{ _('Data') }} |
+ {{ _('Unit') }} |
+
+
+
+ {% for entry in p.values %}
+ |
+ {{ entry }} |
+ {{ p.values[entry]['name'] }} |
+ {{ p.values[entry]['unit'] }} |
+
+ {% endfor %}
+
+
{% endblock bodytab2 %}
{% block bodytab3 %}
-
- {% if '1-0:1.8.0*255' in p.values %}
-
-
-
- {{ _('Status') }} |
- {{ _('Value') }} |
-
-
-
- {% if 'statRun' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Zähler in Betrieb') }} |
- {% if p.values['1-0:1.8.0*255']['statRun'] %}{{ _('Ja') }}{% else %}{{ _('Nein') }}{% endif %} |
-
- {% endif %}
- {% if 'statFraudMagnet' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('magnetische Manipulation') }} |
- {% if p.values['1-0:1.8.0*255']['statFraudMagnet'] %}{{ _('Ja') }}{% else %}{{ _('Nein') }}{% endif %} |
-
- {% endif %}
- {% if 'statFraudCover' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Manipulation der Abdeckung') }} |
- {% if p.values['1-0:1.8.0*255']['statFraudCover'] %}{{ _('Ja') }}{% else %}{{ _('Nein') }}{% endif %} |
-
- {% endif %}
- {% if 'statEnergyTotal' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Stromfluss gesamt') }} |
- {% if p.values['1-0:1.8.0*255']['statEnergyTotal'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
-
- {% endif %}
- {% if 'statEnergyL1' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Stromfluss L1') }} |
- {% if p.values['1-0:1.8.0*255']['statEnergyL1'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
-
- {% endif %}
- {% if 'statEnergyL2' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Stromfluss L2') }} |
- {% if p.values['1-0:1.8.0*255']['statEnergyL2'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
-
- {% endif %}
- {% if 'statEnergyL3' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Stromfluss L3') }} |
- {% if p.values['1-0:1.8.0*255']['statEnergyL3'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
-
- {% endif %}
- {% if 'statVoltageL1' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Spannung an L1') }} |
- {% if p.values['1-0:1.8.0*255']['statVoltageL1'] %}{{ _('OK') }}{% else %}{{ _('NOK') }}{% endif %} |
-
- {% endif %}
- {% if 'statVoltageL2' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Spannung an L2') }} |
- {% if p.values['1-0:1.8.0*255']['statVoltageL2'] %}{{ _('OK') }}{% else %}{{ _('NOK') }}{% endif %} |
-
- {% endif %}
- {% if 'statVoltageL3' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Spannung an L3') }} |
- {% if p.values['1-0:1.8.0*255']['statVoltageL3'] %}{{ _('OK') }}{% else %}{{ _('NOK') }}{% endif %} |
-
- {% endif %}
- {% if 'statRotaryField' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Drehfeld') }} |
- {% if p.values['1-0:1.8.0*255']['statRotaryField'] %}{{ _('NOK') }}{% else %}{{ _('OK') }}{% endif %} |
-
- {% endif %}
- {% if 'statBackstop' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Backstop') }} |
- {% if p.values['1-0:1.8.0*255']['statBackstop'] %}{{ _('Active') }}{% else %}{{ _('Nein') }}{% endif %} |
-
- {% endif %}
- {% if 'statCalFault' in p.values['1-0:1.8.0*255'] %}
-
- {{ _('Fataler Fehler') }} |
- {% if p.values['1-0:1.8.0*255']['statCalFault'] %}{{ _('FAULT') }}{% else %}{{ _('Keiner') }}{% endif %} |
-
- {% endif %}
-
-
- {% endif %}
-
+{% if '1-0:1.8.0*255' in p.values %}
+
+
+ |
+ {{ _('Status') }} |
+ {{ _('Value') }} |
+
+
+
+ {% if 'statRun' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Zähler in Betrieb') }} |
+ {% if p.values['1-0:1.8.0*255']['statRun'] %}{{ _('Ja') }}{% else %}{{ _('Nein') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statFraudMagnet' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('magnetische Manipulation') }} |
+ {% if p.values['1-0:1.8.0*255']['statFraudMagnet'] %}{{ _('Ja') }}{% else %}{{ _('Nein') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statFraudCover' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Manipulation der Abdeckung') }} |
+ {% if p.values['1-0:1.8.0*255']['statFraudCover'] %}{{ _('Ja') }}{% else %}{{ _('Nein') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statEnergyTotal' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Stromfluss gesamt') }} |
+ {% if p.values['1-0:1.8.0*255']['statEnergyTotal'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statEnergyL1' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Stromfluss L1') }} |
+ {% if p.values['1-0:1.8.0*255']['statEnergyL1'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statEnergyL2' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Stromfluss L2') }} |
+ {% if p.values['1-0:1.8.0*255']['statEnergyL2'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statEnergyL3' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Stromfluss L3') }} |
+ {% if p.values['1-0:1.8.0*255']['statEnergyL3'] %}{{ _('-A') }}{% else %}{{ _('+A') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statVoltageL1' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Spannung an L1') }} |
+ {% if p.values['1-0:1.8.0*255']['statVoltageL1'] %}{{ _('OK') }}{% else %}{{ _('NOK') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statVoltageL2' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Spannung an L2') }} |
+ {% if p.values['1-0:1.8.0*255']['statVoltageL2'] %}{{ _('OK') }}{% else %}{{ _('NOK') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statVoltageL3' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Spannung an L3') }} |
+ {% if p.values['1-0:1.8.0*255']['statVoltageL3'] %}{{ _('OK') }}{% else %}{{ _('NOK') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statRotaryField' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Drehfeld') }} |
+ {% if p.values['1-0:1.8.0*255']['statRotaryField'] %}{{ _('NOK') }}{% else %}{{ _('OK') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statBackstop' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Backstop') }} |
+ {% if p.values['1-0:1.8.0*255']['statBackstop'] %}{{ _('Active') }}{% else %}{{ _('Nein') }}{% endif %} |
+
+ {% endif %}
+ {% if 'statCalFault' in p.values['1-0:1.8.0*255'] %}
+ |
+ {{ _('Fataler Fehler') }} |
+ {% if p.values['1-0:1.8.0*255']['statCalFault'] %}{{ _('FAULT') }}{% else %}{{ _('Keiner') }}{% endif %} |
+
+ {% endif %}
+
+
+{% endif %}
{% endblock bodytab3 %}
{% block bodytab4 %}
-
-
-
-
- {{ _('dict/list') }} |
- {{ _('count') }} |
- {{ _('content') }} |
-
-
-
-
- {{ _('_items') }} |
- {{ len(p._items) }} |
- {{ p._items }} |
-
-
- {{ _('_item_dict') }} |
- {{ len(p._item_dict) }} |
- {{ p._item_dict }} |
-
-
- {{ _('values') }} |
- {{ len(p.values) }} |
- {{ p.values }} |
-
-
-
-
+
+
+ |
+ {{ _('dict/list') }} |
+ {{ _('count') }} |
+ {{ _('content') }} |
+
+
+
+ |
+ {{ _('_items') }} |
+ {{ len(p._items) }} |
+ {{ p._items }} |
+
+ |
+ {{ _('_item_dict') }} |
+ {{ len(p._item_dict) }} |
+ {{ p._item_dict }} |
+
+ |
+ {{ _('values') }} |
+ {{ len(p.values) }} |
+ {{ p.values }} |
+
+
+
{% endblock bodytab4 %}