diff --git a/addressManager.py b/addressManager.py index d673756..28a2a36 100644 --- a/addressManager.py +++ b/addressManager.py @@ -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] diff --git a/doc/installation_on_raspberry.md b/doc/installation_on_raspberry.md index 841bcd3..b4d649a 100644 --- a/doc/installation_on_raspberry.md +++ b/doc/installation_on_raspberry.md @@ -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` diff --git a/doc/pyPlc.ini.template b/doc/pyPlc.ini.template index 7630da9..cd947f8 100644 --- a/doc/pyPlc.ini.template +++ b/doc/pyPlc.ini.template @@ -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 diff --git a/pyPlcHomeplug.py b/pyPlcHomeplug.py index 4b4cd93..ed3c382 100644 --- a/pyPlcHomeplug.py +++ b/pyPlcHomeplug.py @@ -710,12 +710,14 @@ 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): - self.addToTrace("SECC MAC is " + self.getSourceMacAddressAsString()) - strDateTime=datetime.today().strftime('%Y-%m-%dT%H:%M:%S.%f') - MacLogFile = open('MacLog.txt', 'a') - MacLogFile.write(strDateTime + " SECC MAC " + self.getSourceMacAddressAsString() + "\n") # write the MAC to the MacLogFile - MacLogFile.close() + 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') + MacLogFile.write(strDateTime + " SECC MAC " + self.getSourceMacAddressAsString() + "\n") # write the MAC to the MacLogFile + MacLogFile.close() def evaluateMnbcSoundInd(self): # We received MNBC_SOUND.IND from the PEV. Normally this happens 10times, with a countdown (remaining number of sounds)