async def main(): async with websockets.connect('ws://localhost:9000/CP_1', subprotocols=['ocpp1.6']) as ws: cp = ChargePoint('CP_1', ws) await asyncio.gather(cp.start(), cp.send_boot_notification())
async def main(): async with websockets.connect('ws://149.56.47.168:8080/PCremote', subprotocols=['ocpp1.6']) as ws: cp = ChargePoint('CP_1', ws) await asyncio.gather(cp.start(), cp.send_boot_notification(), cp.send_authorize(), cp.send_start_transaction())
async def main(): async with websockets.connect('%s/serial123' % config.CS_URL, subprotocols=['ocpp1.6']) as ws: cp = ChargePoint('serial123', ws) await asyncio.gather(cp.start(), cp.send_boot_notification(), cp.send_heartbeat(), cp.send_start_transaction(), cp.send_stop_transaction())
async def main(): async with websockets.connect( # 链接 'ws://localhost:9000/CP_1', # 目的地址 + 序号 subprotocols=['ocpp1.6']) as ws: cp = ChargePoint('CP_1', ws) # 实例化cp 包含名字和 ws 协议 await asyncio.gather( cp.start(), cp.send_boot_notification(), # cp.clear_cache_notification() ) #先start ,在发送