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

How can you use an input_number with a time_pattern trigger?

$
0
0

@Grant_Spence wrote:

Hello,

I can’t seem to figure out how to utilize an input_number with a time_pattern trigger in my automation.yaml.

Here’s my current yaml:

- alias: Alarm if grey water is fatal
  trigger:
    platform: time_pattern
    seconds: '/60'
  condition:
    - condition: template
      value_template: "{{ states('sensor.grey_water') > states('input_number.grey_water_fatal_level') }}"
  action:
    - service: media_player.play_media
      data:
        entity_id: all
        media_content_id: 'http://192.168.1.2:8123/local/sounds/grey-tank-level-fatal.mp3'
        media_content_type: 'music'

I would like the seconds configurable, but I do understand how I can put the value as a template. I tried:

- alias: Alarm if grey water is fatal
  trigger:
    platform: time_pattern
    seconds: "/{{ states('input_number.alarm_frequency') }}"
  condition:
    - condition: template
      value_template: "{{ states('sensor.grey_water') > states('input_number.grey_water_fatal_level') }}"
  action:
    - service: media_player.play_media
      data:
        entity_id: all
        media_content_id: 'http://192.168.1.2:8123/local/sounds/grey-tank-level-fatal.mp3'
        media_content_type: 'music'

However, I get a ValueError: invalid literal for int() with base 10 when I try to use this automation. Any help is appreciated.

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 99145

Trending Articles



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