I had a condition in automation and today learned to reverse the parameters.
It has worked with the below for the past 3 years
condition: time
after: input_datetime.legal_sound_on
before: input_datetime.legal_sound_off
Last updated changed the behavior and today I changed it to:
condition: time
after: input_datetime.legal_sound_off
before: input_datetime.legal_sound_on
Do I need to delete the condition and recreate it? Maybe something on the back end?
type or paste code here
choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: "{{ states(\"input_text.ttssay\")[:1] == \"1\" }}"
- condition: template
value_template: "{{ states(\"input_text.mpdstream\")[:1] == \"1\" }}"
enabled: false
- condition: state
entity_id: switch.soundsw
state: "on"
- condition: state
entity_id: binary_sensor.internet
state: "on"
sequence:
- data: {}
action: media_player.media_stop
target:
device_id: bbcd636b9da4923367b5b5e5014e07ec
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
enabled: true
- target:
entity_id: media_player.soundsystem_lr
data:
media_content_id: media-source://media_source/local/Sara/you bitch.mp3
media_content_type: audio/mpeg
metadata:
title: you bitch.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- media_content_type: ""
media_content_id: media-source://media_source/local/Sara
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "5"
continue_on_timeout: true
- target:
entity_id:
- media_player.soundsystem_lr
data:
volume_level: "{{ states(\"input_number.announce_volume\") | float(0) }}"
action: media_player.volume_set
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "5"
continue_on_timeout: true
- data:
message: >-
{{'<speak><prosody rate="-10%">'+states('input_text.ttssay')[1:]+'
'+states('input_text.mpdstream')+'</prosody></speak>'}}
target:
entity_id:
- media_player.soundsystem_lr
action: tts.amazon_polly_say
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- wait_for_trigger:
- platform: template
value_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "30"
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- data: {}
enabled: true
action: script.play_radio_a
- conditions:
- condition: and
conditions:
- condition: template
value_template: "{{ states(\"input_text.ttssay\")[:1] == \"2\" }}"
- condition: state
entity_id: light.bulb1
state: "on"
- condition: numeric_state
entity_id: sensor.people_at_home
above: 0
- condition: time
after: input_datetime.legal_sound_off
before: input_datetime.legal_sound_on
- condition: state
entity_id: binary_sensor.internet
state: "on"
sequence:
- action: media_player.media_stop
target:
device_id: d41bd1ba0d8e59465f88c02eda1d752c
data: {}
- condition: time
after: input_datetime.sleep_time_end
before: input_datetime.sleep_time_start
weekday:
- sun
- mon
- tue
- wed
- thu
- fri
- sat
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: true
- wait_template: >-
{{ states("media_player.soundsystem_a226") == "paused" or
states("media_player.soundsystem_a226") == "idle" }}
timeout: "5"
continue_on_timeout: true
enabled: true
- target:
entity_id:
- media_player.soundsystem_a226
data:
volume_level: "{{ states(\"input_number.announce_volume\") | float(0) }}"
action: media_player.volume_set
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
enabled: true
- data:
message: >-
{{'<speak><prosody pitch="high"
rate="-20%">'+states('input_text.ttssay')[1:]+'
'+states('input_text.mpdstream')+'</prosody></speak>'}}
target:
entity_id:
- media_player.soundsystem_a226
action: tts.amazon_polly_say
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_a226") == "paused" or
states("media_player.soundsystem_a226") == "idle" }}
timeout: "20"
continue_on_timeout: true
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- data: {}
action: script.play_radio_ba
- conditions:
- condition: template
value_template: >-
{{ states("input_text.ttssay")[:4] == "http" or
states("input_text.ttssay")[:5] == " http" or
states("input_text.ttssay")[:6] == " http" or
states("input_text.ttssay")[:7] == " http"}}
sequence:
- data: {}
target:
device_id: bbcd636b9da4923367b5b5e5014e07ec
action: media_player.media_stop
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
enabled: true
- target:
entity_id: media_player.soundsystem_lr
data:
media_content_id: media-source://media_source/local/Sara/bitch.mp3
media_content_type: audio/mpeg
metadata:
title: bitch.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- media_content_type: ""
media_content_id: media-source://media_source/local/Sara
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "5"
continue_on_timeout: true
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: false
- target:
entity_id:
- media_player.soundsystem_lr
data:
volume_level: "{{ states(\"input_number.announce_volume\") }}"
enabled: true
action: media_player.volume_set
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: true
- if:
- condition: template
value_template: "{{ states(\"input_text.ttssay\") != \"\"}}"
then:
- data:
media_content_type: audio/mp3
media_content_id: "{{ states('input_text.ttssay') }}"
target:
entity_id:
- media_player.soundsystem_lr
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: true
- if:
- condition: template
value_template: "{{ states('input_text.mpdstream') != ' ' }}"
then:
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "5"
continue_on_timeout: true
- data:
media_content_type: audio/mp3
media_content_id: "{{ states('input_text.mpdstream') }}"
target:
entity_id: media_player.soundsystem_lr
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: true
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "20"
continue_on_timeout: true
enabled: true
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- action: script.play_radio_a
data: {}
- condition: and
conditions:
- condition: time
before: input_datetime.legal_sound_off
after: input_datetime.legal_sound_on
- condition: state
entity_id: light.bulb1
state: "on"
- target:
device_id: d41bd1ba0d8e59465f88c02eda1d752c
data: {}
action: media_player.media_stop
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- target:
entity_id:
- media_player.soundsystem_a226
data:
volume_level: "{{ states(\"input_number.announce_volume\") | float(0) }}"
action: media_player.volume_set
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- data:
media_content_type: audio/mp3
media_content_id: "{{ states('input_text.ttssay') }}"
target:
entity_id:
- media_player.soundsystem_a226
enabled: false
action: media_player.play_media
- if:
- condition: template
value_template: "{{ states(\"input_text.ttssay\") != \"\"}}"
then:
- data:
media_content_type: audio/mp3
media_content_id: "{{ states('input_text.ttssay') }}"
target:
entity_id:
- media_player.soundsystem_a226
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_a226") == "paused" or
states("media_player.soundsystem_a226") == "idle" }}
timeout: "20"
continue_on_timeout: true
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- data:
message: >-
{{ '<speak><prosody rate="-10%"> ' + states("input_text.mpdstream")
+ '</prosody></speak>' }}
target:
entity_id:
- media_player.soundsystem_a226
action: tts.amazon_polly_say
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- data: {}
action: script.play_radio_ba
default:
- condition: and
conditions:
- condition: template
value_template: >-
{{ states("input_text.ttssay")[:1] != "1" and
states("input_text.ttssay")[:1] != "2" }}
- condition: state
entity_id: binary_sensor.internet
state: "on"
- condition: template
value_template: "{{ states(\"input_text.ttssay\")[:1] != \"\" }}"
- data: {}
target:
device_id: bbcd636b9da4923367b5b5e5014e07ec
action: media_player.media_stop
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- target:
entity_id: media_player.soundsystem_lr
data:
media_content_id: media-source://media_source/local/Sara/hell.mp3
media_content_type: audio/mpeg
metadata:
title: hell.mp3
thumbnail: null
media_class: music
children_media_class: null
navigateIds:
- {}
- media_content_type: app
media_content_id: media-source://media_source
- media_content_type: ""
media_content_id: media-source://media_source/local/Sara
action: media_player.play_media
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- target:
entity_id:
- media_player.soundsystem_lr
data:
volume_level: "{{ states(\"input_number.announce_volume\") | float(0) }}"
action: media_player.volume_set
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "10"
continue_on_timeout: true
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
enabled: false
- choose:
- conditions:
- condition: or
conditions:
- condition: template
value_template: >-
{{(as_timestamp(utcnow()) -
as_timestamp(states.binary_sensor.ih_temp1_motion.last_changed))
| int(0) //60 > 2 }}
- condition: template
value_template: >-
{{ utcnow() > as_timestamp
(states("input_button.button_hassio_start2"), default=0) |
as_datetime + timedelta(minutes=2) }}
- condition: template
value_template: >-
{{ utcnow() > as_timestamp
(states("input_button.button_work_warning"), default=0) |
as_datetime + timedelta(minutes=2) }}
- condition: device
type: is_on
device_id: f120095f19854ae2d77d0efef93b6be2
entity_id: 5e3bb23dcc6a2b9387654deddcc91423
domain: switch
sequence:
- data:
message: >-
{{ '<speak><prosody rate="-10%">' + states("input_text.ttssay")
+ ' ' + states("input_text.mpdstream")+'</prosody></speak>'}}
target:
entity_id:
- media_player.soundsystem_lr
action: tts.amazon_polly_say
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
enabled: true
- wait_template: >-
{{ states("media_player.soundsystem_lr") == "paused" or
states("media_player.soundsystem_lr") == "idle" }}
timeout: "20"
continue_on_timeout: true
- metadata: {}
data: {}
target:
entity_id: script.play_radio_a
action: script.turn_on
default: []
- condition: time
after: input_datetime.legal_sound_on
before: input_datetime.legal_sound_off
- condition: or
conditions:
- condition: state
entity_id: input_boolean.sleep_override
state: "on"
- condition: template
value_template: >-
{{ now() < state_attr("automation.hassio_start2","last_triggered") +
timedelta(minutes=2) }}
- condition: template
value_template: >-
{{ now() < state_attr("automation.work_warning","last_triggered") +
timedelta(minutes = 2) }}
- condition: state
entity_id: light.bulb1
state: "on"
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- data: {}
target:
device_id: d41bd1ba0d8e59465f88c02eda1d752c
action: media_player.media_stop
- delay:
hours: 0
minutes: 0
seconds: 1
milliseconds: 0
- choose:
- conditions:
- condition: template
value_template: >-
{{ states("media_player.soundsystem_a226") == "paused" or
states("media_player.soundsystem_a226") == "idle" }}
sequence:
- target:
entity_id:
- media_player.soundsystem_a226
data:
volume_level: "{{ states(\"input_number.announce_volume\") | float(0) }}"
action: media_player.volume_set
- data:
message: >-
{{'<speak><prosody pitch="high" rate="-20%" >' +
states('input_text.ttssay') + ' ' + states('input_text.mpdstream') +
'</prosody></speak>'}}
target:
entity_id:
- media_player.soundsystem_a226
action: tts.amazon_polly_say
- delay:
hours: 0
minutes: 0
seconds: 2
milliseconds: 0
- wait_template: >-
{{ states("media_player.soundsystem_a226") == "paused" or
states("media_player.soundsystem_a226") == "idle" }}
timeout: "25"
continue_on_timeout: true
- data: {}
action: script.play_radio_ba