Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down Expand Up @@ -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: |-
Expand All @@ -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 %}
Expand All @@ -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 }}"
Expand All @@ -150,34 +156,39 @@ 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 }}"
data:
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
3 changes: 0 additions & 3 deletions View_Assist_custom_sentences/View_Calendar/readme.md

This file was deleted.

47 changes: 24 additions & 23 deletions wiki/docs/extend-functionality/sentences/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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?
9 changes: 5 additions & 4 deletions wiki/docs/extend-functionality/sentences/locate-a-person.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 |