otsaloma / helsinki-transit-live

Real-time locations of HSL public transport vehicles

Home Page:https://openrepos.net/content/otsaloma/helsinki-transit-live

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use Digitransit API

otsaloma opened this issue · comments

Once ready enough for use.

As the new API includes much more vehicles, it might become necessary to filter by a particular stop or by saved favorites, which would imply it to be sensible to merge the map view into Helsinki Transit Stops, which already implements much of that.

If keeping Helsinki Transit Live as in independent application, consider abstracting the provider handling, allowing multiple providers to be used and activated individually.

Seems to work.

#!/usr/bin/env python3
import paho.mqtt.client as mqtt

def on_message(client, userdata, message):
    print(message.topic)
    print(message.payload.decode("utf_8", errors="replace"))

client = mqtt.Client()
client.on_message = on_message
client.connect("213.138.147.225", port=1883, keepalive=60)
client.subscribe("/hfp/journey/+/+/+/+/+/+/+/60;24/19/#")
client.loop_forever()

Mostly done in 66b29da, details remain.

Providers abstracted similar to how in Poor Maps, but no UI or config to switch providers. That can be added later if it makes sense.