Update dependencies
All checks were successful
ci/woodpecker/push/docker Pipeline was successful

This commit is contained in:
Oliver Traber 2025-03-12 23:42:02 +00:00
parent be039e7376
commit 00dff24767
Signed by: Bluemedia
GPG key ID: C0674B105057136C
8 changed files with 1208 additions and 843 deletions

View file

@ -4,8 +4,8 @@ import os
from ocpp.routing import on, after
from ocpp.v201 import ChargePoint as cp
from ocpp.v201 import call_result
from ocpp.v201.enums import Action, RegistrationStatusType, TransactionEventType
from ocpp.v201.call import GetBaseReportPayload
from ocpp.v201.enums import Action, RegistrationStatusEnumType, TransactionEventEnumType
from ocpp.v201.call import GetBaseReport
from app.services import (
variable_service,
@ -16,42 +16,42 @@ from app.services import (
class ChargePoint(cp):
@on(Action.BootNotification)
@on(Action.boot_notification)
async def on_boot_notification(self, charging_station, **kwargs):
await chargepoint_service.update_attributes(
chargepoint_identity=self.id,
charging_station=charging_station
)
return call_result.BootNotificationPayload(
return call_result.BootNotification(
current_time=datetime.now(UTC).isoformat(),
interval=int(os.getenv("CS_HEARTBEAT_INTERVAL", "1800")),
status=RegistrationStatusType.accepted
status=RegistrationStatusEnumType.accepted
)
@after(Action.BootNotification)
@after(Action.boot_notification)
async def after_boot_notification(self, **kwargs):
await self.call(payload=GetBaseReportPayload(request_id=0, report_base="FullInventory"))
await self.call(payload=GetBaseReport(request_id=0, report_base="FullInventory"))
@on(Action.NotifyReport)
@on(Action.notify_report)
async def on_notify_report(self, report_data, **kwargs):
for entry in report_data:
await variable_service.create_or_update_variable(
chargepoint_identity=self.id,
report_entry=entry
)
return call_result.NotifyReportPayload()
return call_result.NotifyReport()
@on(Action.Heartbeat)
@on(Action.heartbeat)
async def on_heartbeat_request(self):
return call_result.HeartbeatPayload(
return call_result.Heartbeat(
current_time=datetime.now(UTC).isoformat()
)
@after(Action.Heartbeat)
@after(Action.heartbeat)
async def after_heartbeat_request(self):
await chargepoint_service.update_last_seen(chargepoint_identity=self.id)
@on(Action.StatusNotification)
@on(Action.status_notification)
async def on_status_notification(self, evse_id: int, connector_id: int, connector_status: str, **kwargs):
await chargepoint_service.create_or_update_connector(
chargepoint_identity=self.id,
@ -59,14 +59,14 @@ class ChargePoint(cp):
connector_id=connector_id,
connector_status=connector_status
)
return call_result.StatusNotificationPayload()
return call_result.StatusNotification()
@on(Action.Authorize)
@on(Action.authorize)
async def on_authorize(self, id_token, **kwargs):
id_token_info, _ = await id_token_service.get_id_token_info(chargepoint_id=self.id, id_token=id_token)
return call_result.AuthorizePayload(id_token_info)
return call_result.Authorize(id_token_info)
@on(Action.TransactionEvent)
@on(Action.transaction_event)
async def on_transaction_event(
self,
event_type,
@ -82,7 +82,7 @@ class ChargePoint(cp):
id_token_info = None
token_owner_id = None
if event_type == str(TransactionEventType.started):
if event_type == str(TransactionEventEnumType.started):
await transaction_service.create_transaction(
chargepoint_identity=self.id,
user_id=token_owner_id,
@ -90,12 +90,12 @@ class ChargePoint(cp):
transaction_info=transaction_info,
transaction_data=kwargs
)
elif event_type == str(TransactionEventType.updated):
elif event_type == str(TransactionEventEnumType.updated):
await transaction_service.update_transaction(
transaction_id=transaction_info["transaction_id"],
transaction_data=kwargs
)
elif event_type == str(TransactionEventType.ended):
elif event_type == str(TransactionEventEnumType.ended):
await transaction_service.end_transaction(
transaction_id=transaction_info["transaction_id"],
timestamp=datetime.fromisoformat(timestamp),
@ -105,14 +105,14 @@ class ChargePoint(cp):
)
if id_token_info == None:
return call_result.TransactionEventPayload()
return call_result.TransactionEvent()
else:
return call_result.TransactionEventPayload(id_token_info=id_token_info)
return call_result.TransactionEvent(id_token_info=id_token_info)
@on(Action.MeterValues)
@on(Action.meter_values)
async def on_meter_values(self, **kwargs):
return call_result.MeterValuesPayload()
return call_result.MeterValues()
@on(Action.SecurityEventNotification)
@on(Action.security_event_notification)
async def on_security_event_notification(self, **kwargs):
return call_result.SecurityEventNotificationPayload()
return call_result.SecurityEventNotification()