Improved method for detecting last Alexa device

This commit is contained in:
2023-03-28 19:10:33 -04:00
parent d10489ce43
commit 36a59f54c5
6 changed files with 8 additions and 27 deletions

Submodule node-red/projects/NerdFlows updated: fce1603353...52e6913c0e

View File

@ -126,7 +126,7 @@ automation:
- service: script.kallen_desktop_wake
- service: script.status_annc
data:
who: "{{ states('sensor.last_alexa') }}"
who: "{{ states('sensor.last_alexa_entity_id') }}"
call_confirmation: 1
- if:
- condition: trigger
@ -134,7 +134,7 @@ automation:
then:
- service: script.status_annc
data:
who: "{{ states('sensor.last_alexa') }}"
who: "{{ states('sensor.last_alexa_entity_id') }}"
call_confirm_no: 1
- id: d1edfcf7-2712-49f4-b8f1-17f5b184b5ce
@ -168,7 +168,7 @@ automation:
then:
- service: script.status_annc
data:
who: "{{ states('sensor.last_alexa') }}"
who: "{{ states('sensor.last_alexa_entity_id') }}"
call_security_not_armed: 1
script:

View File

@ -167,22 +167,3 @@ mqtt:
sensor:
- name: "Room Presence"
state_topic: "house/presence/current_room"
sensor:
- platform: template
sensors:
alexa_audio:
friendly_name: "Alexa Audio"
value_template: >-
{%- if is_state('sensor.last_alexa', 'media_player.living_room_echo_dot') %}
Living Room Echo Dot
{% elif is_state('sensor.last_alexa', 'media_player.basement_echo_dot') %}
Basement Echo Dot
{% elif is_state('sensor.last_alexa', 'media_player.master_bedroom_echo_dot') %}
Master Bedroom Echo Dot
{% else %}
Living Room Echo Dot
{%- endif %}
last_alexa:
value_template: >
{{ states.media_player | selectattr('attributes.last_called','eq',True) | map(attribute='entity_id') | first }}

View File

@ -27,7 +27,7 @@ script:
sequence:
- service: script.status_annc
data:
who: "{{ states('sensor.last_alexa')}}"
who: "{{ states('sensor.last_alexa_entity_id')}}"
call_confirmation: 1
google_interjection:

View File

@ -1731,7 +1731,7 @@ script:
sequence:
- service: script.speech_engine_simplified
data:
who: '{{ states(''sensor.last_alexa'') }}'
who: '{{ states(''sensor.last_alexa_entity_id'') }}'
message: >
At {{ states('sensor.jarvis_last_msg_time') }}
in the {{ states('sensor.jarvis_last_location') }}

View File

@ -42,7 +42,7 @@ give_me_darkness:
text: <voice name='Brian'><prosody rate='150%'>Would you like me to arm
the security system?</prosody></voice>
event_id: actionable_notification_night_security_arm
alexa_device: '{{ states(''sensor.last_alexa'') }}'
alexa_device: '{{ states(''sensor.last_alexa_entity_id'') }}'
alias: Ask to arm security
alias: Ask to arm security if both adults are home
alias: If guest mode is off