diff --git a/View_Assist_custom_sentences/Locate_a_Person/blueprint-locateaperson.yaml b/View_Assist_custom_sentences/Locate_a_Person/blueprint-locateaperson.yaml index 95da60f0f..dbf739545 100644 --- a/View_Assist_custom_sentences/Locate_a_Person/blueprint-locateaperson.yaml +++ b/View_Assist_custom_sentences/Locate_a_Person/blueprint-locateaperson.yaml @@ -1,6 +1,6 @@ blueprint: name: View Assist - Locate a Person - description: Ask Assist to locate a person (View Assist locateaperson v 1.0.1) + description: Ask Assist to locate a person (View Assist locateaperson v 1.1.0) domain: automation input: language: @@ -25,8 +25,7 @@ blueprint: defined_names: name: Defined Names description: > - This is the phonetic name followed by the Person's name as configured - in the Home Assistant settings + Phonetic name followed by the Person's name as configured in HA. default: >- {"john": "jon", "simon": "simon"} map_mode: @@ -39,26 +38,23 @@ blueprint: options: - dark - light - custom_value: false - multiple: false - sort: false + trigger: - - platform: conversation - command: - - !input command_prompt + platform: conversation + command: !input command_prompt + condition: [] -actions: + +action: - variables: target_satellite_device: "{{ view_assist_entity(trigger.device_id) }}" - target_mediaplayer_device: "{{ state_attr(target_satellite_device, 'mediaplayer_device')}}" target_satellite_device_type: "{{ state_attr(target_satellite_device, 'type')}}" - target_use_announce: "{{ state_attr(target_satellite_device, 'use_announce') }}" language: !input language view_locate: !input view_locate view_info: !input view_info map_mode: !input map_mode input_defined_names: !input defined_names - persons_name: "{{ input_defined_names | from_json}}" + persons_name: "{{ input_defined_names | from_json }}" translations: en: responses: @@ -93,29 +89,39 @@ actions: minute_label: "Minuten zuvor" hour_label: "Stunden zuvor" day_label: "Tage zuvor" + - if: - condition: template - value_template: "{% if trigger.slots.person in persons_name %}true{%endif%}" + value_template: "{{ trigger.slots.person | lower in persons_name.keys() | map('lower') | list }}" then: - variables: - person_source: "{{ 'person.' + persons_name[trigger.slots.person] }}" + # Case-insensitive lookup of the HA person ID + target_person_id: >- + {% set spoken = trigger.slots.person | lower %} + {% set ns = namespace(found='') %} + {% for k, v in persons_name.items() %} + {% if k | lower == spoken %}{% set ns.found = v %}{% endif %} + {% endfor %} + {{ ns.found }} + person_source: "{{ 'person.' + target_person_id }}" tracker_source: "{{ state_attr(person_source, 'source') }}" geocoded_source: >- - {% set geocoded = 'sensor.' + tracker_source.split('.', 1)[1] + '_geocoded_location' %} {{ geocoded }} + {% set geocoded = 'sensor.' + (tracker_source.split('.', 1)[1] if tracker_source else 'unknown') + '_geocoded_location' %} + {{ geocoded }} location_source: |- {% if states(person_source) != 'not_home' %} {{ state_translated(person_source)|capitalize }} - {% elif not states(geocoded_source) in ['unknown'] %} + {% elif states(geocoded_source) not in ['unknown', 'unavailable', 'None'] %} {{ states(geocoded_source) }} {% else %} {{ 'Unknown Location' }} {% endif %} conversation_response: |- {% if states(person_source) == 'not_home' %} - {{ translations[language]['responses']['person_away'].replace("{person}", persons_name[trigger.slots.person]) }} + {{ translations[language]['responses']['person_away'].replace("{person}", trigger.slots.person) }} {% else %} {{ translations[language]['responses']['person_location'] - .replace("{person}", persons_name[trigger.slots.person]) + .replace("{person}", trigger.slots.person) .replace("{location}", state_translated(person_source)) }} {% endif %} location_last_update_translated: |- @@ -125,7 +131,6 @@ actions: {% set minutes = (diff // 60) | int %} {% set hours = (diff // 3600) | int %} {% set days = (diff // 86400) | int %} - {% if minutes < 1 %} {{ translations[language]['last_update']['prefix']}}: {{ translations[language]['last_update']['now_label']}} {% elif minutes < 60 %} @@ -135,12 +140,13 @@ actions: {% else %} {{ translations[language]['last_update']['prefix']}}: {{ days }} {{ translations[language]['last_update']['day_label']}} {% endif %} - - set_conversation_response: "{{ conversation_response }}" + - action: view_assist.set_state target: entity_id: "{{ target_satellite_device }}" data: last_said: "{{ conversation_response }}" + - set_conversation_response: "{{ conversation_response }}" - action: view_assist.set_state target: entity_id: "{{ target_satellite_device }}" @@ -150,19 +156,21 @@ actions: geocoded_source, 'location_text': location_source, 'location_last_change': location_last_update_translated, 'map_mode': map_mode} }} + - if: - condition: template - value_template: >- - {% if target_satellite_device_type != 'audio_only' %}true{% else %}false{% endif %} + value_template: "{{ target_satellite_device_type != 'audio_only' }}" then: - - action: view_assist.navigate - data: - device: "{{ target_satellite_device }}" - path: "{{ view_locate }}" + - action: view_assist.navigate + data: + device: "{{ target_satellite_device }}" + path: "{{ view_locate }}" + else: + - stop: "Audio only device, navigation skipped" + else: - variables: - response_undefined: >- - {{ translations[language]['responses']['person_undefined'].replace("{person}", trigger.slots.person) }} + response_undefined: "{{ translations[language]['responses']['person_undefined'].replace('{person}', trigger.slots.person) }}" - action: view_assist.set_state target: entity_id: "{{ target_satellite_device }}" @@ -170,14 +178,17 @@ actions: title: "" message: "{{ response_undefined }}" message_font_size: 6vw + last_said: "{{ response_undefined }}" + - action: view_assist.navigate + data: + device: "{{ target_satellite_device }}" + path: "{{ view_info }}" - set_conversation_response: "{{ response_undefined }}" - action: view_assist.set_state target: entity_id: "{{ target_satellite_device }}" data: last_said: "{{ response_undefined }}" - - action: view_assist.navigate - data: - device: "{{ target_satellite_device }}" - path: "{{ view_info }}" + +## mode: single diff --git a/View_Assist_custom_sentences/View_Calendar/readme.md b/View_Assist_custom_sentences/View_Calendar/readme.md deleted file mode 100644 index 3bd156f62..000000000 --- a/View_Assist_custom_sentences/View_Calendar/readme.md +++ /dev/null @@ -1,3 +0,0 @@ -Temporary blueprint import - -[![Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.](https://my.home-assistant.io/badges/blueprint_import.svg)](https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https%3A%2F%2Fraw.githubusercontent.com%2Fdinki%2FView-Assist%2Frefs%2Fheads%2Fviewassist-calendar%2FView_Assist_custom_sentences%2FView_Calendar%2Fblueprint-viewcalendar.yaml) diff --git a/wiki/docs/extend-functionality/sentences/index.md b/wiki/docs/extend-functionality/sentences/index.md index ba36109c9..5a19f1824 100644 --- a/wiki/docs/extend-functionality/sentences/index.md +++ b/wiki/docs/extend-functionality/sentences/index.md @@ -7,26 +7,27 @@ View Assist is easily extendable by adding custom sentences which provide data t We encourage everyone to share their creations so that others might enjoy what you have brought to life. These user submitted blueprints can be found in the [Community Contribution](../../community-contributions/index.md) section of the wiki. -| Sentence | Description | -| --------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -| [Alarms Reminders & Timers](sentences/alarms-reminders-timers) | Allows for an on demand call to create and list alarms, reminders and timers | -| [Broadcast](sentences/broadcast) | Broadcast messages to other View Assist Satellites | -| [Device Alerts](sentences/device-alerts) | Automation builder used to do something with a VA satellite when something happens | -| [Device Functions](sentences/device-functions) | Extend device functions for media control, modes and repeat speech | -| [Get Sports Scores](sentences/get-sports-scores) | Get sports scores from US major sports teams and custom definitions | -| [How\'s the Weather](sentences/hows-the-weather) | Get current conditions and see the forecast on view enabled devices | -| [Locate a Person](sentences/locate-a-person) | Ask for the location of a family member and see it displayed on a map | -| [List Management](sentences/list-management) | Add, remove, show items from your shopping or to do list | -| [Play Music with Music Assistant](sentences/play-music-with-ma) | Play your music media using Music Assistant | -| [Play Radio with Music Assistant](sentences/play-radio-with-ma) | Play TuneIn radio using Music Assistant | -| [Search Wikipedia](sentences/search-wikipedia) | Search Wikipedia using voice and receive a response and image on view enabled devices | -| [Show Webpage](sentences/show-webpage) | Show your favorite website on your view enabled device | -| [Sound Machine](sentences/sound-machine) | Enables the user to play ambient sounds for relaxation or noise cancelation | -| [Spell a Word](sentences/spell-a-word) | Ask View Assist to spell a word and get a response back with the spelling | -| [Tell Me a Joke](sentences/tell-me-a-joke) | Request a joke and get ready to laugh | -| [Thank You](sentences/thank-you) | Show your gratitude and receive a kind reply | -| [Thermostat Control](sentences/thermostat-control) | Control the temperature of your thermostat by voice | -| [Travel Times by Waze](sentences/travel-times-by-waze) | Get realtime travel times using Waze | -| [View Calendar](sentences/view-calendar) | Show your calendar events by requesting by voice | -| [View Camera](sentences/view-camera) | Use voice to show your security cameras | -| [What time is it](sentences/what-time-is-it) | Get time and date by voice | +| Sentence | Description | Languages | +| --------------------------------------------------------------- | ------------------------------------------------------------------------------------- | -------------------------- | +| [Alarms Reminders & Timers](sentences/alarms-reminders-timers) | Allows for an on demand call to create and list alarms, reminders and timers | en | +| [Broadcast](sentences/broadcast) | Broadcast messages to other View Assist Satellites | en | +| [Device Alerts](sentences/device-alerts) | Automation builder used to do something with a VA satellite when something happens | en | +| [Device Functions](sentences/device-functions) | Extend device functions for media control, modes and repeat speech | en, de | +| [Get Sports Scores](sentences/get-sports-scores) | Get sports scores from US major sports teams and custom definitions | en, de, es, fr, it | +| [How\'s the Weather](sentences/hows-the-weather) | Get current conditions and see the forecast on view enabled devices | en, de, es, fr, it, nl, ro | +| [List Management](sentences/list-management) | Add, remove, show items from your shopping or to do list | en, de, fr, es, ro | +| [Locate a Person](sentences/locate-a-person) | Ask for the location of a family member and see it displayed on a map | en, de, it | +| [Play Music with Music Assistant](sentences/play-music-with-ma) | Play your music media using Music Assistant | en, de, pt, ro | +| [Play Radio with Music Assistant](sentences/play-radio-with-ma) | Play TuneIn radio using Music Assistant | en | +| [Search Wikipedia](sentences/search-wikipedia) | Search Wikipedia using voice and receive a response and image on view enabled devices | en, de | +| [Show Webpage](sentences/show-webpage) | Show your favorite website on your view enabled device | en | +| [Sound Machine](sentences/sound-machine) | Enables the user to play ambient sounds for relaxation or noise cancelation | en | +| [Spell a Word](sentences/spell-a-word) | Ask View Assist to spell a word and get a response back with the spelling | en, de, fr, it | +| [Thank You](sentences/thank-you) | Show your gratitude and receive a kind reply | en | +| [Thermostat Control](sentences/thermostat-control) | Control the temperature of your thermostat by voice | en, de | +| [Travel Times by Waze](sentences/travel-times-by-waze) | Get realtime travel times using Waze | en, de | +| [View Calendar](sentences/view-calendar) | Show your calendar events by requesting by voice | en | +| [View Camera](sentences/view-camera) | Use voice to show your security cameras | en | +| [What time is it](sentences/what-time-is-it) | Get time and date by voice | en, de, es, fr, it, nl | + +We are always looking for additional translations. Can you help? diff --git a/wiki/docs/extend-functionality/sentences/locate-a-person.md b/wiki/docs/extend-functionality/sentences/locate-a-person.md index 6aa1406f1..c06f0ddd4 100644 --- a/wiki/docs/extend-functionality/sentences/locate-a-person.md +++ b/wiki/docs/extend-functionality/sentences/locate-a-person.md @@ -25,7 +25,8 @@ All credit goes to @JimmyJamesBob and @colin715 for their collaboration on this ## Changelog -| Version | Description | -| ------- | ---------------------- | -| v 1.0.1 | Add German translation | -| v 1.0.0 | Initial release | +| Version | Description | +| ------- | ------------------------ | +| v 1.1.0 | Fix for case sensitivity | +| v 1.0.1 | Add German translation | +| v 1.0.0 | Initial release |