Skip to content
Snippets Groups Projects
Commit b544b72b authored by Lukas Friedrichsen's avatar Lukas Friedrichsen
Browse files

severeal improvements

parent e6428c57
Branches
No related tags found
No related merge requests found
Showing
with 26 additions and 30 deletions
...@@ -629,6 +629,6 @@ client.mqtt_node_client_init(remote_ip=_IP_ADDR_REMOTE, port=_MQTT_PORT, topic=_ ...@@ -629,6 +629,6 @@ client.mqtt_node_client_init(remote_ip=_IP_ADDR_REMOTE, port=_MQTT_PORT, topic=_
# Initialize the Modbus RTU resp. M-Bus master depending on the operation mode # Initialize the Modbus RTU resp. M-Bus master depending on the operation mode
# and start the periodical readout of the defined devices # and start the periodical readout of the defined devices
if (_OP_MODE == 0): if (_OP_MODE == 0):
client.bus_init(port=_BUS_PORT, address=_BUS_ADDRESS, baudrate=_BAUDRATE, register=_MODBUS_REGISTER, register_count=_MODBUS_REGISTER_COUNT, timeout=_MODBUS_TIMEOUT, stopbits=_MODBUS_STOPBITS, bytesize=_MODBUS_BYTESIZE, parity=_MODBUS_PARITY, signed=_MODBUS_SIGNED, endianness=_MODBUS_ENDIANNESS, bit_significance=_MODBUS_BIT_SIGNIFICANCE) client.bus_init(port=_BUS_PORT, address=_BUS_ADDRESS, baudrate=_BAUDRATE, read_interval=_READ_INTERVAL, register=_MODBUS_REGISTER, register_count=_MODBUS_REGISTER_COUNT, timeout=_MODBUS_TIMEOUT, stopbits=_MODBUS_STOPBITS, bytesize=_MODBUS_BYTESIZE, parity=_MODBUS_PARITY, signed=_MODBUS_SIGNED, endianness=_MODBUS_ENDIANNESS, bit_significance=_MODBUS_BIT_SIGNIFICANCE)
elif (_OP_MODE == 1): elif (_OP_MODE == 1):
client.bus_init(port=_BUS_PORT, address=_BUS_ADDRESS, baudrate=_BAUDRATE) client.bus_init(port=_BUS_PORT, address=_BUS_ADDRESS, baudrate=_BAUDRATE, read_interval=_READ_INTERVAL)
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
# connect to a MQTT broker and log the data published on definable topics. # connect to a MQTT broker and log the data published on definable topics.
# Furthermore, it provides the functionality to act as an interface towards other, # Furthermore, it provides the functionality to act as an interface towards other,
# non-MQTT based applications like e.g. an OPC UA server by generating # non-MQTT based applications like e.g. an OPC UA server by generating
# data-exchange-files in the CSV format, containing the most current values # data-exchange-files, containing the most current values
# published on the subscribed topics at all times. # published on the subscribed topics at all times.
import paho.mqtt.client as mqtt import paho.mqtt.client as mqtt
...@@ -71,8 +71,8 @@ class MQTT_Server_Client(object): ...@@ -71,8 +71,8 @@ class MQTT_Server_Client(object):
Furthermore, it provides the functionality to act as an interface towards Furthermore, it provides the functionality to act as an interface towards
other, non-MQTT based applications like e.g. an OPC UA server by generating other, non-MQTT based applications like e.g. an OPC UA server by generating
data-exchange-files in the CSV format, containing the most current values data-exchange-files, containing the most current values published on the
published on the subscribed topics at all times. subscribed topics at all times.
''' '''
# Initialization method, that is called on the creation of every new client # Initialization method, that is called on the creation of every new client
...@@ -154,7 +154,7 @@ class MQTT_Server_Client(object): ...@@ -154,7 +154,7 @@ class MQTT_Server_Client(object):
# Exit the program # Exit the program
sys.exit() sys.exit()
else: else:
log_buffer+=(self.get_datetime()+' _on_disconnect_cb: Trying to reconnect!') log_buffer+=(self.get_datetime()+' _on_disconnect_cb: Trying to reconnect!\n')
# Write the buffer to the log (the usage of a buffer allows to minimalize # Write the buffer to the log (the usage of a buffer allows to minimalize
# file is opened (and therewith occupied) by the program, thus reducing # file is opened (and therewith occupied) by the program, thus reducing
...@@ -210,7 +210,7 @@ class MQTT_Server_Client(object): ...@@ -210,7 +210,7 @@ class MQTT_Server_Client(object):
# "If successful, the renaming will be an atomic operation (this is # "If successful, the renaming will be an atomic operation (this is
# a POSIX requirement)." # a POSIX requirement)."
try: try:
os.rename(self._exchange_dir+msg.topic+'.temp', self._exchange_dir+msg.topic) os.rename(_exchange_file+'.temp', _exchange_file)
except: except:
log_buffer+=(self.get_datetime()+'_on_message_cb: Error: '+str(sys.exc_info()[1])+'\n') log_buffer+=(self.get_datetime()+'_on_message_cb: Error: '+str(sys.exc_info()[1])+'\n')
......
#!/bin/bash #!/bin/bash
# Paths # Paths
LOG_PATH=/var/log/mqtt_node_client/mqtt_node_client.log LOG_PATH=/var/log/mqtt_node_client/mqtt_node_client.log
DB_PATH=/var/lib/mqtt_node_client/mqtt_node_client.db DB_PATH=/var/lib/mqtt_node_client/mqtt_node_client.db.csv
# Lines to keep # Lines to keep
LOG_LINES=1728 LOG_LINES=1728
......
#!/bin/bash #!/bin/bash
# Paths # Paths
LOG_PATH=/var/log/mqtt_server_client/mqtt_server_client.log LOG_PATH=/var/log/mqtt_server_client/mqtt_server_client.log
DB_PATH=/var/lib/mqtt_server_client/mqtt_server_client.db DB_PATH=/var/lib/mqtt_server_client/mqtt_server_client.db.csv
EX_PATH=/usr/local/var EX_PATH=/usr/local/var
# Lines to keep # Lines to keep
......
...@@ -122,18 +122,18 @@ ...@@ -122,18 +122,18 @@
#define PORTMAP_ENABLE_1 1 #define PORTMAP_ENABLE_1 1
#define PORTMAP_PROTO_1 6 #define PORTMAP_PROTO_1 6
#define PORTMAP_MPORT_1 22 #define PORTMAP_MPORT_1 8883
#define PORTMAP_DADDR_1 "192.168.13.3" #define PORTMAP_DADDR_1 "192.168.13.37"
#define PORTMAP_DPORT_1 22 #define PORTMAP_DPORT_1 8883
#define PORTMAP_DIR_1 1 #define PORTMAP_DIR_1 2
#define PORTMAP_ENABLE_2 1 #define PORTMAP_ENABLE_2 0
#define PORTMAP_PROTO_2 6 #define PORTMAP_PROTO_2 0
#define PORTMAP_MPORT_2 8883 #define PORTMAP_MPORT_2 0
#define PORTMAP_DADDR_2 "192.168.13.37" #define PORTMAP_DADDR_2 0
#define PORTMAP_DPORT_2 8883 #define PORTMAP_DPORT_2 0
#define PORTMAP_DIR_2 2 #define PORTMAP_DIR_2 0
#define PORTMAP_ENABLE_3 0 #define PORTMAP_ENABLE_3 0
......
...@@ -55,10 +55,8 @@ Bei Erwerb ist auf einem Raspberry Pi (im Folgenden auch \enquote{RPI} genannt) ...@@ -55,10 +55,8 @@ Bei Erwerb ist auf einem Raspberry Pi (im Folgenden auch \enquote{RPI} genannt)
Anschließend sollte das System aktualisiert und auf den neusten Stand gebracht werden. Dies geschieht mittels Anschließend sollte das System aktualisiert und auf den neusten Stand gebracht werden. Dies geschieht mittels
\begin{lstlisting}[caption=Aktualisierung des Systems] \begin{lstlisting}[caption=Aktualisierung des Systems]
network={
sudo apt-get update sudo apt-get update
sudo apt-get upgrade sudo apt-get upgrade
}
\end{lstlisting} \end{lstlisting}
Beim ersten Mal muss dieser Update-Prozess u.\,U.\ mehrfach durchgeführt werden, bis alle Systemdateien auf aktuellstem Stand sind\footnote{Dieser Prozess benötigt eine funktionsfähige Internetverbindung. Sollte dies zu diesem Zeitpunkt noch nicht gegeben sein, kann die Aktualisierung des Systems alternativ auch bis nach der Netzwerkkonfiguration (s.\,u.) verschoben werden. Sie sollte jedoch auf jeden Fall ausgeführt werden, bevor der Raspberry Pi endgültig in Betrieb genommen wird, um potentielle, inzwischen behobene Sicherheitslücken zu schließen.}. Beim ersten Mal muss dieser Update-Prozess u.\,U.\ mehrfach durchgeführt werden, bis alle Systemdateien auf aktuellstem Stand sind\footnote{Dieser Prozess benötigt eine funktionsfähige Internetverbindung. Sollte dies zu diesem Zeitpunkt noch nicht gegeben sein, kann die Aktualisierung des Systems alternativ auch bis nach der Netzwerkkonfiguration (s.\,u.) verschoben werden. Sie sollte jedoch auf jeden Fall ausgeführt werden, bevor der Raspberry Pi endgültig in Betrieb genommen wird, um potentielle, inzwischen behobene Sicherheitslücken zu schließen.}.
...@@ -67,9 +65,7 @@ Bei Erwerb ist auf einem Raspberry Pi (im Folgenden auch \enquote{RPI} genannt) ...@@ -67,9 +65,7 @@ Bei Erwerb ist auf einem Raspberry Pi (im Folgenden auch \enquote{RPI} genannt)
Eine weitere, jedoch optionale Sicherheitsmaßnahme stellt das Versehen der Ausführung von \lstinline{sudo} mit einem Passwort dar. Schließlich ist es unerwünscht, wenn jeder den RPI mit vollen Administratorberechtigungen bedienen kann, falls eine autorisierte Person vergessen sollte, sich abzumelden oder eine bestehende SSH-Verbindung zu schließen. Dies kann realisiert werden, indem der Inhalt der Datei \lstinline{/etc/sudoers.d/010_pi-nopasswd} wie folgt abgeändert wird: Eine weitere, jedoch optionale Sicherheitsmaßnahme stellt das Versehen der Ausführung von \lstinline{sudo} mit einem Passwort dar. Schließlich ist es unerwünscht, wenn jeder den RPI mit vollen Administratorberechtigungen bedienen kann, falls eine autorisierte Person vergessen sollte, sich abzumelden oder eine bestehende SSH-Verbindung zu schließen. Dies kann realisiert werden, indem der Inhalt der Datei \lstinline{/etc/sudoers.d/010_pi-nopasswd} wie folgt abgeändert wird:
\begin{lstlisting}[caption=Versehen von sudo mit einem Passwort] \begin{lstlisting}[caption=Versehen von sudo mit einem Passwort]
network={
pi ALL=(ALL) ALL: PASSWD pi ALL=(ALL) ALL: PASSWD
}
\end{lstlisting} \end{lstlisting}
Es sollte in Betracht gezogen werden, den Namen der Datei aus Gründen der Verständlichkeit zu \lstinline{010_pi-passwd} zu ändern. Es sollte in Betracht gezogen werden, den Namen der Datei aus Gründen der Verständlichkeit zu \lstinline{010_pi-passwd} zu ändern.
......
No preview for this file type
...@@ -111,7 +111,7 @@ Diverse (MIT License, GNU General Public License, GNU Lesser General Public Lice ...@@ -111,7 +111,7 @@ Diverse (MIT License, GNU General Public License, GNU Lesser General Public Lice
\item{ \item{
lwIP\\ lwIP\\
Modified BSD License\\ Modified BSD License\\
\item{https://savannah.nongnu.org/projects/lwip/} \url{https://savannah.nongnu.org/projects/lwip/}
} }
\end{itemize} \end{itemize}
......
doc/graphics/diagrams/architecture/architecture_abstract.png

53.6 KiB

doc/graphics/diagrams/architecture/architecture_components.png

70.6 KiB

doc/graphics/diagrams/architecture/architecture_node.png

45.7 KiB

doc/graphics/diagrams/architecture/architecture_router.png

60.9 KiB

doc/graphics/diagrams/architecture/architecture_server.png

67.5 KiB

doc/graphics/diagrams/architecture/architecture_technologies.png

66.2 KiB

File added
File added
File added
File added
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment