From 2be72e57647ee813153bf363a75979b717cbd036 Mon Sep 17 00:00:00 2001 From: CeeWeasel Date: Sat, 27 Apr 2024 11:20:04 -0400 Subject: [PATCH] notifications --- .../frigate/frigate_notification_testing.yaml | 1 + automations/frigate/frigate_person_back_yard.yaml | 1 + automations/frigate/frigate_person_from_street.yaml | 1 + automations/frigate/frigate_person_front_porch.yaml | 1 + .../frigate/frigate_vehicle_notification.yaml | 1 + automations/house/home_not_occupied.yaml | 9 ++++++++- automations/house/home_occupied.yaml | 8 +++++++- components/packages/clever_announcements.yaml | 13 +++++-------- 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/automations/frigate/frigate_notification_testing.yaml b/automations/frigate/frigate_notification_testing.yaml index 91e2388..6db70c4 100644 --- a/automations/frigate/frigate_notification_testing.yaml +++ b/automations/frigate/frigate_notification_testing.yaml @@ -13,6 +13,7 @@ condition: - "{{ 'driveway' in trigger.payload_json['after']['entered_zones'] }}" - "{{ 'from_street' in trigger.payload_json['after']['entered_zones'] }}" - "{{ trigger.payload_json['after']['label'] == 'person' }}" + - "{{ is_state('input_boolean.outdoor_snapshots','on') }}" action: diff --git a/automations/frigate/frigate_person_back_yard.yaml b/automations/frigate/frigate_person_back_yard.yaml index 72b818f..3893be3 100644 --- a/automations/frigate/frigate_person_back_yard.yaml +++ b/automations/frigate/frigate_person_back_yard.yaml @@ -37,6 +37,7 @@ condition: - '{{ is_state("binary_sensor.outer_garage_door","off") }}' - '{{ is_state("binary_sensor.front_door_contact","off") }}' - '{{ is_state("binary_sensor.patio_door_contact","off") }}' + - "{{ is_state('input_boolean.outdoor_snapshots','on') }}" action: - choose: - conditions: "{{ not group_target }}" diff --git a/automations/frigate/frigate_person_from_street.yaml b/automations/frigate/frigate_person_from_street.yaml index de6eafc..73b6c1e 100644 --- a/automations/frigate/frigate_person_from_street.yaml +++ b/automations/frigate/frigate_person_from_street.yaml @@ -41,6 +41,7 @@ condition: - "{{ not stationary }}" - "{{ not zones|length or zones|select('in', entered_zones)|list|length > 0 }}" - "{{ not labels|length or object in labels }}" + - "{{ is_state('input_boolean.outdoor_snapshots','on') }}" #- "{{ not presence_entity or not is_state(presence_entity, 'home') }}" #- "{{ not garage_door or not is_state(garage_door, 'on') }}" diff --git a/automations/frigate/frigate_person_front_porch.yaml b/automations/frigate/frigate_person_front_porch.yaml index 7792eeb..b5b8b74 100644 --- a/automations/frigate/frigate_person_front_porch.yaml +++ b/automations/frigate/frigate_person_front_porch.yaml @@ -39,6 +39,7 @@ condition: - '{{ is_state("binary_sensor.patio_door_contact","off") }}' - '{{ is_state("binary_sensor.front_porch_motion","off") }}' - '{{ is_state("binary_sensor.garage_motion_switch_home_security_motion_detection","off") }}' + - "{{ is_state('input_boolean.outdoor_snapshots','on') }}" action: - choose: - conditions: "{{ not group_target }}" diff --git a/automations/frigate/frigate_vehicle_notification.yaml b/automations/frigate/frigate_vehicle_notification.yaml index b76b297..a9934cf 100644 --- a/automations/frigate/frigate_vehicle_notification.yaml +++ b/automations/frigate/frigate_vehicle_notification.yaml @@ -45,6 +45,7 @@ condition: - "{{ not stationary }}" - "{{ not zones|length or zones|select('in', entered_zones)|list|length > 0 }}" - "{{ not labels|length or object in labels }}" + - "{{ is_state('input_boolean.outdoor_snapshots','on') }}" #- "{{ not presence_entity or not is_state(presence_entity, 'home') }}" #- "{{ not garage_door or not is_state(garage_door, 'on') }}" diff --git a/automations/house/home_not_occupied.yaml b/automations/house/home_not_occupied.yaml index 56d954b..09f0e49 100644 --- a/automations/house/home_not_occupied.yaml +++ b/automations/house/home_not_occupied.yaml @@ -26,7 +26,14 @@ condition: value_template: "{{ dict((states|selectattr('entity_id', 'in', state_attr('group.person_household', 'entity_id'))|list)|groupby('state'))['on']|count }}" action: - service: input_boolean.turn_off - entity_id: input_boolean.home_occupied + target: + entity_id: input_boolean.home_occupied + + - service: input_boolean.turn_on + target: + entity_id: + - input_boolean.indoor_snapshots + - input_boolean.outdoor_snapshots - service: automation.turn_on data: entity_id: automation.garage_open_nobody_home diff --git a/automations/house/home_occupied.yaml b/automations/house/home_occupied.yaml index 07888c7..3b42378 100644 --- a/automations/house/home_occupied.yaml +++ b/automations/house/home_occupied.yaml @@ -30,7 +30,13 @@ condition: value_template: "{{ dict((states|selectattr('entity_id', 'in', state_attr('group.person_household', 'entity_id'))|list)|groupby('state'))['on']|count }}" action: - service: input_boolean.turn_on - entity_id: input_boolean.home_occupied + target: + entity_id: input_boolean.home_occupied + + - service: input_boolean.turn_off + target: + entity_id: input_boolean.indoor_snapshots + - service: automation.turn_off data: entity_id: automation.garage_open_nobody_home diff --git a/components/packages/clever_announcements.yaml b/components/packages/clever_announcements.yaml index 069f85b..2b00414 100644 --- a/components/packages/clever_announcements.yaml +++ b/components/packages/clever_announcements.yaml @@ -45,7 +45,7 @@ script: content_id: '{{ iif(media_content_id is defined,media_content_id,"media-source://media_source/local/Sounds/tts/welcome_to_daddys_house.mp3") }}' content_type: '{{ iif(media_content_type is defined,media_content_type,"audio/mpeg") }}' volume: "{{ iif(volume is defined,volume,0.6) }}" - original_volume: '{{ iif(state_attr(state_attr("media_player.ytube_music_player","remote_player_id"), "volume_level") is not none,state_attr(state_attr("media_player.ytube_music_player","remote_player_id"), "volume_level"),0.0) }}' + original_volume: '{{ iif(is_state("media_player.ytube_music_player","off"),0.0,state_attr(state_attr("media_player.ytube_music_player","remote_player_id"), "volume_level")) }}' ytube_in_use: '{{ is_state("media_player.ytube_music_player","playing") or is_state("media_player.ytube_music_player","idle") or is_state("media_player.ytube_music_player","paused") }}' sequence: @@ -63,8 +63,7 @@ script: delay: hours: 0 minutes: 0 - seconds: 0 - milliseconds: 250 + seconds: 2 # This looks to cause the first part of the message to be missed. # Instead of initally muting the speakers, I'll just set them to the appropriate volume off the bat @@ -86,8 +85,7 @@ script: delay: hours: 0 minutes: 0 - seconds: 0 - milliseconds: 250 + seconds: 2 - alias: "Play the announcement" service: media_player.play_media @@ -113,14 +111,13 @@ script: - alias: Wait for the specified media_player(s) to become idle wait_for_trigger: - platform: template - value_template: "{{ is_state(media_player, 'idle') }}" + value_template: "{{ is_state(media_player, 'idle') or is_state(media_player, 'off')}}" - alias: "Give a second of dead air after the announcement" delay: hours: 0 minutes: 0 - seconds: 0 - milliseconds: 250 + seconds: 2 - choose: - alias: "Ytube music player was playing something earlier"