Smart Commute Dashboard in Home Assistant

This guide covers how to create a live dashboard card that calculates your exact departure times for college drop-offs and pick-ups. It uses Waze for live traffic data and a shared Google Calendar to automatically find the start of the first class and the end of the last class each day.

Phase 1: Configure Live Traffic (Waze)

First, we need to set up a sensor that tracks the live driving time between your house and the college.

  1. Go to Settings > Devices & Services in Home Assistant.
  2. Click + Add Integration and search for Waze Travel Time.
  3. In the setup window:
    • Origin: Enter zone.home (or your specific starting address).
    • Destination: Enter the address of the college.
    • Region: Select your local region.
  4. Click Submit. This will generate a new sensor, typically named sensor.waze_travel_time.

Phase 2: Connect the Class Schedule

Next, import the shared schedule using the Remote Calendar integration, which bypasses the need for full Google account authorization.

  1. On your computer, open Google Calendar, click the three dots next to the shared calendar, and select Settings and sharing.
  2. Scroll to the Integrate calendar section and copy the Secret address in iCal format (ensure it ends in .ics).
  3. In Home Assistant, go to Settings > Devices & Services and click + Add Integration.
  4. Search for Remote Calendar.
  5. Give it a descriptive name (e.g., “College Schedule”) and paste your .ics link into the URL field.
  6. Click Submit. Note the exact entity ID this creates (e.g., calendar.college_schedule).

Phase 3: Create the Departure Sensors

To calculate the drop-off and pick-up times based on the first and last events of the day, you must use a trigger-based template in your configuration files.

  1. Open your configuration.yaml file using the File Editor or Studio Code Server add-on.
  2. Paste the following YAML block. Important: Replace calendar.college_schedule with the exact entity ID of your new remote calendar.

YAML

template:
- trigger:
# Updates every 15 minutes to keep travel time fresh
- platform: time_pattern
minutes: "/15"
# Updates instantly if the calendar changes
- platform: state
entity_id: calendar.college_schedule
action:
# Fetches all events for today
- action: calendar.get_events
target:
entity_id: calendar.college_schedule
data:
start_date_time: "{{ today_at('00:00') }}"
end_date_time: "{{ today_at('23:59') }}"
response_variable: agenda
sensor:
- name: "Leave for Drop-off"
icon: mdi:car-arrow-right
state: >
{% set events = agenda['calendar.college_schedule']['events'] %}
{% set travel = states('sensor.waze_travel_time') | int(0) %}
{% if events | length > 0 and travel > 0 %}
{% set first_start = events[0].start | as_datetime %}
{{ (first_start - timedelta(minutes=travel)).strftime('%-I:%M %p') }}
{% else %}
No classes today
{% endif %}
- name: "Leave for Pick-up"
icon: mdi:car-arrow-left
state: >
{% set events = agenda['calendar.college_schedule']['events'] %}
{% set travel = states('sensor.waze_travel_time') | int(0) %}
{% if events | length > 0 and travel > 0 %}
{% set last_end = events[-1].end | as_datetime %}
{{ (last_end - timedelta(minutes=travel)).strftime('%-I:%M %p') }}
{% else %}
No classes today
{% endif %}
  1. Save the file.
  2. Go to Settings > System > Quick Reload (or click the power icon in the top right and select “Reload All YAML”) to activate the new sensors.

Note: Trigger-based sensors will display as “Unknown” immediately after a reload. They will populate with actual times the next time the 15-minute interval hits, or if you manually change the state of the calendar entity in Developer Tools to force an update.

Phase 4: Build the Dashboard UI

Finally, combine everything into a single, clean card on your dashboard.

  1. Navigate to your dashboard and click the pencil icon in the top right to enter edit mode.
  2. Click + Add card in the bottom right corner and select the Entities card.
  3. Set the Title to something relevant (e.g., “College Runs”).
  4. Add the following three entities to the card:
    • sensor.waze_travel_time (ETA to College)
    • sensor.leave_for_drop_off
    • sensor.leave_for_pick_up
  5. Click Save to place the finished grouping on your dashboard.

Creating a repeating end of month event in Google Calendar

Simply create an ICS file and import it into Google Calendar:

BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
RRULE:FREQ=MONTHLY;INTERVAL=1;BYSETPOS=-1;BYDAY=SU,MO,TU,WE,TH,FR,SA
SUMMARY:Timesheets
DTSTART:20240930T110000Z
DTEND:20240930T110000Z
SEQUENCE:0
DESCRIPTION:Timesheets and Invoices
END:VEVENT
END:VCALENDAR

Configuring Synology NAS to Access Another NUT Server for Power Management

If you’re using a Synology NAS in your home or business environment and you want it to access a Network UPS Tools (NUT) server for power management, there are some essential configuration steps to take. NUT is a popular tool used to manage and monitor uninterruptible power supplies (UPS), especially in networked environments where a single UPS is shared by multiple devices.

In this guide, we’ll walk you through configuring your NUT server to allow access from your Synology NAS.

Why Use NUT for Synology NAS?

Synology NAS devices can connect to a UPS for protection during power outages. By using a NUT server, multiple devices (including your NAS) can share one UPS unit over the network. This setup ensures that all critical systems are protected and can be safely powered down when the UPS battery runs low during a power outage.

However, to make your Synology NAS communicate with a remote NUT server, proper configuration on the NUT server is required. This involves editing the upsd.users and ups.conf files.

Step-by-Step Configuration

1. Configuring upsd.users

To allow your Synology NAS to monitor the UPS, you must add a user entry to the upsd.users configuration file on your NUT server. This file contains user credentials and permissions for accessing the UPS data.

To create a user that your Synology NAS can use to connect to the NUT server, open your upsd.users file on the server (usually located in /etc/nut/upsd.users), and add the following block:

[monuser]
    password = secret
    upsmon secondary

Let’s break this down:

  • [monuser]: This is the username that your Synology NAS will use to connect to the NUT server.
  • password = secret: Synology defaults to secret – you can probably hack around on the NAS to change this.
  • upsmon secondary: This line grants the user monuser the upsmon rights in “secondary” mode. The “secondary” mode means that this client (in this case, the Synology NAS) can monitor the UPS but is not responsible for controlling or shutting down the UPS.

2. Configuring ups.conf

Next, you’ll need to configure the UPS settings in ups.conf. This file tells the NUT server the name of the UPS device it is managing. On the NUT server, open the ups.conf file (usually located in /etc/nut/ups.conf) and set the UPS name like this:

[ups]
    driver = your_driver
    port = your_port
    desc = "UPS Description"

Here’s what the parameters mean:

  • [ups]: This is the name of the UPS device that will be shared with the Synology NAS. Synology expects the UPS to be named ups, so this is important to get right.
  • driver: Replace your_driver with the specific driver that works with your UPS (e.g., usbhid-ups for USB-based UPS units).
  • port: Replace your_port with the actual port your UPS is connected to (e.g., /dev/usb/hiddev0 for USB devices or a network address if it’s a network-connected UPS).
  • desc: This is a description of the UPS. It can be anything you like, such as "Main Office UPS".

After configuring these files, restart the NUT services on your NUT server to apply the changes:

sudo systemctl restart nut-server
sudo systemctl restart nut-monitor

3. Configuring the Synology NAS

On your Synology NAS, go to Control Panel > Hardware & Power > UPS and choose Synology UPS server. Enter the IP address of the NUT server (the server where you’ve configured upsd.users and ups.conf).

Once this is configured, your Synology NAS will begin monitoring the UPS through the NUT server.

Final Thoughts

Setting up your Synology NAS to access a NUT server is an excellent way to ensure that all your critical devices are connected to the same UPS over the network. By configuring the upsd.users and ups.conf files correctly, you can seamlessly integrate your Synology NAS into the NUT-powered power management setup.

Remember that while the Synology NAS will act as a secondary UPS monitor, you can have other devices or the NUT server itself act as the primary controller responsible for managing UPS shutdowns and other actions. This division of roles ensures that your network remains stable and that all systems are safely powered down in the event of a power outage.

This simple yet powerful configuration can protect your data and equipment from sudden power failures, keeping your network running smoothly.