-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsecc-main-chargebyte-ea-psb.py
52 lines (42 loc) · 1.61 KB
/
secc-main-chargebyte-ea-psb.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import sys
import asyncio
import os
import logging
from iso15118.secc import SECCHandler
from iso15118.secc.secc_settings import Config
from iso15118.secc.controller.interface import ServiceStatus
from iso15118.shared.exificient_exi_codec import ExificientEXICodec
sys.path.append("../")
from chargebyte.chargebyte_charging_station import ChargebyteChargingStation
from elektroautomatik.bidi_powersupply import ElektroAutomatikBidiPowersupply
from iso15118impls.evse_controller import EVSEControllerImpl
from mocks.charging_station import MockChargingStation
from mocks.high_voltage_source import MockHighVoltageSource
async def main():
"""
Entrypoint function that starts the ISO 15118 code running on
the SECC (Supply Equipment Communication Controller)
"""
charged = os.environ.get("CHARGED")
psu = MockHighVoltageSource()
low_level = MockChargingStation()
if charged == "charging_station":
psu = ElektroAutomatikBidiPowersupply("192.168.188.100", 5025, 3000)
elif charged == "vehicle":
low_level = ChargebyteChargingStation("192.168.188.250", 2020, True)
config = Config()
config.load_envs()
config.print_settings()
controller = EVSEControllerImpl(psu, low_level)
await controller.set_status(ServiceStatus.STARTING)
await SECCHandler(
exi_codec=ExificientEXICodec(),
evse_controller=controller,
config=config,
).start(config.iface)
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
logger = logging.getLogger(__name__)
logger.debug("SECC program terminated manually")