configurable MAC logging and configurable ignoring missing modem. Docu preparation for GPS logging

This commit is contained in:
uhi22 2024-06-05 18:36:56 +02:00
parent 195c4868b0
commit 916a9b7891
4 changed files with 44 additions and 10 deletions

View file

@ -122,10 +122,12 @@ class addressManager():
if (len(self.localIpv6Addresses)==0):
print("[addressManager] Error: No local Ipv6 address was found.")
self.localIpv6Address = "localhost"
cfg_exitIfNoLocalLinkAddressIsFound = 1
cfg_exitIfNoLocalLinkAddressIsFound = getConfigValueBool("exit_if_no_local_link_address_is_found")
if (cfg_exitIfNoLocalLinkAddressIsFound!=0):
print("Exiting, because it does not make sense to continue without IPv6 address");
sys.exit(1);
print("Exiting, because it does not make sense to continue without IPv6 address")
sys.exit(1)
else:
print("Error: It does not make sense to continue without IPv6 address, but exit_if_no_local_link_address_is_found says you want to continue");
else:
# at least one address was found. Take the first one (this may be the wrong adaptor).
self.localIpv6Address = self.localIpv6Addresses[0]

View file

@ -241,3 +241,23 @@ https://strobelstefan.org/2019/10/16/zugriff-via-ssh-ohne-passworteingabe-anmeld
- in connection->SSH->Auth, browse to the private key generated above.
- in session, give a name for the session, and click "safe" to store the connection settings
- next time, the connection to the pi works just by clicking the saved session.
## Optional: MAC logging with GPS coordinates
0. connect GPS module to the raspberry. This needs only 3 wires: 3V3, GND, RXD. The TXD of the module needs to be connected to the RXD of the raspberry. https://tutorials-raspberrypi.de/raspberry-pi-gps-ortung-navigation/
1. `sudo apt-get install minicom gpsd gpsd-clients`
2. in the raspberry pi config, enable the serial port and disable the serial console
3. reboot
4. `ls -ltr /dev/ser* # should show all serial devices`
5. `cat /dev/serial0` Get the the raw NMEA data from the serial line and shows it. Processing of them works also without the daemon.
6. configure the gsd: `nano /etc/default/gpsd`
```
USBAUTO=“false“
DEVICES=“/dev/serial0″
GPSD_OPTIONS=“-n“
```
start the GPS daemon: `sudo service gpsd start`
Now this works: `cgps -s`

View file

@ -103,6 +103,16 @@ charge_target_voltage = 270
# Deeper explanations here: https://github.com/uhi22/pyPLC/blob/master/doc/installation_on_raspberry.md#further-optimizations
exit_on_session_end = False
# If pyPLC does not find a local link address, this means there is no
# ethernet connection to the homeplug modem. This is a severe hardware
# error, so pyPLC will terminate. However, for special testing purposes this can
# be set to False. In this case, pyPLC will continue to run, even if there is no modem connected.
exit_if_no_local_link_address_is_found = True
# pyPLC in PevMode or ListenMode can detect the MAC address of the charger (SECC MAC) and
# write it, together with the time stamp, into the file MacLog.txt
log_the_evse_mac_to_file = True
# Run test cases.
# Explanation in doc/testing_and_simulation.md
# Possible values:
@ -125,7 +135,7 @@ udp_syslog_enable = Yes
# Limitations/explanations here: https://openinverter.org/forum/viewtopic.php?p=57894#p57894 and
# https://openinverter.org/forum/viewtopic.php?t=1063 (Is it possible to make a CCS to CHAdeMO adapter?)
# none: all other use cases
charge_parameter_backend = chademo
charge_parameter_backend = none
# REST callback for SoC states. Comment out to disable. Do not leave a trailing slash
# This parameter is used in EvseMode, to configure where the data which is retrieved

View file

@ -710,7 +710,9 @@ class pyPlcHomeplug():
if (self.pevSequenceState==STATE_WAITING_FOR_SLAC_PARAM_CNF): # we were waiting for the SlacParamCnf
self.pevSequenceDelayCycles = 4 # original Ioniq is waiting 200ms
self.enterState(STATE_SLAC_PARAM_CNF_RECEIVED) # enter next state. Will be handled in the cyclic runPevSequencer
if (self.iAmListener==1):
if ((self.iAmListener==1) or (self.iAmPev==1)):
if getConfigValueBool("log_the_evse_mac_to_file"):
# Write the MAC address of the charger to a log file
self.addToTrace("SECC MAC is " + self.getSourceMacAddressAsString())
strDateTime=datetime.today().strftime('%Y-%m-%dT%H:%M:%S.%f')
MacLogFile = open('MacLog.txt', 'a')