Trafikinfo SE, Real-time Swedish traffic alerts for Home Assistant

Hi everyone!

I’d like to share a new project I’ve been working on: Trafikinfo SE, a Home Assistant integration for Swedish traffic information from Trafikverket.

The integration lets you monitor real-time traffic events such as accidents, roadworks, restrictions, and important traffic messages directly in Home Assistant. Perfect if you want to get notified when something affects your daily commute, plan automations based on incidents, or simply keep an eye on the traffic situation in your area.

Home Assistant – Trafikinfo SE

Trafikinfo SE connects to Trafikverket’s open APIs and provides sensors for:

  • Accidents
  • Obstacles
  • Roadworks
  • Restrictions
  • Important traffic information
  • General traffic messages

You can use these sensors for notifications, automations, or dashboard visualization.

The integration can be installed via HACS as a custom repository.

4 Likes

Alongside the integration, I’ve also created a custom Lovelace card designed specifically to visualize traffic events in a clear and compact way on your Home Assistant dashboard.

I’m very interested in feedback from the community. Feature ideas, bug reports, and general thoughts are all more than welcome.

Hope this can make daily commuting and travel planning a bit smarter.

Happy automating!

2 Likes

This looks great. Will try it out in the coming days!

1 Like

So installed it. What’s the best way to get a notification with info for each new incident?

Something like this?

alias: Trafikolycka
trigger:
  - platform: event
    event_type: trafikinfo_se_olycka_incident
    event_data:
      change_type: added
action:
  - service: notify.mobile_app_din_telefon
    data:
      title: Trafikolycka!
      message: >
        {{ trigger.event.data.incident.message }} på {{ trigger.event.data.incident.road_number }} ({{ trigger.event.data.incident.road_name }}).
mode: single

I made a blueprint for notifications

Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.

1 Like

Added blueprint for notifiactions but havent had any incidents that would trigger it yet. However, how do I add other areas to monitor?

You need to make a entry for that area so it creates sensors for that

Tried it yesterday and didnt get it to work. Did the same today and woked fine. Thanks. Currently I am using map radius on web to determine what is included in radius. A feature that would be nice is to see the radius of the chosen distance visually when setting up the area to be monitored.

Also, setting up an area I can set it to a specific road. Thats great. So lets say I am interested in accidents on a specific highway i set that area to that highway name and as I understand it it will filter on that only. Then I set up an area for a city but that highway runs through that city, then I dont want to get notifications from the city notification and the highway notification when the areas overlap. Can I in a similar fashion exluded roads when setting up an area? Am i making sense?

Thanks for a great integration.

Home Assistant do not support displaying a radius in that way. The only place it seems possible is in the zone configuration. I looked into it, but I couldn’t find a good solution that didn’t require creating a zone first and then referencing that zone in the configuration, and that doesn’t feel optimal unfortunately.

You can specify more than one road within an area, so if you have a zone with, say, a 25 km radius around you, you can choose exactly which roads you want to include. Just separate them with commas in the configuration.

I haven’t added any support for exclusions, but there are ways to handle it. The simplest approach is probably to add a condition in your notification automation that checks the road attribute and makes sure it is not one of the specific roads you want to exclude.

The only time you need to create additional entries is when you want a different zone, for example around your cabin, your workplace, or similar, and it’s not covered by your current zone.

For example, I live in Gothenburg and have a 30 km radius, but only for the major roads around the city, and only when the accident has a high or very high impact.

1 Like

What’s the set update polling time in the new update?

I set 5 minutes when I could set it myself.

It is every 5 min

1 Like