Cleaned up a LOT of templates

This commit is contained in:
2023-04-03 23:47:25 -04:00
parent cb52daa5d8
commit 7c3a32e17b
11 changed files with 46 additions and 276 deletions

View File

@ -274,11 +274,7 @@ script:
- condition: template - condition: template
value_template: >- value_template: >-
{% set ct = ((now().hour * 60 + now().minute) * 60 ) %} {% set ct = ((now().hour * 60 + now().minute) * 60 ) %}
{% if is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') %} {{ is_state('input_boolean.hot_day','off') and ct < state_attr('input_datetime.emma_bedtime','timestamp') and ct >= state_attr('input_datetime.emma_wakeup','timestamp') }}
true
{% else %}
false
{% endif %}
then: then:
- service: fan.turn_off - service: fan.turn_off
target: target:

View File

@ -273,48 +273,28 @@ sensor:
value_template: > value_template: >
{% set current = state_attr('light.basement_studio_lights','brightness') %} {% set current = state_attr('light.basement_studio_lights','brightness') %}
{{ ((current / 255) * 100) | float | round(2) }} {{ ((current / 255) * 100) | float | round(2) }}
availability_template: > availability_template: "{{ is_state('light.basement_studio_lights','on') }}"
{% if is_state('light.basement_studio_lights','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: '%' unit_of_measurement: '%'
icon_template: mdi:brightness-percent icon_template: mdi:brightness-percent
basement_studio_lights_brightness_intended: basement_studio_lights_brightness_intended:
friendly_name: "Basement Studio Lights - Brightness Intended" friendly_name: "Basement Studio Lights - Brightness Intended"
unique_id: 3542077f-24c6-460c-a73f-fe7bc8413b81 unique_id: 3542077f-24c6-460c-a73f-fe7bc8413b81
value_template: "{{ state_attr('switch.adaptive_lighting_basement_studio','brightness_pct') | float | round(2) }}" value_template: "{{ state_attr('switch.adaptive_lighting_basement_studio','brightness_pct') | float | round(2) }}"
availability_template: > availability_template: "{{ is_state('switch.adaptive_lighting_basement_studio','on') }}"
{% if is_state('switch.adaptive_lighting_basement_studio','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: '%' unit_of_measurement: '%'
icon_template: mdi:brightness-percent icon_template: mdi:brightness-percent
basement_studio_lights_colortemp_actual: basement_studio_lights_colortemp_actual:
friendly_name: "Basement Studio Lights - Colortemp Actual" friendly_name: "Basement Studio Lights - Colortemp Actual"
unique_id: 93cb2a2f-c8a7-44bf-813f-26ce349a072f unique_id: 93cb2a2f-c8a7-44bf-813f-26ce349a072f
value_template: "{{ state_attr('light.basement_studio_lights','color_temp_kelvin') | int }}" value_template: "{{ state_attr('light.basement_studio_lights','color_temp_kelvin') | int }}"
availability_template: > availability_template: "{{ is_state('light.basement_studio_lights','on') }}"
{% if is_state('light.basement_studio_lights','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: 'K' unit_of_measurement: 'K'
icon_template: mdi:thermometer-lines icon_template: mdi:thermometer-lines
basement_studio_lights_colortemp_intended: basement_studio_lights_colortemp_intended:
friendly_name: "Basement Studio Lights - Colortemp Intended" friendly_name: "Basement Studio Lights - Colortemp Intended"
unique_id: 85d4b063-bae8-43c2-9fea-35820b13f26f unique_id: 85d4b063-bae8-43c2-9fea-35820b13f26f
value_template: "{{ state_attr('switch.adaptive_lighting_basement_studio','color_temp_kelvin') | int }}" value_template: "{{ state_attr('switch.adaptive_lighting_basement_studio','color_temp_kelvin') | int }}"
availability_template: > availability_template: "{{ is_state('switch.adaptive_lighting_basement_studio','on') }}"
{% if is_state('switch.adaptive_lighting_basement_studio','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: 'K' unit_of_measurement: 'K'
icon_template: mdi:thermometer-lines icon_template: mdi:thermometer-lines
basement_studio_lights_brightness_diff: basement_studio_lights_brightness_diff:
@ -324,12 +304,7 @@ sensor:
{% set current = states('sensor.basement_studio_lights_brightness_actual') | float %} {% set current = states('sensor.basement_studio_lights_brightness_actual') | float %}
{% set intended = states('sensor.basement_studio_lights_brightness_intended') | float %} {% set intended = states('sensor.basement_studio_lights_brightness_intended') | float %}
{{ (current - intended) | float | round(2) }} {{ (current - intended) | float | round(2) }}
availability_template: > availability_template: "{{ is_state('light.basement_studio_lights','on') and is_state('switch.adaptive_lighting_basement_studio','on') }}"
{% if is_state('light.basement_studio_lights','on') and is_state('switch.adaptive_lighting_basement_studio','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: '%' unit_of_measurement: '%'
icon_template: mdi:brightness-percent icon_template: mdi:brightness-percent
basement_studio_lights_colortemp_diff: basement_studio_lights_colortemp_diff:
@ -339,12 +314,7 @@ sensor:
{% set current = states('sensor.basement_studio_lights_colortemp_actual') | float %} {% set current = states('sensor.basement_studio_lights_colortemp_actual') | float %}
{% set intended = states('sensor.basement_studio_lights_colortemp_intended') | float %} {% set intended = states('sensor.basement_studio_lights_colortemp_intended') | float %}
{{ (current - intended) | float | round(2) }} {{ (current - intended) | float | round(2) }}
availability_template: > availability_template: "{{ is_state('light.basement_studio_lights','on') and is_state('switch.adaptive_lighting_basement_studio','on') }}"
{% if is_state('light.basement_studio_lights','on') and is_state('switch.adaptive_lighting_basement_studio','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: 'K' unit_of_measurement: 'K'
icon_template: mdi:thermometer-lines icon_template: mdi:thermometer-lines
living_room_lights_brightness_actual: living_room_lights_brightness_actual:
@ -353,48 +323,28 @@ sensor:
value_template: > value_template: >
{% set current = state_attr('light.living_room_lights','brightness') %} {% set current = state_attr('light.living_room_lights','brightness') %}
{{ ((current / 255) * 100) | float | round(2) }} {{ ((current / 255) * 100) | float | round(2) }}
availability_template: > availability_template: "{{ is_state('light.living_room_lights','on') }}"
{% if is_state('light.living_room_lights','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: '%' unit_of_measurement: '%'
icon_template: mdi:brightness-percent icon_template: mdi:brightness-percent
living_room_lights_brightness_intended: living_room_lights_brightness_intended:
friendly_name: "Living Room Lights - Brightness Intended" friendly_name: "Living Room Lights - Brightness Intended"
unique_id: a758742f-6724-4920-a9d1-325fe4f02664 unique_id: a758742f-6724-4920-a9d1-325fe4f02664
value_template: "{{ state_attr('switch.adaptive_lighting_living_room','brightness_pct') | float | round(2) }}" value_template: "{{ state_attr('switch.adaptive_lighting_living_room','brightness_pct') | float | round(2) }}"
availability_template: > availability_template: "{{ is_state('switch.adaptive_lighting_living_room','on') }}"
{% if is_state('switch.adaptive_lighting_living_room','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: '%' unit_of_measurement: '%'
icon_template: mdi:brightness-percent icon_template: mdi:brightness-percent
living_room_lights_colortemp_actual: living_room_lights_colortemp_actual:
friendly_name: "Living Room Lights - Colortemp Actual" friendly_name: "Living Room Lights - Colortemp Actual"
unique_id: dbe08826-e113-4474-bbca-60d3c32a4b65 unique_id: dbe08826-e113-4474-bbca-60d3c32a4b65
value_template: "{{ state_attr('light.living_room_lights','color_temp_kelvin') | int }}" value_template: "{{ state_attr('light.living_room_lights','color_temp_kelvin') | int }}"
availability_template: > availability_template: "{{ is_state('light.living_room_lights','on') }}"
{% if is_state('light.living_room_lights','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: 'K' unit_of_measurement: 'K'
icon_template: mdi:thermometer-lines icon_template: mdi:thermometer-lines
living_room_lights_colortemp_intended: living_room_lights_colortemp_intended:
friendly_name: "Living Room Lights - Colortemp Intended" friendly_name: "Living Room Lights - Colortemp Intended"
unique_id: 8b974c03-ab5b-4b89-97bf-afee78fa1a40 unique_id: 8b974c03-ab5b-4b89-97bf-afee78fa1a40
value_template: "{{ state_attr('switch.adaptive_lighting_living_room','color_temp_kelvin') | int }}" value_template: "{{ state_attr('switch.adaptive_lighting_living_room','color_temp_kelvin') | int }}"
availability_template: > availability_template: "{{ is_state('switch.adaptive_lighting_living_room','on') }}"
{% if is_state('switch.adaptive_lighting_living_room','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: 'K' unit_of_measurement: 'K'
icon_template: mdi:thermometer-lines icon_template: mdi:thermometer-lines
living_room_lights_brightness_diff: living_room_lights_brightness_diff:
@ -404,12 +354,7 @@ sensor:
{% set current = states('sensor.living_room_lights_brightness_actual') | float %} {% set current = states('sensor.living_room_lights_brightness_actual') | float %}
{% set intended = states('sensor.living_room_lights_brightness_intended') | float %} {% set intended = states('sensor.living_room_lights_brightness_intended') | float %}
{{ (current - intended) | float | round(2) }} {{ (current - intended) | float | round(2) }}
availability_template: > availability_template: "{{ is_state('light.living_room_lights','on') and is_state('switch.adaptive_lighting_living_room','on') }}"
{% if is_state('light.living_room_lights','on') and is_state('switch.adaptive_lighting_living_room','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: '%' unit_of_measurement: '%'
icon_template: mdi:brightness-percent icon_template: mdi:brightness-percent
living_room_lights_colortemp_diff: living_room_lights_colortemp_diff:
@ -419,12 +364,7 @@ sensor:
{% set current = states('sensor.living_room_lights_colortemp_actual') | float %} {% set current = states('sensor.living_room_lights_colortemp_actual') | float %}
{% set intended = states('sensor.living_room_lights_colortemp_intended') | float %} {% set intended = states('sensor.living_room_lights_colortemp_intended') | float %}
{{ (current - intended) | float | round(2) }} {{ (current - intended) | float | round(2) }}
availability_template: > availability_template: "{{ is_state('light.living_room_lights','on') and is_state('switch.adaptive_lighting_living_room','on') }}"
{% if is_state('light.living_room_lights','on') and is_state('switch.adaptive_lighting_living_room','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: 'K' unit_of_measurement: 'K'
icon_template: mdi:thermometer-lines icon_template: mdi:thermometer-lines
@ -908,11 +848,7 @@ automation:
{% if is_state('media_player.basement_tv','playing') %} {% if is_state('media_player.basement_tv','playing') %}
false false
{% elif is_state('media_player.basement_tv','paused') or is_state('media_player.basement_tv','idle') %} {% elif is_state('media_player.basement_tv','paused') or is_state('media_player.basement_tv','idle') %}
{% if state_attr('media_player.basement_tv','app_name') in ['TV','Android TV Launcher'] %} {{ state_attr('media_player.basement_tv','app_name') in ['TV','Android TV Launcher'] }}
true
{% else %}
false
{% endif %}
{% else %} {% else %}
false false
{% endif %} {% endif %}
@ -1336,14 +1272,7 @@ script:
option: Bright option: Bright
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ is_state('input_boolean.kallen_sleeping','off') or (is_state('input_boolean.kallen_sleeping','on') and is_state('light.kallen_bedroom_lights','on')) }}"
{% if is_state('input_boolean.kallen_sleeping','off') %}
true
{% elif is_state('input_boolean.kallen_sleeping','on') and is_state('light.kallen_bedroom_lights','on') %}
true
{% else %}
false
{% endif %}
then: then:
- service: input_select.select_option - service: input_select.select_option
target: target:
@ -1352,14 +1281,7 @@ script:
option: Bright option: Bright
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ is_state('input_boolean.emma_sleeping','off') or (is_state('input_boolean.emma_sleeping','on') and is_state('light.emma_bedroom_light','on')) }}"
{% if is_state('input_boolean.emma_sleeping','off') %}
true
{% elif is_state('input_boolean.emma_sleeping','on') and is_state('light.emma_bedroom_light','on') %}
true
{% else %}
false
{% endif %}
then: then:
- service: input_select.select_option - service: input_select.select_option
target: target:
@ -1607,11 +1529,7 @@ script:
- condition: template - condition: template
value_template: > value_template: >
{% set weather = states('weather.iron_nerd_weather_station') %} {% set weather = states('weather.iron_nerd_weather_station') %}
{% if weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] %} {{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }}
true
{% else %}
false
{% endif %}
then: then:
- if: - if:
- condition: template - condition: template

View File

@ -99,11 +99,7 @@ script:
- condition: template - condition: template
value_template: > value_template: >
{% set weather = states('weather.iron_nerd_weather_station') %} {% set weather = states('weather.iron_nerd_weather_station') %}
{% if weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] %} {{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }}
true
{% else %}
false
{% endif %}
then: then:
- service: input_select.select_option - service: input_select.select_option
target: target:

View File

@ -1254,12 +1254,7 @@ script:
entity_id: input_boolean.audible_notifications entity_id: input_boolean.audible_notifications
state: 'on' state: 'on'
- condition: template - condition: template
value_template: > value_template: "{{ type in ['critical','Critical','alert','Alert'] }}"
{% if type in ['critical','Critical','alert','Alert'] %}
true
{% else %}
false
{% endif %}
- condition: state - condition: state
entity_id: group.adults entity_id: group.adults
state: 'home' state: 'home'
@ -1459,12 +1454,7 @@ script:
sequence: sequence:
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ type in ['critical','Critical'] }}"
{% if type in ['critical','Critical'] %}
true
{% else %}
false
{% endif %}
then: then:
- service: media_player.volume_set - service: media_player.volume_set
target: target:

View File

@ -235,29 +235,11 @@ template:
device_class: presence device_class: presence
- name: "Nerds Home" - name: "Nerds Home"
unique_id: 2672a6a2-4be4-495c-b479-ffc7c6df67d2 unique_id: 2672a6a2-4be4-495c-b479-ffc7c6df67d2
state: >- state: "{{ is_state('group.family','home') and (is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.kallen_home','on')) }}"
{% if is_state('group.family','home') %}
{% if is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.kallen_home','on') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %}
device_class: presence device_class: presence
- name: "Parents Home" - name: "Parents Home"
unique_id: 8de02d19-60a6-436d-9187-1cfc70d6c297 unique_id: 8de02d19-60a6-436d-9187-1cfc70d6c297
state: >- state: "{{ is_state('group.adults','home') and (is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.tina_home','on')) }}"
{% if is_state('group.adults','home') %}
{% if is_state('binary_sensor.tony_home','on') or is_state('binary_sensor.tina_home','on') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %}
device_class: presence device_class: presence
- name: "Basement Unoccupied" - name: "Basement Unoccupied"
unique_id: 20039c29-8b9d-436d-ba6c-8f2c2bda1db0 unique_id: 20039c29-8b9d-436d-ba6c-8f2c2bda1db0
@ -649,11 +631,7 @@ script:
- condition: template - condition: template
value_template: > value_template: >
{% set weather = states('weather.iron_nerd_weather_station') %} {% set weather = states('weather.iron_nerd_weather_station') %}
{% if weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] %} {{ weather in ['cloudy','partlycloudy','rainy','snowy','hail','lightning','lightning-rainy','pouring','snowy-rainy'] }}
true
{% else %}
false
{% endif %}
then: then:
- service: light.turn_on - service: light.turn_on
target: target:

View File

@ -291,7 +291,7 @@ script:
entity_id: input_datetime.kallen_bedtime entity_id: input_datetime.kallen_bedtime
data: data:
time: > time: >
{% if is_state('sensor.kallen_school_tomorrow', 'on') %} {% if is_state('binary_sensor.kallen_school_tomorrow', 'on') %}
21:00 21:00
{% else %} {% else %}
22:00 22:00
@ -422,12 +422,7 @@ script:
{% endif %} {% endif %}
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ states('sensor.todays_high_temp') | int >= states('input_number.hot_day_threshold') | int }}"
{% if states('sensor.todays_high_temp') | int >= states('input_number.hot_day_threshold') | int %}
true
{% else %}
false
{% endif %}
then: then:
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
@ -438,12 +433,7 @@ script:
entity_id: input_boolean.hot_day entity_id: input_boolean.hot_day
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ states('sensor.todays_high_temp') | int <= states('input_number.cold_day_threshold') | int }}"
{% if states('sensor.todays_high_temp') | int <= states('input_number.cold_day_threshold') | int %}
true
{% else %}
false
{% endif %}
then: then:
- service: input_boolean.turn_on - service: input_boolean.turn_on
target: target:
@ -477,7 +467,7 @@ script:
entity_id: input_datetime.audible_notification_off entity_id: input_datetime.audible_notification_off
data: data:
time: > time: >
{% if is_state('sensor.kallen_school_tomorrow','on') %} {% if is_state('binary_sensor.kallen_school_tomorrow','on') %}
22:15 22:15
{% else %} {% else %}
23:15 23:15
@ -524,9 +514,9 @@ script:
data: data:
time: > time: >
{% set low = states('sensor.tonights_low_temp') | int %} {% set low = states('sensor.tonights_low_temp') | int %}
{% if is_state('input_boolean.hot_day','on') and is_state('sensor.kallen_school_tomorrow','on') %} {% if is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','on') %}
20:00 20:00
{% elif is_state('input_boolean.hot_day','on') and is_state('sensor.kallen_school_tomorrow','off') %} {% elif is_state('input_boolean.hot_day','on') and is_state('binary_sensor.kallen_school_tomorrow','off') %}
21:00 21:00
{% elif low >= 56 and low <= 60 %} {% elif low >= 56 and low <= 60 %}
22:30 22:30

View File

@ -215,11 +215,7 @@ automation:
{% set rearm = state_attr('input_datetime.morning_alarm_rearm','timestamp') %} {% set rearm = state_attr('input_datetime.morning_alarm_rearm','timestamp') %}
{% set wake = state_attr('input_datetime.master_bedroom_wakeup','timestamp') %} {% set wake = state_attr('input_datetime.master_bedroom_wakeup','timestamp') %}
{% set diff = wake - rearm %} {% set diff = wake - rearm %}
{% if diff <= 1800 %} {{ diff > 1800 }}
false
{% else %}
true
{% endif %}
action: action:
- if: - if:
- condition: state - condition: state
@ -425,12 +421,7 @@ script:
entity_id: input_boolean.security_armed_home entity_id: input_boolean.security_armed_home
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ silent != 1 }}"
{% if silent == 1 %}
false
{% else %}
true
{% endif %}
then: then:
- service: script.status_annc - service: script.status_annc
data: data:
@ -491,12 +482,7 @@ script:
entity_id: input_boolean.security_armed_home entity_id: input_boolean.security_armed_home
state: 'on' state: 'on'
- condition: template - condition: template
value_template: > value_template: "{{ silent != 1 }}"
{% if silent == 1 %}
false
{% else %}
true
{% endif %}
then: then:
- service: script.status_annc - service: script.status_annc
data: data:

View File

@ -12,111 +12,47 @@ template:
unique_id: f361b30c-1771-41b3-85ff-ef1e0b6be59c unique_id: f361b30c-1771-41b3-85ff-ef1e0b6be59c
state: > state: >
{% if state_attr('sensor.michigan_wolverines','kickoff_in') %} {% if state_attr('sensor.michigan_wolverines','kickoff_in') %}
{% if 'months' in state_attr('sensor.michigan_wolverines','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.michigan_wolverines','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.michigan_wolverines','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: Ohio State Buckeyes Inhibit - name: Ohio State Buckeyes Inhibit
unique_id: d5359cb4-427a-46f8-99d6-4313530fde81 unique_id: d5359cb4-427a-46f8-99d6-4313530fde81
state: > state: >
{% if state_attr('sensor.ohio_state_buckeyes','kickoff_in') %} {% if state_attr('sensor.ohio_state_buckeyes','kickoff_in') %}
{% if 'months' in state_attr('sensor.ohio_state_buckeyes','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.ohio_state_buckeyes','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.ohio_state_buckeyes','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: Toledo Rockets Inhibit - name: Toledo Rockets Inhibit
unique_id: 1f84d3f3-a06e-4745-a593-c21fe3504072 unique_id: 1f84d3f3-a06e-4745-a593-c21fe3504072
state: > state: >
{% if state_attr('sensor.toledo_rockets','kickoff_in') %} {% if state_attr('sensor.toledo_rockets','kickoff_in') %}
{% if 'months' in state_attr('sensor.toledo_rockets','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.toledo_rockets','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.toledo_rockets','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: Minnesota Vikings Inhibit - name: Minnesota Vikings Inhibit
unique_id: ea60c987-a95b-4024-a9c7-1bc6975e07e2 unique_id: ea60c987-a95b-4024-a9c7-1bc6975e07e2
state: > state: >
{% if state_attr('sensor.minnesota_vikings','kickoff_in') %} {% if state_attr('sensor.minnesota_vikings','kickoff_in') %}
{% if 'months' in state_attr('sensor.minnesota_vikings','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.minnesota_vikings','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.minnesota_vikings','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: San Francisco 49ers Inhibit - name: San Francisco 49ers Inhibit
unique_id: ce2441fa-09d6-4afc-b350-fee3745cdb50 unique_id: ce2441fa-09d6-4afc-b350-fee3745cdb50
state: > state: >
{% if state_attr('sensor.san_francisco_49ers','kickoff_in') %} {% if state_attr('sensor.san_francisco_49ers','kickoff_in') %}
{% if 'months' in state_attr('sensor.san_francisco_49ers','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.san_francisco_49ers','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.san_francisco_49ers','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: Cleveland Guardians Inhibit - name: Cleveland Guardians Inhibit
unique_id: b0980d47-d762-4f23-97b1-9e88da729d8f unique_id: b0980d47-d762-4f23-97b1-9e88da729d8f
state: > state: >
{% if state_attr('sensor.cleveland_guardians','kickoff_in') %} {% if state_attr('sensor.cleveland_guardians','kickoff_in') %}
{% if 'months' in state_attr('sensor.cleveland_guardians','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.cleveland_guardians','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.cleveland_guardians','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: Minnesota Twins Inhibit - name: Minnesota Twins Inhibit
unique_id: 2987ae95-f55d-4994-b9dd-018278d2f5ad unique_id: 2987ae95-f55d-4994-b9dd-018278d2f5ad
state: > state: >
{% if state_attr('sensor.minnesota_twins','kickoff_in') %} {% if state_attr('sensor.minnesota_twins','kickoff_in') %}
{% if 'months' in state_attr('sensor.minnesota_twins','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.minnesota_twins','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.minnesota_twins','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}
- name: Los Angeles Dodgers Inhibit - name: Los Angeles Dodgers Inhibit
unique_id: 2c6aae6e-eff6-46e5-bee9-311f9bbc0c0e unique_id: 2c6aae6e-eff6-46e5-bee9-311f9bbc0c0e
state: > state: >
{% if state_attr('sensor.los_angeles_dodgers','kickoff_in') %} {% if state_attr('sensor.los_angeles_dodgers','kickoff_in') %}
{% if 'months' in state_attr('sensor.los_angeles_dodgers','kickoff_in') %} {{ ('months' or 'weeks') in state_attr('sensor.los_angeles_dodgers','kickoff_in') }}
true
{% elif 'weeks' in state_attr('sensor.los_angeles_dodgers','kickoff_in') %}
true
{% else %}
false
{% endif %}
{% else %}
false
{% endif %} {% endif %}

View File

@ -56,34 +56,19 @@ sensor:
friendly_name: "Min Ping" friendly_name: "Min Ping"
unique_id: ddcb9f6f-7c94-41fe-9453-2a2205b078e0 unique_id: ddcb9f6f-7c94-41fe-9453-2a2205b078e0
value_template: "{{ state_attr('binary_sensor.internet','round_trip_time_min') }}" value_template: "{{ state_attr('binary_sensor.internet','round_trip_time_min') }}"
availability_template: >- availability_template: "{{ is_state('binary_sensor.internet','on') }}"
{% if is_state('binary_sensor.internet','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: "ms" unit_of_measurement: "ms"
avg_ping: avg_ping:
friendly_name: "Avg Ping" friendly_name: "Avg Ping"
unique_id: 79a13c64-7508-48de-8b44-2a23c59917c8 unique_id: 79a13c64-7508-48de-8b44-2a23c59917c8
value_template: "{{ state_attr('binary_sensor.internet','round_trip_time_avg') }}" value_template: "{{ state_attr('binary_sensor.internet','round_trip_time_avg') }}"
availability_template: >- availability_template: "{{ is_state('binary_sensor.internet','on') }}"
{% if is_state('binary_sensor.internet','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: "ms" unit_of_measurement: "ms"
max_ping: max_ping:
friendly_name: "Max Ping" friendly_name: "Max Ping"
unique_id: c9c71ab6-c7fa-4425-a4ed-768d60e93781 unique_id: c9c71ab6-c7fa-4425-a4ed-768d60e93781
value_template: "{{ state_attr('binary_sensor.internet','round_trip_time_max') }}" value_template: "{{ state_attr('binary_sensor.internet','round_trip_time_max') }}"
availability_template: >- availability_template: "{{ is_state('binary_sensor.internet','on') }}"
{% if is_state('binary_sensor.internet','on') %}
true
{% else %}
false
{% endif %}
unit_of_measurement: "ms" unit_of_measurement: "ms"
mqtt: mqtt:

View File

@ -1699,12 +1699,7 @@ script:
## Create a new persistant notification in the UI for a new alert ## Create a new persistant notification in the UI for a new alert
- if: - if:
- condition: template - condition: template
value_template: > value_template: "{{ states.sensor.weatheralerts.state != '0' }}"
{% if states.sensor.weatheralerts.state != '0' %}
true
{% else %}
false
{% endif %}
then: then:
- service: persistent_notification.create - service: persistent_notification.create
data: data:

View File

@ -33,8 +33,8 @@ give_me_darkness:
then: then:
- if: - if:
- condition: template - condition: template
value_template: "{% if is_state('person.tony_stork','home') and is_state('person.christina_stork','home') value_template: '{{ is_state(''person.tony_stork'',''home'') and is_state(''person.christina_stork'',''home'')
%}\n true\n{% else %}\n false\n{% endif %}" }}'
alias: Both adults are home alias: Both adults are home
then: then:
- service: script.activate_alexa_actionable_notification - service: script.activate_alexa_actionable_notification