Closed robogeek closed 1 year ago
I found an example at https://github.com/bbartling/openadrtester which was easily able to run, including under the Docker setup I described.
After carefully comparing the code I found that the initialization of the event loop had to be this:
loop = asyncio.new_event_loop()
loop.set_debug(True)
asyncio.set_event_loop(loop)
loop.create_task(server.run())
# Using this line causes failure
# asyncio.run(server.run(), debug=True)
loop.run_forever()
You got a TimeoutError, which seems to be related to a communication problem between the VEN and the VTN inside the Docker Container. Seems like you solved that problem; I think you have to configure your docker container to forward specific ports into your container so that they can be reached from the outside.
I'm still trying to get an example setup running and the current issue is that the VEN client is not registering with the VTN. Instead, this is printed:
This message comes from
OADRClient.run
after this line:await self.create_party_registration(ven_id=self.ven_id)
In the server, I am not sure of the correct value for
http_host
. The default value,127.0.0.1
, would seem to cause the VTN to only listen to connects from inside the Docker container. But, obviously, the VTN must be able to accept connections from VEN nodes anywhere. It seems from theaiohttp
documentation that an empty string forhttp_host
has the right effect, but the documentation is incomplete.The debug output includes the XML of the registration attempt. I've checked this against the OpenADR spec and it seems to be correct.
I have created Docker containers, one for the VTN, and the other for the VEN, as follows:
Inside the VEN container, the VTN container and its port are visible:
The relevant portion of the client code is:
The relevant part of the server is:
The full output is the following: