add mqtt info table
This commit is contained in:
@@ -6,42 +6,17 @@ from mqtt import Mqtt
|
|||||||
from . import web
|
from . import web
|
||||||
|
|
||||||
|
|
||||||
def _get_device_icon(client_mode: bool):
|
|
||||||
'''returns the icon for the device conntection'''
|
|
||||||
if client_mode:
|
|
||||||
return 'fa-download fa-rotate-180'
|
|
||||||
|
|
||||||
return 'fa-upload fa-rotate-180'
|
|
||||||
|
|
||||||
|
|
||||||
def _get_cloud_icon(emu_mode: bool):
|
|
||||||
'''returns the icon for the cloud conntection'''
|
|
||||||
if emu_mode:
|
|
||||||
return 'fa-cloud-arrow-up-alt'
|
|
||||||
|
|
||||||
return 'fa-cloud'
|
|
||||||
|
|
||||||
|
|
||||||
def _get_row(inv: InverterBase):
|
def _get_row(inv: InverterBase):
|
||||||
'''build one row for the connection table'''
|
'''build one row for the connection table'''
|
||||||
client_mode = inv.client_mode
|
entity_prfx = inv.entity_prfx
|
||||||
inv_serial = inv.local.stream.inv_serial
|
inv_serial = inv.local.stream.inv_serial
|
||||||
icon1 = _get_device_icon(client_mode)
|
node_id = inv.local.stream.node_id
|
||||||
ip1, port1 = inv.addr
|
sug_area = inv.local.stream.sug_area
|
||||||
icon2 = ''
|
|
||||||
ip2 = '--'
|
|
||||||
port2 = '--'
|
|
||||||
|
|
||||||
if inv.remote.ifc:
|
|
||||||
ip2, port2 = inv.remote.ifc.r_addr
|
|
||||||
icon2 = _get_cloud_icon(client_mode)
|
|
||||||
|
|
||||||
row = []
|
row = []
|
||||||
row.append(f'<i class="fa {icon1}"></i> {ip1}:{port1}')
|
|
||||||
row.append(f'<i class="fa {icon1}"></i> {ip1}')
|
|
||||||
row.append(inv_serial)
|
row.append(inv_serial)
|
||||||
row.append(f'<i class="fa {icon2}"></i> {ip2}:{port2}')
|
row.append(entity_prfx+node_id)
|
||||||
row.append(f'<i class="fa {icon2}"></i> {ip2}')
|
row.append(sug_area)
|
||||||
return row
|
return row
|
||||||
|
|
||||||
|
|
||||||
@@ -50,14 +25,14 @@ def get_table_data():
|
|||||||
table = {
|
table = {
|
||||||
"headline": _('MQTT devices'),
|
"headline": _('MQTT devices'),
|
||||||
"col_classes": [
|
"col_classes": [
|
||||||
"w3-hide-small w3-hide-medium", "w3-hide-large",
|
|
||||||
"",
|
"",
|
||||||
"w3-hide-small w3-hide-medium", "w3-hide-large",
|
"",
|
||||||
|
"",
|
||||||
],
|
],
|
||||||
"thead": [[
|
"thead": [[
|
||||||
_('Device-IP:Port'), _('Device-IP'),
|
|
||||||
_("Serial-No"),
|
_("Serial-No"),
|
||||||
_("Cloud-IP:Port"), _("Cloud-IP")
|
_('Node-ID'),
|
||||||
|
_('HA-Area'),
|
||||||
]],
|
]],
|
||||||
"tbody": []
|
"tbody": []
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user