Next bus leaving in x minutes sensor

The local bus company here has a system where you can make your own personal departure screen.

I made a test screen here:

I think that the page gets the values from here:

but I’m not 100% sure as there seem to be multiple sources. I found the source by right click/inspect in Chrome.

Does anyone have an idea of how I can get the minute value for when the next bus is leaving into a Home Assistant sensor? Sometimes it only shows the time and no real time minute value, so that would have to work as well. I checked the scrape sensor but I can’t figure out the select html tag.

I got great help from a user on reddit:

It does indeed get the values from there, if you remove the callback part you’ll just get the JSON which you can put in a REST sensor.

Template should be something along the lines of (typing this blindly) {{ value_json[“PassingTimes”][0][“DisplayTime”] }}

That will get you the displaytime (text). To get an actual number out of it you should probably use the AimedTime and do some actual date processing on it.

Hope that helps someone who has a similar problem.