From 4ee708121de642e4fab86895907eacd12f45b5b6 Mon Sep 17 00:00:00 2001 From: egguy Date: Mon, 22 Jul 2024 22:26:20 +1000 Subject: [PATCH] Add check to prevent crashing grott on unknown layout - Added a check to prevent a crash - Add a debug statement related to the chck --- grottdata.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/grottdata.py b/grottdata.py index 0ea1872..cdc93ba 100644 --- a/grottdata.py +++ b/grottdata.py @@ -198,15 +198,19 @@ def procdata(conf,data): # Update the conf.layout like done earlier conf.layout = layout + layout_exists = layout in conf.recorddict + if conf.verbose: print("\t - " + 'Growatt new layout processing') print("\t\t - " + "decrypt : ",conf.decrypt) print("\t\t - " + "offset : ", conf.offset) print("\t\t - " + "record layout : ", layout) + print("\t\t - " + "layout exists : ", layout_exists) print() - - + if not layout_exists: + return # No valid layout found, no further processing + try: #v270 try if logstart and log fields are defined, if yes prepare log fields logstart = conf.recorddict[layout]["logstart"]["value"]