Fix token tearning

This commit is contained in:
Oliver Traber 2024-04-20 17:45:20 +02:00
parent dfa36b6294
commit abb106428b

View file

@ -43,7 +43,7 @@ class ChargePoint(cp):
db_chargepoint = db.query(DbChargePoint).filter(DbChargePoint.identity == self.id).first() db_chargepoint = db.query(DbChargePoint).filter(DbChargePoint.identity == self.id).first()
# Learn token if requested # Learn token if requested
if db_chargepoint.learn_user_id != None: if db_chargepoint.learn_user_id != None:
if db_chargepoint.learn_until.timestamp() < datetime.now(UTC).timestamp(): if db_chargepoint.learn_until.timestamp() > datetime.now(UTC).timestamp():
db_id_token = DbIdToken() db_id_token = DbIdToken()
db_id_token.friendly_name = "New token learned by {}".format(self.id) db_id_token.friendly_name = "New token learned by {}".format(self.id)
db_id_token.is_active = True db_id_token.is_active = True
@ -145,10 +145,6 @@ class ChargePoint(cp):
id_token_info = await self.__get_id_token_info(id_token) id_token_info = await self.__get_id_token_info(id_token)
return call_result.AuthorizePayload(id_token_info) return call_result.AuthorizePayload(id_token_info)
@on(Action.MeterValues)
async def on_meter_values(self, **kwargs):
return call_result.MeterValuesPayload()
@on(Action.TransactionEvent) @on(Action.TransactionEvent)
async def on_transaction_event( async def on_transaction_event(
self, self,
@ -237,3 +233,7 @@ class ChargePoint(cp):
if id_token != None: if id_token != None:
return call_result.TransactionEventPayload(id_token_info=id_token_info) return call_result.TransactionEventPayload(id_token_info=id_token_info)
return call_result.TransactionEventPayload() return call_result.TransactionEventPayload()
@on(Action.MeterValues)
async def on_meter_values(self, **kwargs):
return call_result.MeterValuesPayload()