Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Formatting regexp in a condition of an automation

$
0
0

@CodeFinder wrote:

Hi all,

I have the following automation:

- alias: Disable Pi-Hole
  trigger:
    platform: state
    entity_id: input_select.pihole_time
  condition: # valid if in the format 'HH:MM:SS'
    - condition: template
      value_template: "{{ states('input_select.pihole_time')|regex_match('^(?:(?:([01]?\d|2[0-3]):)?([0-5]?\d):)?([0-5]?\d)$', ignorecase=FALSE) }}"
  action:
    service: pi_hole.disable
    data_template:
      duration: "{{ states('input_select.pihole_time') }}"

but I am getting the errors:

Error loading /config/configuration.yaml: while scanning a double-quoted scalar
  in "/config/automations.yaml", line 298, column 23
found unknown escape character 'd'
  in "/config/automations.yaml", line 298, column 92

Line 298 is the line with the regular expression. What’s wrong here? :see_no_evil: Please note that the expression works correctly in the template editor. Also tried double quotes with no luck. :confused:

Thanks!

Posts: 3

Participants: 3

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>