Skip to content

Commit

Permalink
Allow any whitspace character when calculating trigger_delta.
Browse files Browse the repository at this point in the history
  • Loading branch information
nomike committed Feb 3, 2024
1 parent b0b729d commit 63ddfcf
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,7 @@ action:
{{ trigger.event.data.command }}
{%- endif -%}
# helper_last_controller_event example: {"a":"on_press_release","t":1706926380.358825}
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\": *\".*\"|\"t\": *\d+\.\d+)(, *)?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
trigger_delta: '{{ (as_timestamp(now()) - ((states(helper_last_controller_event) | from_json).t if helper_last_controller_event is not none and (states(helper_last_controller_event) | regex_match("^\{((\"a\":\s*\".*\"|\"t\":\s*\d+\.\d+)(,\s*)?){2}\}$")) else as_timestamp("1970-01-01 00:00:00"))) * 1000 }}'
# update helper
- service: input_text.set_value
data:
Expand Down

0 comments on commit 63ddfcf

Please sign in to comment.