From 30001f1e4758cc531c578ea48c1f82057a6198b6 Mon Sep 17 00:00:00 2001 From: ccostan Date: Sun, 27 Sep 2020 14:09:45 -0400 Subject: [PATCH] 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. --- config/packages/juicenet.yaml | 19 ++++------- config/packages/neato.yaml | 22 ++++--------- config/packages/twitter.yaml | 60 +++++++++++++++-------------------- 3 files changed, 39 insertions(+), 62 deletions(-) diff --git a/config/packages/juicenet.yaml b/config/packages/juicenet.yaml index 0d691c73..07ca7123 100755 --- a/config/packages/juicenet.yaml +++ b/config/packages/juicenet.yaml @@ -52,18 +52,13 @@ automation: for: minutes: 5 - - condition: numeric_state - entity_id: automation.juicebox_selfheal - attribute: last_triggered - above: 10000 - - # - condition: template - # value_template: > - # {%- if states.automation.juicebox_selfheal.attributes.last_triggered -%} - # {{ (as_timestamp(now()) - as_timestamp(states.automation.juicebox_selfheal.attributes.last_triggered)) > 10000 }} - # {%- else -%} - # true - # {%- endif -%} + - condition: template + value_template: > + {%- 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: - service: homeassistant.turn_on diff --git a/config/packages/neato.yaml b/config/packages/neato.yaml index 36823d06..bd23417c 100755 --- a/config/packages/neato.yaml +++ b/config/packages/neato.yaml @@ -23,21 +23,13 @@ automation: attribute: battery_level below: 20 - - condition: numeric_state - entity_id: automation.vacuum_tweet - attribute: last_triggered - above: 15000 - - # - condition: template - # value_template: "{{ states.vacuum.carlo_neato.attributes.battery_level |int < 20 }}" - - # - 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 -%} + - 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: - service: script.tweet_engine_image diff --git a/config/packages/twitter.yaml b/config/packages/twitter.yaml index d2f5327c..cf99c47a 100755 --- a/config/packages/twitter.yaml +++ b/config/packages/twitter.yaml @@ -203,19 +203,16 @@ automation: - platform: time_pattern hours: '/2' minutes: 45 - condition: - - condition: numeric_state - entity_id: automation.random_house_stats - attribute: last_triggered - above: 10000 - # - condition: template - # value_template: > - # {%- if states.automation.random_house_stats.attributes.last_triggered -%} - # {{ (as_timestamp(now()) - as_timestamp(states.automation.random_house_stats.attributes.last_triggered)) > 10000 }} - # {%- else -%} - # true - # {%- endif -%} + condition: + - condition: template + value_template: > + {%- if states.automation.random_house_stats.attributes.last_triggered -%} + {{ (as_timestamp(now()) - as_timestamp(states.automation.random_house_stats.attributes.last_triggered)) > 10000 }} + {%- else -%} + true + {%- endif -%} + 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 }}' - service: script.tweet_engine_random @@ -243,19 +240,16 @@ automation: - platform: time_pattern hours: '/7' minutes: 18 - condition: - - condition: numeric_state - entity_id: automation.random_youtube_videos_bearstone - attribute: last_triggered - above: 10000 - # - condition: template - # value_template: > - # {%- if states.automation.random_youtube_videos_bearstone.attributes.last_triggered -%} - # {{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_bearstone.attributes.last_triggered)) > 10000 }} - # {%- else -%} - # true - # {%- endif -%} + condition: + - condition: template + value_template: > + {%- if states.automation.random_youtube_videos_bearstone.attributes.last_triggered -%} + {{ (as_timestamp(now()) - as_timestamp(states.automation.random_youtube_videos_bearstone.attributes.last_triggered)) > 10000 }} + {%- else -%} + true + {%- endif -%} + 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 }}' - service: script.tweet_youtube_engine_setup @@ -272,18 +266,14 @@ automation: minutes: 45 condition: - - condition: numeric_state - entity_id: automation.random_youtube_videos_ccostan - attribute: last_triggered - above: 10000 + - 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 -%} - # - 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: - service: script.tweet_youtube_engine_setup data: