So I posted about this in the Gitter chatroom and got a pretty solid response so I thought I would share this here as well. First, some screenshots of the completed setup.
Be advised that your TrafficLand cameras are going to stop working after the tokens expire. This is not a new thing for me and I discovered this a long time ago.
TrafficLand manages cams for a number of states and puts expiring tokens in so that they can protect their revenue stream. If you can grab cameras that are managed and controlled by your department of transportation, you’ll have much better results.
Sometimes news outlets traffic cameras will work as well - when I used to live in Pennsylvania, I had a mix of DOT and Local news channel cams available. They still work too.
@itchaboy do you mean the traffic map? I signed up for Mapbox free to get an API key, then I went to Static Map Maker and used their online tool to configure a map. Once that was done, I just grabbed the url they generate and popped it into my generic camera declaration.
@rpitera For my state, the DOT website had listed public traffic cameras which claim to have an expiration but the direct link to the image feed hasn’t expired for me after months of usage now.
Same thing with PennDOT. If they don’t use an outside contractor to serve/manage the cameras then you’ll be fine.
Unfortunately now I am in New Jersey and the state uses TrafficLand. The cameras are down more than they are up and when they are up, the URL works for about an hour. Then it expires.
Ouch. That would frustrate me personally as I tend to only use the traffic tab when I’m like 10 sec from jumping in my car and driving somewhere. Not about to sit there and diagnose a problem.
Traffic cams are the one thing missing from my setup that I have been unable to resolve since I started. I’m glad that others have them working but insanely jealous!! LOL
I have a card with Google travel times for the usual places I go to as a compromise, but damn I wish I could get the cams…
I like this approach, but it sure would be nice to have parameters in the generic camera component to rate-limit and time-bracket the image URL accesses. I guess I could do that via timed automations to trigger shell commands (wget/curl the remote image to a local file) but it would be so much more straightforward to just have it here in this component.
I don’t need a new traffic map every ten seconds, and I probably don’t need it at all between 11pm and 5am, so it would be nice not to hammer the servers unnecessarily.
If you look at one of cameras on the 511ny.org site, and right click to get the Image Address you will get something like: https://www.511ny.org/map/Cctv/2ml09170n--30#1500341050894
camera:
- platform: generic
still_image_url: https://www.511ny.org/map/Cctv/5161268--18#1499926002978
name: I-87 Between Exits 4 and 2 (Looking South)