diff --git a/app/ocpp_proto/chargepoint.py b/app/ocpp_proto/chargepoint.py index 8499762..0f679df 100644 --- a/app/ocpp_proto/chargepoint.py +++ b/app/ocpp_proto/chargepoint.py @@ -43,7 +43,7 @@ class ChargePoint(cp): db_chargepoint = db.query(DbChargePoint).filter(DbChargePoint.identity == self.id).first() # Learn token if requested 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.friendly_name = "New token learned by {}".format(self.id) db_id_token.is_active = True @@ -145,10 +145,6 @@ class ChargePoint(cp): id_token_info = await self.__get_id_token_info(id_token) return call_result.AuthorizePayload(id_token_info) - @on(Action.MeterValues) - async def on_meter_values(self, **kwargs): - return call_result.MeterValuesPayload() - @on(Action.TransactionEvent) async def on_transaction_event( self, @@ -237,3 +233,7 @@ class ChargePoint(cp): if id_token != None: return call_result.TransactionEventPayload(id_token_info=id_token_info) return call_result.TransactionEventPayload() + + @on(Action.MeterValues) + async def on_meter_values(self, **kwargs): + return call_result.MeterValuesPayload()