Skip to content

Commit

Permalink
fiff
Browse files Browse the repository at this point in the history
  • Loading branch information
fredriklj committed Jun 27, 2024
1 parent 81fedd9 commit ec8214a
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions examples/wsmock.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

HOST = "127.0.0.1"
PORT = 8080
DEFAULT_PIN = "123456"
DEFAULT_PIN = "12345678"
RECEIVE_TIMEOUT = 1


Expand Down Expand Up @@ -40,21 +40,21 @@ async def send_status(self, ws) -> None:
async def send_settings(self, ws) -> str:
"""Send chargepoint settings"""
settings = [
"preamble = 101",
"connectorOneEnable",
"cableLockOne",
"rfidLockOne",
"currentOne * 10",
"4",
"connectorTwoEnable",
"cableLockTwo",
"rfidLockTwo",
"currentTwo * 10",
"4",
"dimmer",
"101", # preamble
"1", # connector one enable
"1", # connector one cable lock
"0", # connector one rfid lock
"120", # connector one max current (A*10)
"4", # delimiter?
"0", # connector two enable
"1", # connector two cable lock
"0", # connector two rfid lock
"160", # connector two max current (A*10)
"4", # delimiter?
"64", # dimmer (0-255)
]
settings_str = ",".join(settings)
await ws.send_str(f"104,[{settings_str}]")
await ws.send_str(f"{settings_str}")


async def websocket_handler(request):
Expand All @@ -80,7 +80,9 @@ async def websocket_handler(request):
chargepoint.connected = True
else:
print("Invalid PIN")
elif re.match(r"^\?,104$", msg.data):
elif re.match(r"^\?,6$", msg.data):
print("Request to get periodic status updates")
elif re.match(r"^\?,101$", msg.data):
print("Get settings")
await chargepoint.send_settings(ws)
elif msg.data == "close":
Expand Down

0 comments on commit ec8214a

Please sign in to comment.