Skip to content

Commit

Permalink
Fetch correct existing value for PulseTime command
Browse files Browse the repository at this point in the history
  • Loading branch information
anti-social authored Sep 22, 2023
1 parent 1901bd4 commit 0d1c645
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions action_plugins/tasmota.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""))

Expand Down Expand Up @@ -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

0 comments on commit 0d1c645

Please sign in to comment.