From 2219e82166e651479ef6a1592e1b01e672009c14 Mon Sep 17 00:00:00 2001 From: ccostan Date: Thu, 17 Sep 2020 20:09:56 -0400 Subject: [PATCH] More Attribute condition changes. --- .../automation/System/rachio_rain_delay.yaml | 21 ++++--- config/packages/juicenet.yaml | 20 ++++--- config/packages/twitter.yaml | 60 ++++++++++++------- 3 files changed, 65 insertions(+), 36 deletions(-) diff --git a/config/automation/System/rachio_rain_delay.yaml b/config/automation/System/rachio_rain_delay.yaml index 1069f2e3..34c71324 100755 --- a/config/automation/System/rachio_rain_delay.yaml +++ b/config/automation/System/rachio_rain_delay.yaml @@ -4,7 +4,7 @@ - alias: Rachio_Rain_Delay id: 55290018-b763-4739-873e-afb556b2b9be - + trigger: - platform: numeric_state entity_id: @@ -16,13 +16,18 @@ above: 20 condition: - - condition: template - value_template: > - {%- if states.automation.random_house_stats.attributes.last_triggered -%} - {{ (as_timestamp(now()) - as_timestamp(states.automation.rachio_rain_delay.attributes.last_triggered)) > 43200 }} - {%- else -%} - true - {%- endif -%} + - condition: numeric_state + entity_id: automation.random_house_stats + attribute: last_triggered + above: 43200 + + # - condition: template + # value_template: > + # {%- if states.automation.random_house_stats.attributes.last_triggered -%} + # {{ (as_timestamp(now()) - as_timestamp(states.automation.rachio_rain_delay.attributes.last_triggered)) > 43200 }} + # {%- else -%} + # true + # {%- endif -%} action: - service: ifttt.trigger diff --git a/config/packages/juicenet.yaml b/config/packages/juicenet.yaml index 657de4ab..b50523c9 100755 --- a/config/packages/juicenet.yaml +++ b/config/packages/juicenet.yaml @@ -51,13 +51,19 @@ automation: state: 'disconnect' for: minutes: 5 - - 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: 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 -%} action: - service: homeassistant.turn_on diff --git a/config/packages/twitter.yaml b/config/packages/twitter.yaml index 4e809b26..370b94de 100755 --- a/config/packages/twitter.yaml +++ b/config/packages/twitter.yaml @@ -240,18 +240,24 @@ automation: - alias: 'Random House stats' id: b274a40d-cb67-4d6a-94d1-5fa685ae5ea4 + mode: single trigger: - platform: time_pattern hours: '/2' minutes: 45 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 -%} + - 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 -%} 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 @@ -280,13 +286,18 @@ automation: hours: '/7' minutes: 18 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 -%} + - 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 -%} 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 @@ -295,19 +306,26 @@ automation: - alias: 'Random YouTube Videos CCostan' id: 3e8a4db0-165b-4e1b-acb0-ac4503525660 + mode: single trigger: - platform: time_pattern hours: '/22' minutes: 45 + condition: - - 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: 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 -%} action: - service: script.tweet_youtube_engine_setup data_template: