handle protokoll parse errors - systemd unit
This commit is contained in:
parent
f1ebe71079
commit
97a0376370
14
dashboard_client.service
Normal file
14
dashboard_client.service
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
[Unit]
|
||||||
|
Description=PyLokid Dashboard Client
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
User=pi
|
||||||
|
Restart=always
|
||||||
|
Environment="MQTT_SERVER=mybroker.example.com"
|
||||||
|
Environment="MQTT_USER=myuser"
|
||||||
|
Environment="MQTT_PASSWORD=mypassword"
|
||||||
|
ExecStart=/usr/bin/python3 /opt/dashboard_client.py
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -68,14 +68,19 @@ class Lodur:
|
||||||
|
|
||||||
# when PDF parsing fails, pdf_data is false. fill with tbd when this happens
|
# when PDF parsing fails, pdf_data is false. fill with tbd when this happens
|
||||||
if pdf_data:
|
if pdf_data:
|
||||||
zh_fw_ausg = datetime.strptime(
|
try:
|
||||||
pdf_data['ausgerueckt'],
|
zh_fw_ausg = datetime.strptime(
|
||||||
'%H:%M',
|
pdf_data['ausgerueckt'],
|
||||||
)
|
'%H:%M',
|
||||||
zh_am_schad = datetime.strptime(
|
)
|
||||||
pdf_data['anort'],
|
zh_am_schad = datetime.strptime(
|
||||||
'%H:%M',
|
pdf_data['anort'],
|
||||||
)
|
'%H:%M',
|
||||||
|
)
|
||||||
|
except ValueError as err:
|
||||||
|
self.logger.error('[%s] Date parsing failed: %s', f_id, err)
|
||||||
|
zh_fw_ausg = datetime.now()
|
||||||
|
zh_am_schad = datetime.now()
|
||||||
else:
|
else:
|
||||||
# Do nothing when no PDF data - we don't have anything to do then
|
# Do nothing when no PDF data - we don't have anything to do then
|
||||||
self.logger.error('[%s] No PDF data found - filling in dummy data', f_id)
|
self.logger.error('[%s] No PDF data found - filling in dummy data', f_id)
|
||||||
|
|
Loading…
Reference in a new issue