added device name as configuration
This commit is contained in:
2
.env.example
Normal file
2
.env.example
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
NTFY_Token=
|
||||||
|
device_name=
|
||||||
3
main.py
3
main.py
@@ -6,9 +6,10 @@ from dotenv import load_dotenv
|
|||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|
||||||
ntfy_token = os.environ['NTFY_Token']
|
ntfy_token = os.environ['NTFY_Token']
|
||||||
|
device_name = os.environ['device_name']
|
||||||
shutdown_timer = 10
|
shutdown_timer = 10
|
||||||
|
|
||||||
with serial.Serial('COM10', 115200, timeout=1) as ser:
|
with serial.Serial(device_name, 115200, timeout=1) as ser:
|
||||||
inverter_offline_counter = 0
|
inverter_offline_counter = 0
|
||||||
while True:
|
while True:
|
||||||
if ser.readline().decode().strip() == "0":
|
if ser.readline().decode().strip() == "0":
|
||||||
|
|||||||
Reference in New Issue
Block a user