Skip to content

Commit

Permalink
Merge pull request #209 from Sevenstax/port-mirror-cmd-option
Browse files Browse the repository at this point in the history
Add option for enabling/disabling port mirror via command line argument
  • Loading branch information
jpo-stx authored Aug 2, 2023
2 parents 5718f0d + d96d098 commit e1295a2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Application.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
parser.add_argument('-m', '--mac', type=str, help='This is the MAC address of the ethernet interface of the Whitebeet (i.e. "{}").'.format(WHITEBBET_DEFAULT_MAC))
parser.add_argument('-r', '--role', type=str, choices=('EVSE', 'EV'), required=True, help='This is the role of the Whitebeet. "EV" for EV mode and "EVSE" for EVSE mode')
parser.add_argument('-c', '--config', type=str, help='Path to configuration file. Defaults to ./ev.json.\nA MAC present in the config file will override a MAC provided with -m argument.', nargs='?', const="./ev.json")
parser.add_argument('-p', '--portmirror', help='Enables port mirror.', action='store_true')
args = parser.parse_args()

# If no MAC address was given set it to the default MAC address of the Whitebeet
Expand Down Expand Up @@ -43,7 +44,7 @@
ev.load(config)

# Start the EVSE loop
ev.whitebeet.networkConfigSetPortMirrorState(1)
ev.whitebeet.networkConfigSetPortMirrorState(args.portmirror)
ev.loop()
print("EV loop finished")

Expand Down Expand Up @@ -90,6 +91,7 @@
evse.setSchedule(schedule)

# Start the EVSE loop
evse.whitebeet.networkConfigSetPortMirrorState(args.portmirror)
evse.loop()
print("EVSE loop finished")

Expand Down

0 comments on commit e1295a2

Please sign in to comment.