Made a weird mistake with Last_triggered so had to back it out. There has to be a better way but for now, this is fine.

This commit is contained in:
ccostan 2020-09-27 14:09:45 -04:00
parent 1aeca5d7f3
commit 30001f1e47
3 changed files with 39 additions and 62 deletions

View File

@ -52,18 +52,13 @@ automation:
for: for:
minutes: 5 minutes: 5
- condition: numeric_state - condition: template
entity_id: automation.juicebox_selfheal value_template: >
attribute: last_triggered {%- if states.automation.juicebox_selfheal.attributes.last_triggered -%}
above: 10000 {{ (as_timestamp(now()) - as_timestamp(states.automation.juicebox_selfheal.attributes.last_triggered)) > 10000 }}
{%- else -%}
# - condition: template true
# value_template: > {%- endif -%}
# {%- if states.automation.juicebox_selfheal.attributes.last_triggered -%}
# {{ (as_timestamp(now()) - as_timestamp(states.automation.juicebox_selfheal.attributes.last_triggered)) > 10000 }}
# {%- else -%}
# true
# {%- endif -%}
action: action:
- service: homeassistant.turn_on - service: homeassistant.turn_on

View File

@ -23,21 +23,13 @@ automation:
attribute: battery_level attribute: battery_level
below: 20 below: 20
- condition: numeric_state - condition: template
entity_id: automation.vacuum_tweet value_template: >
attribute: last_triggered {%- if states.automation.vacuum_tweet.attributes.last_triggered -%}
above: 15000 {{ (as_timestamp(now()) - as_timestamp(states.automation.vacuum_tweet.attributes.last_triggered)) > 15000 }}
{%- else -%}
# - condition: template true
# value_template: "{{ states.vacuum.carlo_neato.attributes.battery_level |int < 20 }}" {%- endif -%}
# - condition: template
# value_template: >
# {%- if states.automation.vacuum_tweet.attributes.last_triggered -%}
# {{ (as_timestamp(now()) - as_timestamp(states.automation.vacuum_tweet.attributes.last_triggered)) > 15000 }}
# {%- else -%}
# true
# {%- endif -%}
action: action:
- service: script.tweet_engine_image - service: script.tweet_engine_image

View File

@ -203,19 +203,16 @@ automation:
- platform: time_pattern - platform: time_pattern
hours: '/2' hours: '/2'
minutes: 45 minutes: 45
condition:
- condition: numeric_state
entity_id: automation.random_house_stats
attribute: last_triggered
above: 10000
# - condition: template condition:
# value_template: > - condition: template
# {%- if states.automation.random_house_stats.attributes.last_triggered -%} value_template: >
# {{ (as_timestamp(now()) - as_timestamp(states.automation.random_house_stats.attributes.last_triggered)) > 10000 }} {%- if states.automation.random_house_stats.attributes.last_triggered -%}
# {%- else -%} {{ (as_timestamp(now()) - as_timestamp(states.automation.random_house_stats.attributes.last_triggered)) > 10000 }}
# true {%- else -%}
# {%- endif -%} true
{%- endif -%}
action: action:
- delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}' - delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}'
- service: script.tweet_engine_random - service: script.tweet_engine_random
@ -243,19 +240,16 @@ automation:
- platform: time_pattern - platform: time_pattern
hours: '/7' hours: '/7'
minutes: 18 minutes: 18
condition:
- condition: numeric_state
entity_id: automation.random_youtube_videos_bearstone
attribute: last_triggered
above: 10000
# - condition: template condition:
# value_template: > - condition: template
# {%- if states.automation.random_youtube_videos_bearstone.attributes.last_triggered -%} value_template: >
# {{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_bearstone.attributes.last_triggered)) > 10000 }} {%- if states.automation.random_youtube_videos_bearstone.attributes.last_triggered -%}
# {%- else -%} {{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_bearstone.attributes.last_triggered)) > 10000 }}
# true {%- else -%}
# {%- endif -%} true
{%- endif -%}
action: action:
- delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}' - delay: '0{{ range(0,2) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}:{{ range(0,5) | random | int }}{{ range(0,9) | random | int }}'
- service: script.tweet_youtube_engine_setup - service: script.tweet_youtube_engine_setup
@ -272,18 +266,14 @@ automation:
minutes: 45 minutes: 45
condition: condition:
- condition: numeric_state - condition: template
entity_id: automation.random_youtube_videos_ccostan value_template: >
attribute: last_triggered {%- if states.automation.random_youtube_videos_ccostan.attributes.last_triggered -%}
above: 10000 {{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_ccostan.attributes.last_triggered)) > 10000 }}
{%- else -%}
true
{%- endif -%}
# - condition: template
# value_template: >
# {%- if states.automation.random_youtube_videos_ccostan.attributes.last_triggered -%}
# {{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_ccostan.attributes.last_triggered)) > 10000 }}
# {%- else -%}
# true
# {%- endif -%}
action: action:
- service: script.tweet_youtube_engine_setup - service: script.tweet_youtube_engine_setup
data: data: