Conky, when is my next bus ?

Tisseo (Toulouse’s public transport operator) have an API which can be used to get real time bus at a stop (among plenty of others features). So I requested the access (it’s free but you have to register) and now I can play with it.

I thought that a nice application would be to display the next bus using Conky (conky is a highly customizable software running on linux to display information on your desktop).

Here is the result :

A screenshot of my conky on my desktop

A screenshot of my conky on my desktop

I also added the data from JC Decaux’s API about their self-service bike.

For those wondering how I did here is a quick explanation : every 10 seconds, conky is executing a php script which will gather the data from the API and return what will be displayed on conky.

Here is the line on conky calling the script :

${execpi 10 php ~/.conky/php/bus.php}

And here is the php script gathering data from JC Decaux :


//put here your API key
$key = "key";

//name of the contract, toulouse in my case
$contract_name = "toulouse"; 

// Name of the station => ID of the station
$to_look = array("Fac de Pharma"=>228,"ENAC"=>223,"CNRS"=>237); 

foreach($to_look as $nom=>$id) //display every station in $to_look
	$link = "".$id."?contract=".$contract_name."&apiKey=".$key;
	$result = file_get_contents($link); //making the request
	$result = json_decode($result,true); //decoding

	echo('${offset 30}${color DDDDDD}'.$nom.' - '.$result["available_bikes"].' vélos & '.$result["available_bike_stands"]. ' stands');


I hope that this will give ideas to others !

Leave a comment

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s