mirror of
https://github.com/uhi22/pyPLC.git
synced 2024-11-20 01:13:58 +00:00
feature: exit if connectionLevel decreases from full. Raspberry docu improved.
This commit is contained in:
parent
2565435d09
commit
1b5af0d2e2
4 changed files with 32 additions and 7 deletions
11
connMgr.py
11
connMgr.py
|
@ -13,6 +13,9 @@
|
|||
# the lower-layer state machine can stay silent as long as the upper layers are working
|
||||
# fine.
|
||||
|
||||
from configmodule import getConfigValue, getConfigValueBool
|
||||
import sys # For exit_on_session_end hack
|
||||
|
||||
CONNLEVEL_100_APPL_RUNNING = 100
|
||||
CONNLEVEL_80_TCP_RUNNING = 80
|
||||
CONNLEVEL_50_SDP_DONE = 50
|
||||
|
@ -98,6 +101,14 @@ class connMgr():
|
|||
self.ConnectionLevel=0
|
||||
if (self.ConnectionLevelOld!=self.ConnectionLevel):
|
||||
self.addToTrace("[CONNMGR] ConnectionLevel changed from " + str(self.ConnectionLevelOld) + " to " + str(self.ConnectionLevel))
|
||||
if ((self.ConnectionLevelOld==100) and (self.ConnectionLevel<100)):
|
||||
# We had a charging session, and now it is gone.
|
||||
# Depending on configuration option, we may end the script here.
|
||||
if getConfigValueBool("exit_on_session_end"):
|
||||
# TODO: This is a hack. Do this in fsmPev instead?
|
||||
self.addToTrace("[CONNMGR] Terminating the application.")
|
||||
sys.exit(0)
|
||||
|
||||
self.ConnectionLevelOld = self.ConnectionLevel
|
||||
if ((self.cycles % 33)==0):
|
||||
# once per second
|
||||
|
|
|
@ -83,6 +83,15 @@ Try-out the cooperation of Python with the EXI encoder/decoder:
|
|||
```
|
||||
This should run some decoder/encoder tests and report in the end "Number of fails: 0".
|
||||
|
||||
Copy the pyPlc.ini.template into the same directory where pyPlc.py is, and rename it to pyPlc.ini. Edit the settings in this file as you need.
|
||||
|
||||
Make some files executable:
|
||||
```
|
||||
chmod 744 c55*
|
||||
chmod 744 pevNoGui.py
|
||||
chmod 744 starter.sh
|
||||
```
|
||||
|
||||
As first test, use the simulation mode (no need for modems or other hardware).
|
||||
Start the EVSE in simulation mode `sudo python pyPlc.py E S`.
|
||||
Open a second console window, and start here the pev in simulation mode
|
||||
|
@ -111,8 +120,8 @@ In this file, we write the following, to configure the new service:
|
|||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/home/pi/myprogs/pyPlc/starter.sh
|
||||
Restart=on-abort
|
||||
ExecStart=/home/pi/myprogs/pyPLC/starter.sh
|
||||
Restart=always
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
|
|
@ -66,8 +66,11 @@ u_delta_max_for_end_of_precharge = 10
|
|||
# The serial port and baud rate used for communication. Used
|
||||
# for serial devices like Dieter, OLED-Display and
|
||||
# celeron55's measuring and switching device
|
||||
serial_port = /dev/ttyS1
|
||||
serial_baud = 115200
|
||||
# Examples:
|
||||
# /dev/ttyS1
|
||||
# auto
|
||||
serial_port = auto
|
||||
serial_baud = 19200
|
||||
|
||||
# The target voltage used in the CurrentDemandRequest.
|
||||
# This is a value for first try-outs. Better would
|
||||
|
|
|
@ -29,13 +29,15 @@ set -euv
|
|||
|
||||
# Keep all IPv6 addresses on the interface down event.
|
||||
# Todo: flexible interface name.
|
||||
# Todo: On raspberry, without NetworkManager, this option does not help. After the down and up (see below), the IPv6 is missing.
|
||||
sysctl net.ipv6.conf.eth0.keep_addr_on_down=1
|
||||
|
||||
# Shut down and activate the interface.
|
||||
# Todo: Why this needed?
|
||||
ip link set eth0 down
|
||||
# Todo: Why this needed? On raspberry, where the NetworkManager is not runnning, this disturbs, because
|
||||
# afterwards the pyPlc does not see the interfaces IPv6 address.
|
||||
# ip link set eth0 down
|
||||
sleep 1
|
||||
ip link set eth0 up
|
||||
# ip link set eth0 up
|
||||
sleep 1
|
||||
|
||||
# show the addresses
|
||||
|
|
Loading…
Reference in a new issue