From f18e47334e963f5b7a7e2737f96a868a909f9a0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marco=20Schotth=C3=B6fer?= Date: Sat, 11 Jul 2020 16:39:07 +0200 Subject: [PATCH] Instantiate FHEM object only in case of valid typ --- plugins/fhemCmd/fhemCmd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/fhemCmd/fhemCmd.py b/plugins/fhemCmd/fhemCmd.py index 567f418..2658e2e 100644 --- a/plugins/fhemCmd/fhemCmd.py +++ b/plugins/fhemCmd/fhemCmd.py @@ -89,8 +89,6 @@ def run(typ,freq,data): logging.debug("password: %s", password) ########## User Plugin CODE ########## - fh = fhem.Fhem(server=server, protocol=protocol, port=port, username=username, password=password) - if typ == "FMS": fhemCommand = globalVars.config.get("fhemCmd", "commandFMS") elif typ == "ZVEI": @@ -104,6 +102,8 @@ def run(typ,freq,data): fhemCommand = wildcardHandler.replaceWildcards(fhemCommand, data) logging.debug("fhemCommand: %s", fhemCommand) + fh = fhem.Fhem(server=server, protocol=protocol, port=port, username=username, password=password) + fh.send_cmd(fhemCommand) del fh ########## User Plugin CODE ##########