File tree 2 files changed +12
-4
lines changed
2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -5,12 +5,14 @@ SCRIPT_DIR="$(dirname "$(readlink -f "$0")")"
5
5
source " ${SCRIPT_DIR} " /.venv/bin/activate
6
6
cd " ${SCRIPT_DIR} " /source || exit 1
7
7
8
- read -r -d ' ' inverter_setup_code << 'EOF '
8
+ read -r -d ' ' inverter_setup_code << EOF
9
+ from logger import LoggerMixin
9
10
from goodwe.et import OperationMode
10
11
from inverter import Inverter
11
12
12
- inverter = Inverter()
13
- inverter.log.info("Inverter is manually controlled by a user")
13
+ LoggerMixin().log.info("Inverter is manually controlled by the user ${USER} ")
14
+
15
+ inverter = Inverter(True)
14
16
EOF
15
17
16
18
Original file line number Diff line number Diff line change 10
10
11
11
12
12
class Inverter (LoggerMixin ):
13
- def __init__ (self ):
13
+ def __init__ (self , controlled_by_bash_script : bool = False ):
14
14
super ().__init__ ()
15
15
16
16
self ._device = None
17
17
self .hostname = EnvironmentVariableGetter .get ("INVERTER_HOSTNAME" )
18
18
19
19
self .sems_portal_api_handler = SemsPortalApiHandler ()
20
+
21
+ # Add a notice to the loggers name to make to easier to identify actions taken by a user manually
22
+ if controlled_by_bash_script :
23
+ self .log .name += " USER"
24
+ self .sems_portal_api_handler .log .name += " USER"
25
+
20
26
self .battery_capacity = None
21
27
# We have to pull the battery capacity at startup since there are functions here that require it which are
22
28
# called when using the bash script to control the inverter manually
You can’t perform that action at this time.
0 commit comments