Skip to content

Commit

Permalink
add logging to daemoon
Browse files Browse the repository at this point in the history
  • Loading branch information
jblance committed Jan 21, 2023
1 parent 41c14f9 commit 7f62e1d
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion mppsolar/libs/daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ def __init__(self, *args, **kwargs):

if self.type == "systemd":
try:
from cysystemd.daemon import Notification, notify
from cysystemd.daemon import Notification, notify, journal

self._notify = notify
self._journal = journal
self._Notification = Notification
except ModuleNotFoundError as e:
print(
Expand All @@ -45,6 +46,7 @@ def __init__(self, *args, **kwargs):
exit(1)
else:
self._notify = self._dummyNotify
self._journal = self._dummyNotify
self._Notification = dummyNotification

def initialize(self, *args, **kwargs):
Expand All @@ -61,6 +63,7 @@ def notify(self, *args, **kwargs):
status = "OK"
self._notify(self._Notification.STATUS, status)
self._lastNotify = time()
self._journal(f"Daemon notify at {self._lastNotify}")

def stop(self, *args, **kwargs):
# Send stopping
Expand Down
2 changes: 1 addition & 1 deletion mppsolar/protocols/pi30max.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
"AGM",
"Flooded",
"User",
"TBD",
"Pylontech",
"Shinheung",
"WECO",
"Soltaro",
"LIb-protocol compatible",
Expand Down
2 changes: 1 addition & 1 deletion mppsolar/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.15.12"
__version__ = "0.15.13"
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mppsolar"
version = "0.15.12"
version = "0.15.13"
description = "Package to communicate with Solar inverters and BMSs"
authors = ["John Blance"]

Expand Down

0 comments on commit 7f62e1d

Please sign in to comment.