arthexis 0.1.26__py3-none-any.whl → 0.1.28__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of arthexis might be problematic. Click here for more details.
- {arthexis-0.1.26.dist-info → arthexis-0.1.28.dist-info}/METADATA +16 -11
- {arthexis-0.1.26.dist-info → arthexis-0.1.28.dist-info}/RECORD +39 -38
- config/settings.py +7 -1
- config/settings_helpers.py +176 -1
- config/urls.py +18 -2
- core/admin.py +265 -23
- core/apps.py +6 -2
- core/celery_utils.py +73 -0
- core/models.py +307 -63
- core/system.py +17 -2
- core/tasks.py +304 -129
- core/test_system_info.py +43 -5
- core/tests.py +202 -2
- core/user_data.py +52 -19
- core/views.py +70 -3
- nodes/admin.py +348 -3
- nodes/apps.py +1 -1
- nodes/feature_checks.py +30 -0
- nodes/models.py +146 -18
- nodes/tasks.py +1 -1
- nodes/tests.py +181 -48
- nodes/views.py +148 -3
- ocpp/admin.py +1001 -10
- ocpp/consumers.py +572 -7
- ocpp/models.py +499 -33
- ocpp/store.py +406 -40
- ocpp/tasks.py +109 -145
- ocpp/test_rfid.py +73 -2
- ocpp/tests.py +982 -90
- ocpp/urls.py +5 -0
- ocpp/views.py +172 -70
- pages/context_processors.py +2 -0
- pages/models.py +9 -0
- pages/tests.py +166 -18
- pages/urls.py +1 -0
- pages/views.py +66 -3
- {arthexis-0.1.26.dist-info → arthexis-0.1.28.dist-info}/WHEEL +0 -0
- {arthexis-0.1.26.dist-info → arthexis-0.1.28.dist-info}/licenses/LICENSE +0 -0
- {arthexis-0.1.26.dist-info → arthexis-0.1.28.dist-info}/top_level.txt +0 -0
nodes/views.py
CHANGED
|
@@ -403,7 +403,20 @@ def node_info(request):
|
|
|
403
403
|
advertised_port = host_port
|
|
404
404
|
if host_domain:
|
|
405
405
|
hostname = host_domain
|
|
406
|
-
|
|
406
|
+
local_aliases = {
|
|
407
|
+
value
|
|
408
|
+
for value in (
|
|
409
|
+
node.hostname,
|
|
410
|
+
node.network_hostname,
|
|
411
|
+
node.address,
|
|
412
|
+
node.public_endpoint,
|
|
413
|
+
)
|
|
414
|
+
if value
|
|
415
|
+
}
|
|
416
|
+
if advertised_address and advertised_address not in local_aliases:
|
|
417
|
+
address = advertised_address
|
|
418
|
+
else:
|
|
419
|
+
address = host_domain
|
|
407
420
|
else:
|
|
408
421
|
hostname = node.hostname
|
|
409
422
|
address = advertised_address or node.address or node.network_hostname or ""
|
|
@@ -526,7 +539,7 @@ def register_node(request):
|
|
|
526
539
|
network_hostname = (data.get("network_hostname") or "").strip()
|
|
527
540
|
ipv4_address = (data.get("ipv4_address") or "").strip()
|
|
528
541
|
ipv6_address = (data.get("ipv6_address") or "").strip()
|
|
529
|
-
port = data.get("port",
|
|
542
|
+
port = data.get("port", 8888)
|
|
530
543
|
mac_address = (data.get("mac_address") or "").strip()
|
|
531
544
|
public_key = data.get("public_key")
|
|
532
545
|
token = data.get("token")
|
|
@@ -562,7 +575,7 @@ def register_node(request):
|
|
|
562
575
|
try:
|
|
563
576
|
port = int(port)
|
|
564
577
|
except (TypeError, ValueError):
|
|
565
|
-
port =
|
|
578
|
+
port = 8888
|
|
566
579
|
|
|
567
580
|
verified = False
|
|
568
581
|
if public_key and token and signature:
|
|
@@ -1090,6 +1103,101 @@ def _toggle_rfid(
|
|
|
1090
1103
|
return True, detail, {"require_rfid": enable_bool}
|
|
1091
1104
|
|
|
1092
1105
|
|
|
1106
|
+
def _send_local_rfid_list_remote(
|
|
1107
|
+
charger: Charger, payload: Mapping | None = None
|
|
1108
|
+
) -> tuple[bool, str, dict[str, object]]:
|
|
1109
|
+
connector_value = charger.connector_id
|
|
1110
|
+
ws = store.get_connection(charger.charger_id, connector_value)
|
|
1111
|
+
if ws is None:
|
|
1112
|
+
return False, "no active connection", {}
|
|
1113
|
+
authorization_list = []
|
|
1114
|
+
if payload is not None:
|
|
1115
|
+
authorization_list = payload.get("local_authorization_list", []) or []
|
|
1116
|
+
if not isinstance(authorization_list, list):
|
|
1117
|
+
return False, "local_authorization_list must be a list", {}
|
|
1118
|
+
list_version = None
|
|
1119
|
+
if payload is not None:
|
|
1120
|
+
list_version = payload.get("list_version")
|
|
1121
|
+
if list_version is None:
|
|
1122
|
+
list_version_value = (charger.local_auth_list_version or 0) + 1
|
|
1123
|
+
else:
|
|
1124
|
+
try:
|
|
1125
|
+
list_version_value = int(list_version)
|
|
1126
|
+
except (TypeError, ValueError):
|
|
1127
|
+
return False, "invalid list_version", {}
|
|
1128
|
+
if list_version_value <= 0:
|
|
1129
|
+
return False, "invalid list_version", {}
|
|
1130
|
+
update_type = "Full"
|
|
1131
|
+
if payload is not None and payload.get("update_type"):
|
|
1132
|
+
update_type = str(payload.get("update_type") or "").strip() or "Full"
|
|
1133
|
+
message_id = uuid.uuid4().hex
|
|
1134
|
+
msg_payload = {
|
|
1135
|
+
"listVersion": list_version_value,
|
|
1136
|
+
"updateType": update_type,
|
|
1137
|
+
"localAuthorizationList": authorization_list,
|
|
1138
|
+
}
|
|
1139
|
+
msg = json.dumps([2, message_id, "SendLocalList", msg_payload])
|
|
1140
|
+
try:
|
|
1141
|
+
async_to_sync(ws.send)(msg)
|
|
1142
|
+
except Exception as exc:
|
|
1143
|
+
return False, f"failed to send SendLocalList ({exc})", {}
|
|
1144
|
+
log_key = store.identity_key(charger.charger_id, connector_value)
|
|
1145
|
+
store.add_log(log_key, f"< {msg}", log_type="charger")
|
|
1146
|
+
store.register_pending_call(
|
|
1147
|
+
message_id,
|
|
1148
|
+
{
|
|
1149
|
+
"action": "SendLocalList",
|
|
1150
|
+
"charger_id": charger.charger_id,
|
|
1151
|
+
"connector_id": connector_value,
|
|
1152
|
+
"log_key": log_key,
|
|
1153
|
+
"list_version": list_version_value,
|
|
1154
|
+
"list_size": len(authorization_list),
|
|
1155
|
+
"requested_at": timezone.now(),
|
|
1156
|
+
},
|
|
1157
|
+
)
|
|
1158
|
+
store.schedule_call_timeout(
|
|
1159
|
+
message_id,
|
|
1160
|
+
action="SendLocalList",
|
|
1161
|
+
log_key=log_key,
|
|
1162
|
+
message="SendLocalList request timed out",
|
|
1163
|
+
)
|
|
1164
|
+
return True, "SendLocalList dispatched", {}
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
def _get_local_list_version_remote(
|
|
1168
|
+
charger: Charger, payload: Mapping | None = None
|
|
1169
|
+
) -> tuple[bool, str, dict[str, object]]:
|
|
1170
|
+
connector_value = charger.connector_id
|
|
1171
|
+
ws = store.get_connection(charger.charger_id, connector_value)
|
|
1172
|
+
if ws is None:
|
|
1173
|
+
return False, "no active connection", {}
|
|
1174
|
+
message_id = uuid.uuid4().hex
|
|
1175
|
+
msg = json.dumps([2, message_id, "GetLocalListVersion", {}])
|
|
1176
|
+
try:
|
|
1177
|
+
async_to_sync(ws.send)(msg)
|
|
1178
|
+
except Exception as exc:
|
|
1179
|
+
return False, f"failed to send GetLocalListVersion ({exc})", {}
|
|
1180
|
+
log_key = store.identity_key(charger.charger_id, connector_value)
|
|
1181
|
+
store.add_log(log_key, f"< {msg}", log_type="charger")
|
|
1182
|
+
store.register_pending_call(
|
|
1183
|
+
message_id,
|
|
1184
|
+
{
|
|
1185
|
+
"action": "GetLocalListVersion",
|
|
1186
|
+
"charger_id": charger.charger_id,
|
|
1187
|
+
"connector_id": connector_value,
|
|
1188
|
+
"log_key": log_key,
|
|
1189
|
+
"requested_at": timezone.now(),
|
|
1190
|
+
},
|
|
1191
|
+
)
|
|
1192
|
+
store.schedule_call_timeout(
|
|
1193
|
+
message_id,
|
|
1194
|
+
action="GetLocalListVersion",
|
|
1195
|
+
log_key=log_key,
|
|
1196
|
+
message="GetLocalListVersion request timed out",
|
|
1197
|
+
)
|
|
1198
|
+
return True, "GetLocalListVersion requested", {}
|
|
1199
|
+
|
|
1200
|
+
|
|
1093
1201
|
def _change_availability_remote(
|
|
1094
1202
|
charger: Charger, payload: Mapping | None = None
|
|
1095
1203
|
) -> tuple[bool, str, dict[str, object]]:
|
|
@@ -1143,6 +1251,40 @@ def _change_availability_remote(
|
|
|
1143
1251
|
return True, f"requested ChangeAvailability {availability_label}", updates
|
|
1144
1252
|
|
|
1145
1253
|
|
|
1254
|
+
def _clear_cache_remote(
|
|
1255
|
+
charger: Charger, payload: Mapping | None = None
|
|
1256
|
+
) -> tuple[bool, str, dict[str, object]]:
|
|
1257
|
+
connector_value = charger.connector_id
|
|
1258
|
+
ws = store.get_connection(charger.charger_id, connector_value)
|
|
1259
|
+
if ws is None:
|
|
1260
|
+
return False, "no active connection", {}
|
|
1261
|
+
message_id = uuid.uuid4().hex
|
|
1262
|
+
msg = json.dumps([2, message_id, "ClearCache", {}])
|
|
1263
|
+
try:
|
|
1264
|
+
async_to_sync(ws.send)(msg)
|
|
1265
|
+
except Exception as exc:
|
|
1266
|
+
return False, f"failed to send ClearCache ({exc})", {}
|
|
1267
|
+
log_key = store.identity_key(charger.charger_id, connector_value)
|
|
1268
|
+
store.add_log(log_key, f"< {msg}", log_type="charger")
|
|
1269
|
+
requested_at = timezone.now()
|
|
1270
|
+
store.register_pending_call(
|
|
1271
|
+
message_id,
|
|
1272
|
+
{
|
|
1273
|
+
"action": "ClearCache",
|
|
1274
|
+
"charger_id": charger.charger_id,
|
|
1275
|
+
"connector_id": connector_value,
|
|
1276
|
+
"log_key": log_key,
|
|
1277
|
+
"requested_at": requested_at,
|
|
1278
|
+
},
|
|
1279
|
+
)
|
|
1280
|
+
store.schedule_call_timeout(
|
|
1281
|
+
message_id,
|
|
1282
|
+
action="ClearCache",
|
|
1283
|
+
log_key=log_key,
|
|
1284
|
+
)
|
|
1285
|
+
return True, "requested ClearCache", {}
|
|
1286
|
+
|
|
1287
|
+
|
|
1146
1288
|
def _set_availability_state_remote(
|
|
1147
1289
|
charger: Charger, payload: Mapping | None = None
|
|
1148
1290
|
) -> tuple[bool, str, dict[str, object]]:
|
|
@@ -1207,7 +1349,10 @@ REMOTE_ACTIONS = {
|
|
|
1207
1349
|
"get-configuration": _send_get_configuration,
|
|
1208
1350
|
"reset": _send_reset,
|
|
1209
1351
|
"toggle-rfid": _toggle_rfid,
|
|
1352
|
+
"send-local-rfid-list": _send_local_rfid_list_remote,
|
|
1353
|
+
"get-local-list-version": _get_local_list_version_remote,
|
|
1210
1354
|
"change-availability": _change_availability_remote,
|
|
1355
|
+
"clear-cache": _clear_cache_remote,
|
|
1211
1356
|
"set-availability-state": _set_availability_state_remote,
|
|
1212
1357
|
"remote-stop": _remote_stop_transaction_remote,
|
|
1213
1358
|
}
|