OpenLEADR / openleadr-python

Python library for OpenADR
https://openleadr.org/docs
Apache License 2.0
133 stars 51 forks source link

run vtn on Heroku #57

Closed bbartling closed 3 years ago

bbartling commented 3 years ago

Hi Stan,

I was curious to ask if a openLeadr VTN script could run on a Heroku...? I also apologize not a aiohttp expert or heroku or web development, we are just doing some demand response research in the next couple months with open ADR on a test building site (research company office) and I was curious to try a few scenorio's with openLeadr from the cloud if possible..

So my VTN script: (generic/default type code)

import asyncio
from datetime import datetime, timezone, timedelta
from openleadr import OpenADRServer, enable_default_logging
from functools import partial

enable_default_logging()

async def on_create_party_registration(registration_info):
    """
    Inspect the registration info and return a ven_id and registration_id.
    """
    if registration_info['ven_name'] == 'ven123':
        ven_id = 'ven_id_123'
        registration_id = 'reg_id_123'
        return ven_id, registration_id
    else:
        return False

async def on_register_report(ven_id, resource_id, measurement, unit, scale,
                             min_sampling_interval, max_sampling_interval):
    """
    Inspect a report offering from the VEN and return a callback and sampling interval for receiving the reports.
    """
    callback = partial(on_update_report, ven_id=ven_id, resource_id=resource_id, measurement=measurement)
    sampling_interval = min_sampling_interval
    return callback, sampling_interval

async def on_update_report(data, ven_id, resource_id, measurement):
    """
    Callback that receives report data from the VEN and handles it.
    """
    for time, value in data:
        print(f"Ven {ven_id} reported {measurement} = {value} at time {time} for resource {resource_id}")

async def event_response_callback(ven_id, event_id, opt_type):
    """
    Callback that receives the response from a VEN to an Event.
    """
    print(f"VEN {ven_id} responded to Event {event_id} with: {opt_type}")

# Create the server object
server = OpenADRServer(vtn_id='myvtn')

# Add the handler for client (VEN) registrations
server.add_handler('on_create_party_registration', on_create_party_registration)

# Add the handler for report registrations from the VEN
server.add_handler('on_register_report', on_register_report)

# Add a prepared event for a VEN that will be picked up when it polls for new messages.
server.add_event(ven_id='ven_id_123',
                 signal_name='LOAD_CONTROL',
                 signal_type='x-loadControlCapacity',
                 intervals=[{'dtstart': datetime.now(timezone.utc) + timedelta(minutes=5),
                             'duration': timedelta(minutes=60),
                             'signal_payload': 100.0}],
                 callback=event_response_callback)

# Run the server on the asyncio event loop
loop = asyncio.get_event_loop()
loop.create_task(server.run())
loop.run_forever()

Heroku requires this Procfile: web: python vtn.py --bind localhost:8080

And a requirements.txt

aiohttp
Flask
Werkzeug
openleadr

Thru git when I push the app up to heroku and it runs, there an error ModuleNotFoundError: No module named 'dataclasses' which on a Google search some info pops up about Python version issues between 3.6 and 3.7, I think Heroku is running 3.7.

It took me a little while how to figure out how to run an aiohttp app on Heroku and I posted the answer here on stackoverflow for a hello world example.

Would anyone have any tips? Or suggestions to try something different?

Thanks!

bbartling commented 3 years ago

Trial number 2 on heroku I found out I can specify the Python version on Heruko. Specifying 3.9 Python (formerly 3.6) I can still see the same ModuleNotFoundError: No module named 'dataclasses' error in the heroku error log but now I can at least see this now:

2021-03-06T17:23:17.541676+00:00 app[web.1]: ********************************************************************************
2021-03-06T17:23:17.541677+00:00 app[web.1]: Your VTN Server is now running at
2021-03-06T17:23:17.541681+00:00 app[web.1]: http://127.0.0.1:8080/OpenADR2/Simple/2.0b
2021-03-06T17:23:17.541682+00:00 app[web.1]: ********************************************************************************

I think I made the app crash trying to open up a web browser for the Heroku app on the default URL that Heroku made up warm-fjord-27183.herokuapp.com

Is there a web page dash board incorporated with openLeadr that I could open up when launched through Heruko to see if everythings running Ok? Thanks for anytime in response!!

stan-janssen commented 3 years ago

The first thing I can think of is that maybe the aiohttp server is not listening on a non-localhost interface. Try passing http_host='0.0.0.0' to the OpenADRServer() call, and see if that helps.

To test if the web server is reachable, you can also add a dummy "GET" handler, similar to the way I described in this comment to one of your earlier questions.

If I have the time, I'll try to get it up and running on Heroku myself later, I haven't used them in a long time so I don't exactly remember what could be the problem here.

stan-janssen commented 3 years ago

Oh and yes, you need at least Python 3.7 to run OpenLEADR.

bbartling commented 3 years ago

Well this looks better :)

So passing in the 0.0.0.0

# Create the server object
server = OpenADRServer(http_host='0.0.0.0',vtn_id='myvtn')

And changing the Procfile: web: python vtn.py --bind 0.0.0.0:8080

I havent even tried open up the web browser for the dash board, but in the heroku logs I notice this repeatable pattern for whatever reason the Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch1

Full traceback:

2021-03-09T13:33:52.000000+00:00 app[api]: Build started by user ben.bartling@gmail.com
2021-03-09T13:34:18.467420+00:00 app[api]: Deploy 46792c14 by user ben.bartling@gmail.com
2021-03-09T13:34:18.467420+00:00 app[api]: Release v6 created by user ben.bartling@gmail.com
2021-03-09T13:34:18.646035+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-09T13:34:23.458457+00:00 heroku[web.1]: Starting process with command `python vtn.py --bind 0.0.0.0:8080`
2021-03-09T13:34:28.848737+00:00 app[web.1]: If you provide a 'ven_lookup' to your OpenADRServer() init, OpenLEADR can automatically issue ReregistrationRequests for VENs that don't exist in your system. Please see https://openleadr.org/docs/server.html#things-you-should-implement.
2021-03-09T13:34:28.851594+00:00 app[web.1]:
2021-03-09T13:34:28.851655+00:00 app[web.1]: ********************************************************************************
2021-03-09T13:34:28.851714+00:00 app[web.1]: Your VTN Server is now running at
2021-03-09T13:34:28.851775+00:00 app[web.1]: http://0.0.0.0:8080/OpenADR2/Simple/2.0b
2021-03-09T13:34:28.851830+00:00 app[web.1]: ********************************************************************************
2021-03-09T13:34:28.851863+00:00 app[web.1]:
2021-03-09T13:34:30.000000+00:00 app[api]: Build succeeded
2021-03-09T13:35:23.907669+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-03-09T13:35:23.961930+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-03-09T13:35:24.055944+00:00 heroku[web.1]: Process exited with status 137
2021-03-09T13:35:24.121564+00:00 heroku[web.1]: State changed from starting to crashed
2021-03-09T13:35:24.136464+00:00 heroku[web.1]: State changed from crashed to starting
2021-03-09T13:35:28.482364+00:00 heroku[web.1]: Starting process with command `python vtn.py --bind 0.0.0.0:8080`
2021-03-09T13:35:32.921190+00:00 app[web.1]: If you provide a 'ven_lookup' to your OpenADRServer() init, OpenLEADR can automatically issue ReregistrationRequests for VENs that don't exist in your system. Please see https://openleadr.org/docs/server.html#things-you-should-implement.
2021-03-09T13:35:32.924374+00:00 app[web.1]:
2021-03-09T13:35:32.924381+00:00 app[web.1]: ********************************************************************************
2021-03-09T13:35:32.924383+00:00 app[web.1]: Your VTN Server is now running at
2021-03-09T13:35:32.924433+00:00 app[web.1]: http://0.0.0.0:8080/OpenADR2/Simple/2.0b
2021-03-09T13:35:32.924485+00:00 app[web.1]: ********************************************************************************
2021-03-09T13:35:32.924516+00:00 app[web.1]:
2021-03-09T13:36:28.638970+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-03-09T13:36:28.716906+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-03-09T13:36:28.791009+00:00 heroku[web.1]: Process exited with status 137
2021-03-09T13:36:28.889377+00:00 heroku[web.1]: State changed from starting to crashed

Thanks Stan for any tips to try! If you had any suggestions, is it possible to ask Heroku Dev people? I would need some help on even what to ask them :)

stan-janssen commented 3 years ago

In your procfile, does it work if you leave off the --bind parameter? So just:

web: python vtn.py

The vtn already tries to bind itself to 0.0.0.0:8080, but now Heroku also tries to bind something which makes it crash.

bbartling commented 3 years ago

So Procfile modification: web: python vtn.py

Still crashing after 60 seconds :(

2021-03-10T13:23:57.372411+00:00 app[web.1]:
2021-03-10T13:23:57.372423+00:00 app[web.1]: ********************************************************************************
2021-03-10T13:23:57.372424+00:00 app[web.1]: Your VTN Server is now running at
2021-03-10T13:23:57.372424+00:00 app[web.1]: http://0.0.0.0:8080/OpenADR2/Simple/2.0b
2021-03-10T13:23:57.372424+00:00 app[web.1]: ********************************************************************************
2021-03-10T13:23:57.372424+00:00 app[web.1]:
2021-03-10T13:24:52.816132+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2021-03-10T13:24:52.892757+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-03-10T13:24:52.973138+00:00 heroku[web.1]: Process exited with status 137
2021-03-10T13:24:53.100986+00:00 heroku[web.1]: State changed from starting to crashed
bbartling commented 3 years ago

Some stackoverflow posts for this error state for like bots or non-web Java apps on heroku state to change the Procfile from web: to worker: but I dont think that makes sense for openleadr as openADR I am 99.9% confident would for sure be a web app.

stan-janssen commented 3 years ago

I'll look into it a bit later today. I'm not familiar enough with the way Heroku deals with this kind of thing, so I'll have to try for myself and I'll let you know.

stan-janssen commented 3 years ago

A working Heroku deployment consist of the following:

Procfile:

web: gunicorn vtn:main --worker-class aiohttp.worker.GunicornWebWorker

runtime.txt:

python-3.9.2

requirements.txt:

openleadr
gunicorn

vtn.py:

from openleadr import OpenADRServer

server = OpenADRServer(vtn_id='myvtn')

...

async def main():
    return server.app

The main differences between running something on a "normal" server and Heroku are:

I have a bare-bones server running on http://openleadrvtn.herokuapp.com. You can point your VEN at http://openleadrvtn.herokuapp.com:80/OpenADR2/Simple/2.0b and it should work.

Hope this helps!

stan-janssen commented 3 years ago

One more thing: If you ever want to use TLS, you will have to not only provide the TLS certs to the OpenLEADR application, but also to Heroku. This is because Heroku manages the web server part for you, so they host the TLS for the connection. I'm not exactly sure if this is transparently forwarded to the internal application, because some fingerprint-checking logic depends on having access to the connection details, but I'll figure that out at a later time.

bbartling commented 3 years ago

Stan,

Would I delete this from the bottom of vtn.py if I am adding in the main function for the server app?

# Run the server on the asyncio event loop
loop = asyncio.get_event_loop()
loop.create_task(server.run())
loop.run_forever()
stan-janssen commented 3 years ago

Yes, exactly. Remove those lines and add the main function.

bbartling commented 3 years ago

well this is fun, absolutely no rush on a response... So I have my vtn.py running on heroku and on the building side just installed python 3.9.2 on a Windows machine (sorry I know I should be on Linux)

If I run my ven script inside the building:

import asyncio
from datetime import timedelta
from openleadr import OpenADRClient, enable_default_logging

enable_default_logging()

async def collect_report_value():
    # This callback is called when you need to collect a value for your Report
    return 1.23

async def handle_event(event):
    # This callback receives an Event dict.
    # You should include code here that sends control signals to your resources.
    print(event)
    return 'optIn'

# Create the client object
client = OpenADRClient(ven_name='ven123',
                       vtn_url='http://warm-fjord-27183.herokuapp.com:80/OpenADR2/Simple/2.0b')

# Add the report capability to the client
client.add_report(callback=collect_report_value,
                  resource_id='device001',
                  measurement='voltage',
                  sampling_rate=timedelta(seconds=10))

# Add event handling capability to the client
client.add_handler('on_event', handle_event)

# Run the client in the Python AsyncIO Event Loop
loop = asyncio.get_event_loop()
loop.create_task(client.run())
loop.run_forever()

I get this error:

Non-OK status 503 when performing a request to http://warm-fjord-27183.herokuapp.com:80/OpenADR2/Simple/2.0b/EiRegisterParty with data <?xml version="1.0" encoding="utf-8"?>
<oadr:oadrPayload xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07">
<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject"><oadr:oadrCreatePartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110"><requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">e2a8f225-0ba9-4730-8b30-b097b8443d51</requestID><oadr:oadrProfileName>2.0b</oadr:oadrProfileName><oadr:oadrTransportName>simpleHttp</oadr:oadrTransportName><oadr:oadrTransportAddress>None</oadr:oadrTransportAddress><oadr:oadrReportOnly>false</oadr:oadrReportOnly><oadr:oadrXmlSignature>false</oadr:oadrXmlSignature><oadr:oadrVenName>ven123</oadr:oadrVenName><oadr:oadrHttpPullModel>true</oadr:oadrHttpPullModel></oadr:oadrCreatePartyRegistration></oadr:oadrSignedObject>
</oadr:oadrPayload>: 503 <!DOCTYPE html>
    <html>
      <head>
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta charset="utf-8">
        <title>Application Error</title>
        <style media="screen">
          html,body,iframe {
            margin: 0;
            padding: 0;
          }
          html,body {
            height: 100%;
            overflow: hidden;
          }
          iframe {
            width: 100%;
            height: 100%;
            border: 0;
          }
        </style>
      </head>
      <body>
        <iframe src="//www.herokucdn.com/error-pages/application-error.html"></iframe>
      </body>
    </html>
No VEN ID received from the VTN, aborting.

On heroku logs: 2021-03-10T16:46:20.233710+00:00 heroku[router]: at=error code=H14 desc="No web processes running" method=POST path="/OpenADR2/Simple/2.0b/EiRegisterParty" host=warm-fjord-27183.herokuapp.com request_id=90f83cd7-282d-4df8-8975-c8a704a5c312 fwd="216.165.165.36" dyno= connect= service= status=503 bytes= protocol=http

stan-janssen commented 3 years ago

So the you are getting a response from Heroku. I think you have to start at least one process, like this on your command line:

heroku ps:scale web=1
bbartling commented 3 years ago

There's no way I would have been able to figure any of this out, thanks Stan this is getting more interesting by the minute.

So restarting my vtn heroku process, then my ven sript inside the building, and then in git on my heroku work flow using the command you gave me:

heroku ps:scale web=1

I think its working now! heroku logs:

2021-03-10T17:49:40.535556+00:00 app[web.1]: 10.13.211.10 [10/Mar/2021:17:49:40 +0000] "POST /OpenADR2/Simple/2.0b/OadrPoll HTTP/1.1" 200 791 "-" "Python/3.9 aiohttp/3.7.4.post0"
2021-03-10T17:49:50.111418+00:00 heroku[router]: at=info method=POST path="/OpenADR2/Simple/2.0b/EiReport" host=warm-fjord-27183.herokuapp.com request_id=24bdf580-8cd0-4edf-bb82-55b659bcb0f0 fwd="216.165.165.36" dyno=web.1 connect=4ms service=6ms status=200 bytes=862 protocol=http
2021-03-10T17:49:50.109117+00:00 app[web.1]: You should implement and register your own on_update_report handler to deal with reports that your receive from the VEN. This handler will receive either a complete oadrReport dict, or a list of (datetime, value) tuples that you can then process how you see fit. You don't need to return anything from that handler.
2021-03-10T17:49:50.109441+00:00 app[web.1]: Responding to oadrUpdateReport with a oadrUpdatedReport message: {'vtn_id': 'myvtn', 'ven_id': 'ven_id_123', 'response': {'request_id': '6a91b44b-f194-4af8-9d5e-20bda56c7ccf', 'response_code': 200, 'response_description': 'OK'}, 'request_id': '28be5372-09cf-4367-ac09-98f33e6f7400'}.
2021-03-10T17:49:50.110638+00:00 app[web.1]: 10.13.211.10 [10/Mar/2021:17:49:50 +0000] "POST /OpenADR2/Simple/2.0b/EiReport HTTP/1.1" 200 862 "-" "Python/3.9 aiohttp/3.7.4.post0"
2021-03-10T17:49:50.906627+00:00 app[web.1]: Responding to oadrPoll with a oadrResponse message: {'vtn_id': 'myvtn', 'ven_id': 'ven_id_123', 'response': {'request_id': None, 'response_code': 200, 'response_description': 'OK'}, 'request_id': '8a3edf09-a7d5-4789-9ed9-31968e0d5fb1'}.
2021-03-10T17:49:50.909156+00:00 app[web.1]: 10.13.211.10 [10/Mar/2021:17:49:50 +0000] "POST /OpenADR2/Simple/2.0b/OadrPoll HTTP/1.1" 200 791 "-" "Python/3.9 aiohttp/3.7.4.post0"
2021-03-10T17:49:50.908781+00:00 heroku[router]: at=info method=POST path="/OpenADR2/Simple/2.0b/OadrPoll" host=warm-fjord-27183.herokuapp.com request_id=a86bd859-c760-4f75-aec5-c441ffc300b1 fwd="216.165.165.36" dyno=web.1 connect=0ms service=5ms status=200 bytes=791 protocol=http

cmd prompt on the ven side:

Adding 2021-03-10 17:51:00.013955+00:00, 1.23 to report
The number of intervals in the report is now 1
Report will be sent now.
Adding 2021-03-10 17:51:10.013868+00:00, 1.23 to report
The number of intervals in the report is now 1
Report will be sent now.
Adding 2021-03-10 17:51:20.013875+00:00, 1.23 to report
The number of intervals in the report is now 1
Report will be sent now.

Thanks for all your help stan, I may let this code run for a while see how it goes. Looking forward to learning more, like development of using TLS, etc... And also the dashboard/GUI to view on Heroku.

I am in the process of setting up an IoT gateway which is the VOLTTRON platform developed by PNNL. The company I work for wants to test this VEN VOLTTRON driver, should be soon :)

stan-janssen commented 3 years ago

Nice. let me know how you get along. Oh and by the way: we totally support running openleadr on Windows, and if there is anything that doesn't work right on Windows, I'd like to know about it!

Good luck!

bbartling commented 3 years ago

Thanks Stan for all your help! This project is real cool to be a part of.

Any chance you could reiterate the TLS issue on Heroku one more time? I sort of understand but need to learn more :)

Is it ever possible to run on https port 443 to make secure? For example, This https://warm-fjord-27183.herokuapp.com:443/OpenADR2/Simple/2.0b

Instead of port 80 http: http://warm-fjord-27183.herokuapp.com:80/OpenADR2/Simple/2.0b

Also one more question how do I bring up the dash board on Heroku? Ill be presenting some VTN options to other people next week I would love to show this if possible. I was trying to look back on old notes where you mentioned this but I could figure it out. Is this close? http://warm-fjord-27183.herokuapp.com/gui/index.html

stan-janssen commented 3 years ago

Any chance you could reiterate the TLS issue on Heroku one more time? I sort of understand but need to learn more :)

Is it ever possible to run on https port 443 to make secure? For example, This https://warm-fjord-27183.herokuapp.com:443/OpenADR2/Simple/2.0b

Instead of port 80 http: http://warm-fjord-27183.herokuapp.com:80/OpenADR2/Simple/2.0b

Yes, you can absolutely get TLS working when running on Heroku. In any other web application, Heroku already provides TLS on the HTTP connection and your connection is secured. Your application does not even need to know that there is TLS running in front of it.

In the OpenADR standard, there are some strict requirements surrounding the exact certificates to use, and it requires the application itself to know about the certificates that are being used. I programmed OpenLEADR in a way that it can handle this, but if you run it on Heroku, OpenLEADR is no longer fully in charge of the "web server" part of the application. I'd have to do some experimentation to confirm that the TLS-information is being passed to the application. The central issue is that in OpenADR the TLS certificates are not only used to encrypt the transport, but also to authenticate the VEN and VTN. I'll have to look into it, I'll let you know what I find out.

Also one more question how do I bring up the dash board on Heroku? Ill be presenting some VTN options to other people next week I would love to show this if possible. I was trying to look back on old notes where you mentioned this but I could figure it out. Is this close? http://warm-fjord-27183.herokuapp.com/gui/index.html

The dashboard is not part of the openleadr library that you are using. It is a separate project that I'm building that uses the openleadr library. If you want to play with it, you're welcome to do so at a demo-VTN that I'm running here: http://openleadr.org:8911/gui/index.html. You can point your VEN at http://openleadr.org:8911/OpenADR2/Simple/2.0b, and the GUI will prompt you to for your input during registration and report registration. You can also click some buttons to generate an event for your VEN.

This is still a work in progress and I will be releasing a version of it sometime during the coming month, I hope.

bbartling commented 3 years ago

Wow cool thanks Stan for the info. Eagerly awaiting more info when it comes available for the dashboard and TLS. I may take you up on that with pointing our VOLTTRON VEN at http://openleadr.org:8911/OpenADR2/Simple/2.0b and playing around with the GUI in the next few weeks.

bbartling commented 3 years ago

Out curiosity, my remote VEN script running on Windows (same device):

import asyncio
from datetime import timedelta
from openleadr import OpenADRClient, enable_default_logging

enable_default_logging()

async def collect_report_value():
    # This callback is called when you need to collect a value for your Report
    return 1.23

async def handle_event(event):
    # This callback receives an Event dict.
    # You should include code here that sends control signals to your resources.
    print(event)
    return 'optIn'

# Create the client object
client = OpenADRClient(ven_name='ven123',
                       vtn_url='http://openleadr.org:8911/OpenADR2/Simple/2.0b')

# Add the report capability to the client
client.add_report(callback=collect_report_value,
                  resource_id='device001',
                  measurement='voltage',
                  sampling_rate=timedelta(seconds=10))

# Add event handling capability to the client
client.add_handler('on_event', handle_event)

# Run the client in the Python AsyncIO Event Loop
loop = asyncio.get_event_loop()
loop.create_task(client.run())
loop.run_forever()

If I aim it at your demo VTN, I get this returned. I noticed on the dashboard that there is a start server radio button, which seemed to switch over to stop server

Non-OK status 404 when performing a request to http://openleadr.org:8911/OpenADR2/Simple/2.0b/EiRegisterParty with data <?xml version="1.0" encoding="utf-8"?>
<oadr:oadrPayload xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07">
<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject"><oadr:oadrCreatePartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110"><requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">57fbc353-ee09-4312-afdf-69e8ab2db6f5</requestID><oadr:oadrProfileName>2.0b</oadr:oadrProfileName><oadr:oadrTransportName>simpleHttp</oadr:oadrTransportName><oadr:oadrTransportAddress>None</oadr:oadrTransportAddress><oadr:oadrReportOnly>false</oadr:oadrReportOnly><oadr:oadrXmlSignature>false</oadr:oadrXmlSignature><oadr:oadrVenName>ven123</oadr:oadrVenName><oadr:oadrHttpPullModel>true</oadr:oadrHttpPullModel></oadr:oadrCreatePartyRegistration></oadr:oadrSignedObject>
</oadr:oadrPayload>: 404 404: Not Found
No VEN ID received from the VTN, aborting.

I think I can remember reading somewhere the VEN would automatically register, right? Would it be viewable through the dashboard?

image

stan-janssen commented 3 years ago

Sorry, the URL that you point the VEN at should have port 8080 instead of 8911! The full URL for your VEN is shown right there below the Start Server button.

bbartling commented 3 years ago

Ah thanks so now with the port fix I get a 500 returned to the VEN side. This is what shows up in the command prompt on the VEN side:

Non-OK status 500 when performing a request to http://openleadr.org:8080/OpenADR2/Simple/2.0b/EiRegisterParty with data <?xml version="1.0" encoding="utf-8"?>
<oadr:oadrPayload xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07">
<oadr:oadrSignedObject xmlns:oadr="http://openadr.org/oadr-2.0b/2012/07" oadr:Id="oadrSignedObject"><oadr:oadrCreatePartyRegistration ei:schemaVersion="2.0b" xmlns:ei="http://docs.oasis-open.org/ns/energyinterop/201110"><requestID xmlns="http://docs.oasis-open.org/ns/energyinterop/201110/payloads">40f212b7-cced-4e13-b4e1-1e44449b3ffb</requestID><oadr:oadrProfileName>2.0b</oadr:oadrProfileName><oadr:oadrTransportName>simpleHttp</oadr:oadrTransportName><oadr:oadrTransportAddress>None</oadr:oadrTransportAddress><oadr:oadrReportOnly>false</oadr:oadrReportOnly><oadr:oadrXmlSignature>false</oadr:oadrXmlSignature><oadr:oadrVenName>ven123</oadr:oadrVenName><oadr:oadrHttpPullModel>true</oadr:oadrHttpPullModel></oadr:oadrCreatePartyRegistration></oadr:oadrSignedObject>
</oadr:oadrPayload>: 500 
No VEN ID received from the VTN, aborting.

Nothing pops up on the VTN side dashboard

stan-janssen commented 3 years ago

See this is why it's not really released yet ;-) I made some fixes on the server side, could you try it again?

stan-janssen commented 3 years ago

I saw your VEN register, you have to have the GUI open (refresh the page to reconnect) to be able to accept the registration.

bbartling commented 3 years ago

Yeah cool. I hit the accept button on the pop ups

image

stan-janssen commented 3 years ago

Yes, you can now click your VEN in the "Configured VENS" section top right, and you can see the messages in the bottom part.

bbartling commented 3 years ago

and you can see the messages in the bottom part.

Could you reiterate that part? I know this is only a demo but is it possible to send events back to the VEN through the demo VTN dashboard? This is pretty cool, now could you see through the dash board the 1.23 value being reported back?

stan-janssen commented 3 years ago

You'll see the messages being exchanged live on the dashboard:

vtn-dash

stan-janssen commented 3 years ago

If you want to send an Event to the VEN, use the Events section in the middle-right. Click the simple:level radio and then hit Generate Event. Your VEN should then pick up an Event on the next poll.

bbartling commented 3 years ago

Ah cool.

On my end the Gui for messages is blank. Using Chrome

image

stan-janssen commented 3 years ago

Reload the page to be sure, then select your VEN in the top right box.

bbartling commented 3 years ago

Actually I figured it out have to click on the VEN

bbartling commented 3 years ago

Super cool Ill experiment around with sending an event to the VEN next few days.

stan-janssen commented 3 years ago

Ok, nice. I'm sure the demo can is not completely stable, but don't worry, you won't be able to break anything important. I'll keep an eye on this thread.

bbartling commented 3 years ago

Could we ever run a simple demand response test with this on real HVAC equipment? The company I work for is looking to demonstrate an open ADR test for research purposes.

Probably conduct a few tests where we are studying the DR effects on the building systems, IAQ, and power metering, etc..

bbartling commented 3 years ago

well maybe ill stick with my Heroku version for some simple open ADR tests to this VOLTTRON VEN we are testing out, thanks for all help.

The dashboard looks real nice Stan, this would be a Python web package right? If the dashboard is utilizing the openLeadr package under the hood which is also a Python package...