with the help of Petro, Taras and google translate I try to share one of my automation that provides me with notifications, even TTS, if and when my shipments have some type of update: example … 'your parcel with the new one Raspberry is currently at Hong Kong airport ‘, or’ just arrived with the new drill '…
requirements:
1: open an account on 17track.net where to record the codes of your shipments and a friendly name to recognize the package
2: add 17track integration on Home assistant
3: activate a notification service on the Home assistant. To get voice notifications (TTS) to your phone, I recommend Lannouncer ( which only works locally) or Ariela (for those who can access HA also remotely … good app also for the device tracker). For the TTS directly from the raspberry instead I use Mopidy
4: only for Lannouncer, you should set a fixed IP address for your smartphone
on configuration.yaml set this:
# TTS mopidy
tts:
- platform: google_translate
time_memory: 57000
language: 'xx' # language code
# notify Lannouncer
notify:
- platform: lannouncer
name: ttslannouncer
host: 192.168.1.121 # your smartphone static IP
port: 1035
on Automations.yaml
- id: 'packages in transit'
alias: packages in transit
trigger:
- entity_id: sensor.seventeentrack_packages_in_transit
platform: state
condition:
action:
- condition: time
after: '08:00:00'
before: '23:50:00'
- service: tts.google_translate_say # TTS with Mopidy on Raspberry
entity_id: media_player.mpd
data_template:
message: >
{% set ns = namespace(items = 'update on the packages you are waiting for: ') %}
{% for item in state_attr('sensor.seventeentrack_packages_in_transit', 'packages') %}
{% set ns.items = ns.items ~ 'the package with {}: is in {}, '.format(item.friendly_name, item.info_text) %}
{% endfor %}
{{ns.items}}
- service: mqtt.publish # TTS with Ariela
data_template:
topic: 'homeassistant/tts/yourphonenamebyariela_tts/tts' # see TTS voice on Ariela settings
payload_template: >
{% set ns = namespace(items = 'update on the packages you are waiting for: ') %}
{% for item in state_attr('sensor.seventeentrack_packages_in_transit', 'packages') %}
{% set ns.items = ns.items ~ 'the package with {}: is in {}, '.format(item.friendly_name, item.info_text) %}
{% endfor %}
{{ns.items}}
- id: 'packages delivered'
alias: packages delivered
trigger:
- entity_id: sensor.seventeentrack_packages_delivered
platform: state
action:
- condition: time
after: '08:00:00'
before: '23:50:00'
- service: notify.ttslannouncer # lannouncer notifications only work locally
data_template:
message: "package delivered with {{ state_attr('sensor.seventeentrack_packages_delivered', 'packages') | map(attribute='friendly_name') | list | first }}"
- service: tts.google_translate_say
entity_id: media_player.mpd
data:
message: "you just got a package"
I hope it can be useful to someone!