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())
Example #2
0
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())
Example #3
0
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())
Example #4
0
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 ,在发送