From 0d1c6453d092b96f4919e94266c672c7ba45d9cf Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 22 Sep 2023 14:36:52 +0300 Subject: [PATCH] Fetch correct existing value for PulseTime command --- action_plugins/tasmota.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/action_plugins/tasmota.py b/action_plugins/tasmota.py index f618416..ed3dc99 100644 --- a/action_plugins/tasmota.py +++ b/action_plugins/tasmota.py @@ -221,6 +221,8 @@ def our_entry(x): existing_value = "%s,%s" % (data[command]['Min'],data[command]['Max']) except Exception as e: raise AnsibleRuntimeError("Invalid response payload: %s, error: %s" % (data, e)) + elif command.startswith('PulseTime'): + existing_value = unicode(data[command]['Set']) display.v("[%s] command: %s,\n\t existing_value: '%s',\n\t incoming_value: '%s'" % (tasmota_host, command, existing_value, incoming_value if not no_log else "")) @@ -273,9 +275,9 @@ def _get_arg_or_var(self, name, default=None, is_required=True): return ret def _translateResultStr(self, translate, offValue = "0", onValue = "1"): - if (translate == "OFF"): - return offValue - if (translate == "ON"): - return onValue - return translate + if (translate == "OFF"): + return offValue + if (translate == "ON"): + return onValue + return translate