Traffic info
With a traffic info block you can show Dutch traffic jams and roadworks, from RWS (Rijkswaterstaat)’s public traffic API. No API key is needed.
For public transport info see Public Transport.
A traffic info block shows one of two selections:
Everything within a distance (
filter: 'distance', the default): all announcements withinmaxDistancekm of a location.Selected roads (
filter: 'roads'): only the roads listed inroad, for example'A4, A17'. The roads are shown in that order, each with at mostresultsannouncements. Withshowemptyroadsa road without announcements is listed as well.
A traffic info block for selected roads can be configured as follows:
var trafficinfo = {}
trafficinfo.rwsA4A17 = {
trafficJams: true,
roadWorks: false,
filter: 'roads',
road: 'A4, A17',
showemptyroads: true,
show_lastupdate: true,
icon: 'fas fa-car',
width: 12,
results: 10 };
To show two roads in two separate blocks, define two blocks with one road each.
Using the Widget editor
In Wizard mode all options can be set in the Widget Config of the Traffic information widget (see Widget Config), without hand-writing a block: traffic jams, roadworks and radars, Show (Everything within a distance or Selected roads), the maximum number of results, and either the distance and location, or the Roads and Show roads without announcements.
Parameters
Parameter |
Description |
|---|---|
filter |
'distance': show everything within maxDistance (default)'roads': show only the roads in roadWithout
filter, a block with a road list uses 'roads', as in earlier versions. |
road |
The road(s) to show with
filter: 'roads', comma separated, in the order they are shown. Case and spaces don’t matter.'A1, A73' |
title |
Title of the block |
show_lastupdate |
|
maxDistance |
Only show items within this distance, in km straight-line, from |
latitude, longitude |
Reference location for
maxDistance. Leave both unset to use Domoticz’s own configured system location (Settings > System > Location) - only set these yourself if that isn’t configured. |
icon |
The font-awesome icon (including
fas fa-)'fas fa-car', … |
refresh |
time in seconds for refreshing the data |
results |
Number of results to show: per road with |
width |
To customize the width. It’s not recommended to change the default value ( |
trafficJams |
|
roadWorks |
|
radars |
|
showempty |
Control text to show in case of no traffic announcements
false: Don’t show a message in case of no traffic announcementstrue: Display default message in case of no traffic announcements'<text>': Display <text> in case of no traffic announcements |
showemptyroads |
Control text to show in case of no traffic announcements for a certain road (only applicable with
filter: 'roads')false: Don’t show a message in case of no traffic announcements for a certain road.true: Display default message in case of no traffic announcements for a certain road.'<text>': Display <text> in case of no traffic announcements for a certain road. |
url |
|
newwindow |
0: open in current window1: open in new window2: open in new frame (default, to prevent a breaking change in default behavior)3: no new window/frame (for intent handling, api calls). HTTP get request.4: no new window/frame (for intent handling, api calls). HTTP post request. (forcerefresh not supported) |
Styling
In case no info is available then the CSS class empty will be added to block.
This can be used to adjust the styling of an empty block via custom.css