RemoteStartTransaction: TimeoutErrore
See original GitHub issueI’m trying to run the code in https://github.com/mobilityhouse/ocpp/issues/81#issue-592479514 after making the corrections in on_connect presented in https://github.com/mobilityhouse/ocpp/issues/81#issuecomment-607877799 , but I’m getting TimeoutErrore on the central system side. Can you help, please?
Central_system.py
import asyncio
from datetime import datetime
#from simple_charge.config.settings import *
#from simple_charge.config.handlers import *
from pymongo import MongoClient
from bson import ObjectId
import json
from ocpp.routing import on
from ocpp.v16 import ChargePoint as cp
from ocpp.v16.enums import *
from ocpp.v16 import call_result, call
try:
import websockets
except ModuleNotFoundError:
print("This example relies on the 'websockets' package.")
print("Please install it by running: ")
print()
print(" $ pip install websockets")
import sys
sys.exit(1)
class ChargePoint(cp):
@on(Action.BootNotification)
def on_boot_notification(self, charge_point_vendor, charge_point_model, **kwargs):
return call_result.BootNotificationPayload(
current_time=datetime.utcnow().isoformat(),
interval=10,
status=RegistrationStatus.accepted
)
@on(Action.Heartbeat)
def on_heartbeat(self):
return call_result.HeartbeatPayload(
current_time=datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%S') + "Z"
)
@on(Action.Authorize)
def on_authorize(self, id_tag):
return call_result.AuthorizePayload(
id_tag_info={
"status": 'Accepted'
}
)
@on(Action.StartTransaction)
def on_start_transaction(self, connector_id, id_tag, timestamp, meter_start, reservation_id):
return call_result.StartTransactionPayload(
id_tag_info={
"status": 'Accepted'
},
transaction_id=int(1)
)
@on(Action.StopTransaction)
def on_stop_transaction(self, transaction_id, id_tag, timestamp, meter_stop):
return call_result.StopTransactionPayload()
@on(Action.MeterValues)
def on_meter_value(self):
return call_result.MeterValuesPayload()
@on(Action.StatusNotification)
def on_status_notification(self, connector_id, error_code, status):
return call_result.StatusNotificationPayload()
@on(Action.DataTransfer)
def on_data_transfer(self, vendor_id, message_id, data):
return call_result.DataTransferPayload(
status='Accepted'
)
async def remote_start_transaction(self):
request = call.RemoteStartTransactionPayload(
id_tag='1'
)
response = await self.call(request)
if response.status == RemoteStartStopStatus.accepted:
print("Transaction Started!!!")
async def remote_stop_transaction(self):
request = call.RemoteStopTransactionPayload(
transaction_id=1
)
response = await self.call(request)
if response.status == RemoteStartStopStatus.accepted:
print("Stopping transaction")
connected = set()
clients = dict()
ping_counter = 0
clients_couter = 0
async def on_connect(websocket, path):
charge_point_id = path.strip('/')
cp = ChargePoint(charge_point_id, websocket)
try:
await asyncio.gather(cp.start(), cp.remote_start_transaction())
except websockets.exceptions.ConnectionClosed:
connected.remove(websocket)
print("Charge Point disconnected")
async def actions(websocket, path):
charge_point_id = path.strip('/')
cp = ChargePoint(charge_point_id, websocket)
if websocket:
print("B action", websocket)
await cp.remote_start_transaction()
async def register(websocket, path):
await asyncio.sleep(2)
connected.add(websocket)
await actions(websocket, path)
Issue Analytics
- State:
- Created 2 years ago
- Comments:11
Top Results From Across the Web
Global transaction timeout error when content packs of object ...
During startup of WebSphere Process Server or WebSphere Enterprise Service Bus (WebSphere ESB), a global transaction timeout error can occur ...
Read more >Transaction timeout error from running the calculate price utility
A transaction timeout error occurs from running the calculate price utility. Solution. This error occurs because the utility did not complete before its ......
Read more >3121-Transaction Timeout Error Detected
The device firmware or driver is out of date. The device is failing. Action. Update the firmware and drivers on the specified device....
Read more >Transaction Timeouts - MariaDB Knowledge Base
These accept a time in seconds to time out, by closing the connection, transactions that are idle for longer than this period. By...
Read more >How to Fix a Lock Wait Timeout Exceeded Error in MySQL
The above simply means the transaction has reached the innodb_lock_wait_timeout while waiting to obtain an exclusive lock which defaults to 50 ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, I tried the code myself as well and it works on my end as well, as you can check by this screenshot. On top you have the CSMS and on the bottom the CP:
This is the code I have used.
CSMS
CP
@tropxy thank you very much.