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.
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.
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?
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.
thanks for this integration! i have set it up with radius but as i understand it, only one specific road (51) and that works for everything BUT trafikmeddelande. that includes all messages within the radius, but i can filter it in the card section. is this intended?
Traffic messages are currently not fully respecting the road filter configuration and do not display events from all roads. The reason is that the integration allows all events with safety_related_message == True to bypass the road filter, regardless of road.
The Trafikverket API sets this field for the majority of traffic message types, such as SpeedManagement and VehicleObstruction, which causes them to bypass the configured filter. Looking at this now, I agree that too many events are being allowed through.
I am working on a solution that combines a correct default behavior with a new configurable option, allowing users to choose how these messages should be handled. In addition, the safety_related_message value will be exposed for each event, and a sensor-level attribute will show the currently active configuration.
This will give users better control over how traffic messages tagged as safety_related_message by Trafikverket are handled.
Using the blueprint for notifications I would like to send messages to telegram since I think it works better for these kinds of notificiations. Would it be possible to handle those notifications as in regular automations with target etc. For telegram one is supposed to use notify.send_message and then target. This as far as I can tell doesnt work with the blueprint.
So I have updated to latest blueprint but automation is not triggering although it should. I only have extra services as notification service ie telegram bot. I have no notify mobile app service.
I can find the following at the timestamp in the log where it should trigger the automation.