Skip to content

Commit

Permalink
Merge pull request #853 from lgb-this/develop
Browse files Browse the repository at this point in the history
byd_bat: Update webif with parameters and translations
  • Loading branch information
msinn authored Nov 3, 2023
2 parents 9396d51 + b72bf70 commit 5fae0c7
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 12 deletions.
8 changes: 8 additions & 0 deletions byd_bat/locale.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ plugin_translations:
'Module pro Turm': {'de': '=', 'en': 'Modules per tower'}
'Parameter': {'de': '=', 'en': 'Parameter'}
'Fehler': {'de': '=', 'en': 'Error'}

'Batteriespannung': {'de': '=', 'en': 'Batteryvoltage'}
'Spannung Out': {'de': '=', 'en': 'Voltage Out'}
'Strom': {'de': '=', 'en': 'Current'}
'Spannung max (Zelle)': {'de': '=', 'en': 'Voltage max (cell)'}
'Spannung min (Zelle)': {'de': '=', 'en': 'Voltage min (cell)'}
'Temperatur Zelle max': {'de': '=', 'en': 'Temperature cell max'}
'Temperatur Zelle min': {'de': '=', 'en': 'Temperature cell min'}

# Alternative format for translations of longer texts:
'Hier kommt der Inhalt des Webinterfaces hin.':
Expand Down
19 changes: 15 additions & 4 deletions byd_bat/webif/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,34 +124,45 @@ def get_data_html(self, dataSet=None):
data['serial'] = self.plugin.byd_serial

data['t1_soc'] = f'{self.plugin.byd_diag_soc[1]:.1f}' + " %"
data['t1_bat_voltag'] = f'{self.plugin.byd_diag_bat_voltag[1]:.1f}' + " V"
data['t1_v_out'] = f'{self.plugin.byd_diag_v_out[1]:.1f}' + " V"
data['t1_current'] = f'{self.plugin.byd_diag_current[1]:.1f}' + " A"
data['t1_volt_max'] = f'{self.plugin.byd_diag_volt_max[1]:.3f}' + " V (" + str(self.plugin.byd_diag_volt_max_c[1]) + ")"
data['t1_volt_min'] = f'{self.plugin.byd_diag_volt_min[1]:.3f}' + " V (" + str(self.plugin.byd_diag_volt_min_c[1]) + ")"
data['t1_temp_max_cell'] = str(self.plugin.byd_diag_temp_max_c[1])
data['t1_temp_min_cell'] = str(self.plugin.byd_diag_temp_min_c[1])
if self.plugin.byd_bms_qty > 1:
data['t2_soc'] = f'{self.plugin.byd_diag_soc[2]:.1f}' + " %"
data['t2_bat_voltag'] = f'{self.plugin.byd_diag_bat_voltag[2]:.1f}' + " V"
data['t2_v_out'] = f'{self.plugin.byd_diag_v_out[2]:.1f}' + " V"
data['t2_current'] = f'{self.plugin.byd_diag_current[2]:.1f}' + " A"
data['t2_volt_max'] = f'{self.plugin.byd_diag_volt_max[2]:.3f}' + " V (" + str(self.plugin.byd_diag_volt_max_c[2]) + ")"
data['t2_volt_min'] = f'{self.plugin.byd_diag_volt_min[2]:.3f}' + " V (" + str(self.plugin.byd_diag_volt_min_c[2]) + ")"
data['t2_temp_max_cell'] = str(self.plugin.byd_diag_temp_max_c[2])
data['t2_temp_min_cell'] = str(self.plugin.byd_diag_temp_min_c[2])
else:
data['t2_soc'] = "-"
data['t2_soc'] = "-"
data['t2_bat_voltag'] = "-"
data['t2_v_out'] = "-"
data['t2_current'] = "-"
data['t2_volt_max'] = "-"
data['t2_volt_min'] = "-"
data['t2_temp_max_cell'] = "-"
data['t2_temp_min_cell'] = "-"
if self.plugin.byd_bms_qty > 2:
data['t3_soc'] = f'{self.plugin.byd_diag_soc[3]:.1f}' + " %"
data['t3_soc'] = f'{self.plugin.byd_diag_soc[3]:.1f}' + " %"
data['t3_bat_voltag'] = f'{self.plugin.byd_diag_bat_voltag[3]:.1f}' + " V"
data['t3_v_out'] = f'{self.plugin.byd_diag_v_out[3]:.1f}' + " V"
data['t3_current'] = f'{self.plugin.byd_diag_current[3]:.1f}' + " A"
data['t3_volt_max'] = f'{self.plugin.byd_diag_volt_max[3]:.3f}' + " V (" + str(self.plugin.byd_diag_volt_max_c[3]) + ")"
data['t3_volt_min'] = f'{self.plugin.byd_diag_volt_min[3]:.3f}' + " V (" + str(self.plugin.byd_diag_volt_min_c[3]) + ")"
data['t3_temp_max_cell'] = str(self.plugin.byd_diag_temp_max_c[3])
data['t3_temp_min_cell'] = str(self.plugin.byd_diag_temp_min_c[3])
else:
data['t3_soc'] = "-"
data['t3_soc'] = "-"
data['t3_soc'] = "-"
data['t3_bat_voltag'] = "-"
data['t3_v_out'] = "-"
data['t3_current'] = "-"
data['t3_volt_max'] = "-"
data['t3_volt_min'] = "-"
data['t3_temp_max_cell'] = "-"
Expand Down
43 changes: 35 additions & 8 deletions byd_bat/webif/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,16 +100,25 @@
shngInsertText('serial',objResponse['serial']);

shngInsertText('t1_soc',objResponse['t1_soc']);
shngInsertText('t1_bat_voltag',objResponse['t1_bat_voltag']);
shngInsertText('t1_v_out',objResponse['t1_v_out']);
shngInsertText('t1_current',objResponse['t1_current']);
shngInsertText('t1_volt_max',objResponse['t1_volt_max']);
shngInsertText('t1_volt_min',objResponse['t1_volt_min']);
shngInsertText('t1_temp_max_cell',objResponse['t1_temp_max_cell']);
shngInsertText('t1_temp_min_cell',objResponse['t1_temp_min_cell']);
shngInsertText('t2_soc',objResponse['t2_soc']);
shngInsertText('t2_bat_voltag',objResponse['t2_bat_voltag']);
shngInsertText('t2_v_out',objResponse['t2_v_out']);
shngInsertText('t2_current',objResponse['t2_current']);
shngInsertText('t2_volt_max',objResponse['t2_volt_max']);
shngInsertText('t2_volt_min',objResponse['t2_volt_min']);
shngInsertText('t2_temp_max_cell',objResponse['t2_temp_max_cell']);
shngInsertText('t2_temp_min_cell',objResponse['t2_temp_min_cell']);
shngInsertText('t3_soc',objResponse['t3_soc']);
shngInsertText('t3_bat_voltag',objResponse['t3_bat_voltag']);
shngInsertText('t3_v_out',objResponse['t3_v_out']);
shngInsertText('t3_current',objResponse['t3_current']);
shngInsertText('t3_volt_max',objResponse['t3_volt_max']);
shngInsertText('t3_volt_min',objResponse['t3_volt_min']);
shngInsertText('t3_temp_max_cell',objResponse['t3_temp_max_cell']);
Expand Down Expand Up @@ -407,25 +416,43 @@
<td id="t3_soc" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>Spannung max (Zelle):</strong></td>
<td class="py-1"><strong>{{ _('Batteriespannung') }}:</strong></td>
<td id="t1_bat_voltag" class="py-1" style="text-align: center"></td>
<td id="t2_bat_voltag" class="py-1" style="text-align: center"></td>
<td id="t3_bat_voltag" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>{{ _('Spannung Out') }}:</strong></td>
<td id="t1_v_out" class="py-1" style="text-align: center"></td>
<td id="t2_v_out" class="py-1" style="text-align: center"></td>
<td id="t3_v_out" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>{{ _('Strom') }}:</strong></td>
<td id="t1_current" class="py-1" style="text-align: center"></td>
<td id="t2_current" class="py-1" style="text-align: center"></td>
<td id="t3_current" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>{{ _('Spannung max (Zelle)') }}:</strong></td>
<td id="t1_volt_max" class="py-1" style="text-align: center"></td>
<td id="t2_volt_max" class="py-1" style="text-align: center"></td>
<td id="t3_volt_max" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>Spannung min (Zelle):</strong></td>
<td class="py-1"><strong>{{ _('Spannung min (Zelle)') }}:</strong></td>
<td id="t1_volt_min" class="py-1" style="text-align: center"></td>
<td id="t2_volt_min" class="py-1" style="text-align: center"></td>
<td id="t3_volt_min" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>Temperatur Zelle max:</strong></td>
<td class="py-1"><strong>{{ _('Temperatur Zelle max') }}:</strong></td>
<td id="t1_temp_max_cell" class="py-1" style="text-align: center"></td>
<td id="t2_temp_max_cell" class="py-1" style="text-align: center"></td>
<td id="t3_temp_max_cell" class="py-1" style="text-align: center"></td>
</tr>
<tr>
<td class="py-1"><strong>Temperatur Zelle min:</strong></td>
<td class="py-1"><strong>{{ _('Temperatur Zelle min') }}:</strong></td>
<td id="t1_temp_min_cell" class="py-1" style="text-align: center"></td>
<td id="t2_temp_min_cell" class="py-1" style="text-align: center"></td>
<td id="t3_temp_min_cell" class="py-1" style="text-align: center"></td>
Expand All @@ -442,10 +469,10 @@
{% block bodytab3 %}
<table style="background-color:#000000;">
<tr>
<td><img id="bydvt1" src="static/img/bydvt1.png"></td>
<td><img id="bydvt1" alt="Turm 1 nicht vorhanden" src="static/img/bydvt1.png"></td>
</tr>
<tr>
<td><img id="bydvt2" src="static/img/bydvt2.png"></td>
<td><img id="bydvt2" alt="Turm 2 nicht vorhanden" src="static/img/bydvt2.png"></td>
</tr>
<tr>
<td><img id="bydvt3" alt="Turm 3 nicht vorhanden" src="static/img/bydvt3.png"></td>
Expand All @@ -461,10 +488,10 @@
{% block bodytab4 %}
<table style="background-color:#000000;">
<tr>
<td><img id="bydtt1" src="static/img/bydtt1.png"></td>
<td><img id="bydtt1" alt="Turm 1 nicht vorhanden" src="static/img/bydtt1.png"></td>
</tr>
<tr>
<td><img id="bydtt2" src="static/img/bydtt2.png"></td>
<td><img id="bydtt2" alt="Turm 2 nicht vorhanden" src="static/img/bydtt2.png"></td>
</tr>
<tr>
<td><img id="bydtt3" alt="Turm 3 nicht vorhanden" src="static/img/bydtt3.png"></td>
Expand Down

0 comments on commit 5fae0c7

Please sign in to comment.