Hi all,
this is my first post here ![]()
I created a blueprint, to run an action (most likely to send a notification to your phone) in case the travel time is bigger than a specified threshold.
I hope someone finds it useful.
As I am new here, i am not allowed to put more than 2 links inside. So I can’t link my Gist. In this case, the code is the following:
blueprint:
name: Notifications for travel time
description: >
Send a notification or do something in case the value of the travel time is greater than
the configured threshold. Also date and time for the trigger is configurable.
domain: automation
input:
threshold_time:
name: Threshold for notification
description: Threshold for notifications in minutes
default: 25
selector:
number:
min: 1
max: 100
unit_of_measurement: min
mode: slider
step: 1
travel_time_sensor:
name: Travel Time Sensor
description: Sensor which indicates the travel time.
selector:
entity:
domain: sensor
zone_entity:
name: Zone
description: In which zone a person must be, to get the notification.
selector:
entity:
filter:
domain: zone
person_entity:
name: Person
description: Which person must be in the zone to get the notification.
selector:
entity:
filter:
domain: person
actions:
name: Actions for travel time
description: Actions to run when the travel time is bigger than the threshold.
selector:
action: {}
trigger_time:
name: Trigger Time
description: Time to trigger the action (in HH:MM format).
default: "06:15"
selector:
text: {}
trigger_days:
name: "Weekdays"
description: "Days of the week to run"
default:
- mon
- tue
- wed
- thu
- fri
selector:
select:
multiple: true
options:
- label: "Monday"
value: "mon"
- label: "Tuesday"
value: "tue"
- label: "Wednesday"
value: "wed"
- label: "Thursday"
value: "thu"
- label: "Friday"
value: "fri"
- label: "Saturday"
value: "sat"
- label: "Sunday"
value: "sun"
trigger:
- platform: time
at: !input trigger_time
condition:
- condition: time
weekday: !input trigger_days
- condition: zone
entity_id: !input person_entity
zone: !input zone_entity
- condition: numeric_state
entity_id: !input travel_time_sensor
attribute: duration
above: !input threshold_time
actions:
- choose: []
default: !input actions
Installation
Option 1: Direct Import (Recommended)
- Click the badge below to import the blueprint directly into your Home Assistant instance.
- Click “Preview Blueprint” and then “Import Blueprint”.
Option 2: Manual Installation
- Copy the code from the
.yamlfile. - Go to your Home Assistant config folder:
/config/blueprints/automation/floo33r/. - Create a file named
traveltime-notification.yamland paste the code. - Go to Developer Tools → YAML → Reload Automations.
How it works.
The blueprint is triggered time base. When the time is reached, it checks if the person is in the right zone and if the weekday is the correct one. Afterwards, in case the travel time is higher than usual, it runs an action.
How to configure it
- Configure a value, on which the notification should be send. For example if everything is as usual, no notification is needed.
- Select the travel time sensor. In my case I used the Waze Travel Time Integration. Just make sure to use coordinates, otherwise it happend for me, that the error
Connection failedappeared. - Create a zone, in which you must be to trigger the notification. For example, when you are abroad or on a business trip, the notification is not needed.
- Select the person, which must be in the zone.
- Select an action. In my case I used a push notification via the App.
- Select a time, when to check for the triggers.
- Select on which days it’s needed. In case you are only working part time, this is useful.
One more tip. In case you want to display the actual travel time in the notification, the following message template can be useful:
The actual travel time is {{ states('sensor.waze_travel_time_2_work') | float | round(1) }} minutes.
Thanks for reading! I would appreciate any feedback.