gitibeyonde / openevse-ocpp

[WIP] OCPP 1.5J Implementation for OpenEVSE
4 stars 2 forks source link

Unable to keep initial connection open #1

Closed kernelkraut closed 5 years ago

kernelkraut commented 5 years ago

I'm unable to keep the initial connection open by running ocpp.py. I can execute and the websocket appears to connect but it looks like the second request is returning "Connection is already closed"

pi@ocppclient:/opt/evdevice/ocpp $ --- request header --- DEBUG:websocket:--- request header --- GET /steve/websocket/CentralSystemService/322d2db2 HTTP/1.1 Upgrade: websocket Connection: Upgrade Host: RemovedServerName:8443 Origin: http://***RemovedServerName***:8443 Sec-WebSocket-Key: Ke1LqPp6JvwJfbJ22U8Dow== Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: ocpp1.5

DEBUG:websocket:GET /steve/websocket/CentralSystemService/322d2db2 HTTP/1.1 Upgrade: websocket Connection: Upgrade Host: RemovedServerName:8443 Origin: http://***RemovedServerName***:8443 Sec-WebSocket-Key: Ke1LqPp6JvwJfbJ22U8Dow== Sec-WebSocket-Version: 13 Sec-WebSocket-Protocol: ocpp1.5


DEBUG:websocket:----------------------- --- response header --- DEBUG:websocket:--- response header --- INFO:root:on_error: Error received Connection is already closed. INFO:root:onclose: ### closed**

kernelkraut commented 5 years ago

Ok figured out the issue - We are using 8443 on https (with a certificate). I had to change the ocpp.py: (Had to change ws to wss @ ws = websocket.WebSocketApp under the main method)

try:
    uuid = utils.getUuid()
    conf = datastore.Datastore()
    client_cmd = client_call.ClientCall(conf)
    registry = request_registry.RequestRegistry()

    websocket.enableTrace(True)
    ws = websocket.WebSocketApp("wss://" + SIP + "/steve/websocket/CentralSystemService/" + uuid,
                                on_message=on_message,
                                on_error=on_error,
                                on_close=on_close,
                                header=[ "Sec-WebSocket-Protocol: ocpp1.5"])

image

gitibeyonde commented 5 years ago

If this can be made configurable, even better.

On 07-Aug-2019, at 11:53 AM, kernelkraut notifications@github.com wrote:

Ok figured out the issue - We are using 8443 on https (with a certificate). I had to change the ocpp.py: (Had to change ws to wss @ ws = websocket.WebSocketApp under the main method)

def main(): global uuid global client_cmd global conf global registry global resp global server_cmd global ws

try: uuid = utils.getUuid() conf = datastore.Datastore() client_cmd = client_call.ClientCall(conf) registry = request_registry.RequestRegistry()

websocket.enableTrace(True)
ws = websocket.WebSocketApp("wss://" + SIP + "/steve/websocket/CentralSystemService/" + uuid,
                            on_message=on_message,
                            on_error=on_error,
                            on_close=on_close,
                            header=[ "Sec-WebSocket-Protocol: ocpp1.5"])

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/gitibeyonde/openevse-ocpp/issues/1?email_source=notifications&email_token=AE2QF3G4OMR67XWPPHSNTUDQDJS5VA5CNFSM4IJ4OIC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3XKX3Y#issuecomment-518958063, or mute the thread https://github.com/notifications/unsubscribe-auth/AE2QF3C5FAV6Z2SZ4NHDQBDQDJS5VANCNFSM4IJ4OICQ.

kernelkraut commented 5 years ago

If this can be made configurable, even better.

I've added some new pull requests for a new SSL variable and added you for review.

image

kernelkraut commented 5 years ago

Closing off issue - Added SSL variable in system.properties.