Skip to content

Commit 195210d

Browse files
authored
upgrade pro+ (#21)
* duo: check modbus id before changing * fix * flake8 * upgrade pro+
1 parent 19dd620 commit 195210d

File tree

6 files changed

+59
-15
lines changed

6 files changed

+59
-15
lines changed

data/web/index.html

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>openWB - Produktionstest</title>
55
<style>
6-
/* openwb-version:16 */
6+
/* openwb-version:17 */
77
html,
88
body {
99
margin: 0;
@@ -162,6 +162,13 @@
162162
>
163163
Umschaltung
164164
</button>
165+
<button
166+
id="upgrade"
167+
class="equipment_button red hide"
168+
onclick="toggleButtonClick('upgrade')"
169+
>
170+
Upgrade
171+
</button>
165172
<button
166173
id="rfid"
167174
class="equipment_button red hide"
@@ -253,6 +260,16 @@
253260
sendAction(action, 1);
254261
}
255262
}
263+
var button = document.getElementById(action);
264+
265+
if (action === 'upgrade') {
266+
var rfidButton = document.getElementById('rfid');
267+
if (button.classList.contains("green")) {
268+
rfidButton.classList.add('hide');
269+
} else {
270+
rfidButton.classList.remove('hide');
271+
}
272+
}
256273
}
257274

258275
function show(elementId) {
@@ -293,7 +310,7 @@
293310
break;
294311
case "7":
295312
// 7 Pro+
296-
activeOptions = ["rfid"];
313+
activeOptions = ["rfid", "upgrade"];
297314
break;
298315
case "8":
299316
// 8 YourCharge
@@ -307,6 +324,16 @@
307324
hide(button.id);
308325
}
309326
});
327+
const rfidButton = document.getElementById('rfid');
328+
const upgradeButton = document.getElementById('upgrade');
329+
330+
if (value === '7') { // Pro+
331+
if (upgradeButton.classList.contains('green')) {
332+
rfidButton.classList.add('hide');
333+
} else {
334+
rfidButton.classList.remove('hide');
335+
}
336+
}
310337
}
311338

312339
function sendAction(action, value = 1) {

data/web/testmode.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?php
2-
// openwb-version:7
2+
// openwb-version:8
33
// Array mit den erwarteten GET-Parametern und den entsprechenden Dateipfaden
44
$params = [
55
'testmode' => '/opt/openWB-dev/production/ramdisk/testmode',
@@ -15,6 +15,7 @@
1515
'phase_switch' => '/opt/openWB-dev/production/ramdisk/phase_switch',
1616
'max_power' => '/opt/openWB-dev/production/ramdisk/max_power',
1717
'wall_socket' => '/opt/openWB-dev/production/ramdisk/wall_socket',
18+
'upgrade' => '/opt/openWB-dev/production/ramdisk/upgrade',
1819
];
1920

2021
// Schleife durch die Parameter und schreibe in die entsprechenden Dateien

packages/legacy_parameters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,4 @@ def init_buttons():
7474
_init_button("start", 0)
7575
_init_button("cancel", 0)
7676
_init_button("makepic", 0)
77+
_init_button("upgrade", 0)

packages/models.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ class Equipment(Enum):
1919
MAX_POWER = "max_power"
2020
ENTERPRISE = "enterprise"
2121
WALL_SOCKET = "wall_socket"
22+
UPGRADE = "upgrade"
2223

2324

2425
EQUIPMENT_TO_SALES_NAME = {
@@ -30,7 +31,8 @@ class Equipment(Enum):
3031
Equipment.ZOE_BRIDGE: "Phasenumschaltung/1P3P deaktiviert (Kompatibilitätsmodus)",
3132
Equipment.MAX_POWER: "Maximale Leistung",
3233
Equipment.ENTERPRISE: "Enterprise",
33-
Equipment.WALL_SOCKET: "Steckdose"
34+
Equipment.WALL_SOCKET: "Steckdose",
35+
Equipment.UPGRADE: "Upgrade Pro auf Pro+"
3436
}
3537

3638

@@ -51,6 +53,7 @@ class Model:
5153
enterprise: bool = False
5254
max_power: int = None
5355
wall_socket: bool = False
56+
upgrade: bool = False
5457

5558

5659
STANDARD = Model(name="Standard", sales_name="series2 Standard", fi_inside=True)
@@ -102,10 +105,11 @@ class Model:
102105
PRO_PLUS = Model(name="Pro+",
103106
sales_name="Pro+",
104107
mode=InternalChargepointMode.PRO_PLUS,
105-
optional_equipment=[Equipment.RFID],
108+
optional_equipment=[Equipment.RFID, Equipment.UPGRADE],
106109
phase_switch=True,
107110
display=True,
108-
fi_inside=True,)
111+
fi_inside=True,
112+
upgrade=False)
109113

110114
SATELLITE = Model(name="series2 Satellit")
111115

packages/registrate.py

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def registrate(self, model: Model) -> None:
5252

5353
def _create_serial_number(self, model: Model) -> None:
5454
# Read snumber from file and increment it
55-
if model == PRO_PLUS:
55+
if model == PRO_PLUS and model.upgrade is False:
5656
for i in range(0, 3):
5757
try:
5858
self.serial_number = req.get_http_session().get(
@@ -178,6 +178,8 @@ def fill_data(content: List, data: str, line: int, row: int) -> List:
178178
sales_name = model.sales_name + "S"
179179
elif model == YOUR_CHARGE and model.display and model.wall_socket is False:
180180
sales_name = model.sales_name + "D"
181+
elif model == PRO_PLUS and model.upgrade:
182+
sales_name = "Display für Pro+"
181183
else:
182184
sales_name = model.sales_name
183185
content = fill_data(content, sales_name, 8, 25)
@@ -188,14 +190,17 @@ def fill_data(content: List, data: str, line: int, row: int) -> List:
188190

189191
with open("./ramdisk/outside.zpl", "w") as f:
190192
f.writelines(content)
191-
run_subprocess_stderr(["lp", "-d", self.workstation.printer, "-o", "raw", "./ramdisk/outside.zpl"])
192-
if model.standalone is False:
193-
# für die Standalone-Verpackung braucht man kein Label
194-
run_subprocess_stderr(["lp", "-d", self.workstation.printer, "-o", "raw", "./ramdisk/outside.zpl"])
193+
if model.standalone:
194+
outside_labels = 1
195+
elif model == PRO_PLUS and model.upgrade:
196+
outside_labels = 2
197+
else:
198+
outside_labels = 3
199+
for i in range(0, outside_labels):
195200
run_subprocess_stderr(["lp", "-d", self.workstation.printer, "-o", "raw", "./ramdisk/outside.zpl"])
196201

197202
# Ausstattungs-Label
198-
if model.standalone:
203+
if model.standalone or (model == PRO_PLUS and model.upgrade):
199204
return
200205
with open("./data/labels/equipment.zpl", "r") as f:
201206
content = f.readlines()
@@ -207,6 +212,7 @@ def fill_data(content: List, data: str, line: int, row: int) -> List:
207212
equipment = [item for item in Equipment]
208213
equipment.remove(Equipment.MAX_POWER)
209214
equipment.remove(Equipment.ENTERPRISE)
215+
equipment.remove(Equipment.UPGRADE)
210216
for e in equipment:
211217
if getattr(model, e.value):
212218
eq = f"•{EQUIPMENT_TO_SALES_NAME[e]}"

packages/simple_evse.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,13 @@ def get_max_current(self, local_chargepoint_num) -> int:
4949
return int(answer.strip('[]\n'))
5050

5151
def change_modbus_id(self, local_chargepoint_num, new_modbus_id) -> None:
52-
self.workstation.openwb_send_ssh_command("python3 /var/www/html/openWB/runs/evse_write_modbus.py "
53-
f"{local_chargepoint_num} 2001 {new_modbus_id}")
52+
try:
53+
self.get_max_current(local_chargepoint_num+1)
54+
log.debug("Zweite EVSE wurde bereits in einem Test verwendet und hat schon ModbusID 2.")
55+
except Exception:
56+
# MOdbus ID ändern
57+
self.workstation.openwb_send_ssh_command("python3 /var/www/html/openWB/runs/evse_write_modbus.py "
58+
f"{local_chargepoint_num} 2001 {new_modbus_id}")
5459

5560
def write_emergency_current(self, local_chargepoint_num) -> None:
5661
self.workstation.openwb_send_ssh_command(
@@ -118,7 +123,7 @@ def set_max_current(local_chargepoint_num) -> None:
118123
else:
119124
raise Exception("Maximale Stromstärke der EVSE kann nicht gesetzt werden.")
120125
except Exception:
121-
if local_chargepoint_num == 0:
126+
if local_chargepoint_num == 1:
122127
raise Exception("Bitte zweite EVSE und USB-Adapter prüfen.")
123128
else:
124129
raise Exception("Bitte erste EVSE prüfen.")

0 commit comments

Comments
 (0)