tper-hellobus
by @lore2601
Get real-time and scheduled bus arrival times for TPER buses in Bologna and Ferrara, Italy. Use this skill whenever the user mentions TPER, bus stop codes (n...
clawhub install tper-hellobus-skillπ About This Skill
name: tper-hellobus description: Get real-time and scheduled bus arrival times for TPER buses in Bologna and Ferrara, Italy. Use this skill whenever the user mentions TPER, bus stop codes (numeric like 4476), bus line numbers (like 11 or 27), or asks about bus arrivals in Bologna or Ferrara. Trigger for queries about when buses arrive, checking bus schedules, or real-time bus tracking.
TPER Hellobus: Bologna & Ferrara Bus Times
This skill provides real-time and scheduled arrival information for TPER buses in Bologna and Ferrara by querying the official Hellobus API.
When to Use This Skill
Use this skill when the user:
How It Works
The skill queries the TPER Hellobus API with three parameters:
1. fermata (required): Numeric stop code (e.g., "4476", "8001") 2. linea (required): Bus line number (e.g., "11", "27", "101") 3. oraHHMM (optional): Time in HHmm format (e.g., "1830" for 6:30 PM)
Critical Logic:
oraHHMM is omitted or empty, the API returns real-time GPS tracking dataoraHHMM is provided, the API returns scheduled arrivals for that timeAPI Endpoint
GET https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus
Parameters:
fermata: Stop code (string, numeric)linea: Line number (string, numeric)oraHHMM: Time in HHmm format (string, optional - leave empty for real-time)Example API Calls:
Real-time tracking (GPS):
https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata=4476&linea=11&oraHHMM=
Scheduled times:
https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata=4476&linea=11&oraHHMM=1830
Response Format
The API returns a response like:
TperHellobus: 11B DaSatellite 18:02 (Bus1634 CON PEDANA), 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Components:
Implementation Steps
1. Parse User Input
Extract from the user's query:
2. Convert Time Format
If the user provides a time:
Time conversion examples:
3. Make API Request
Use the bash_tool with curl to call the API (web_fetch has URL restrictions):
# For real-time (no time specified):
curl "https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata={stop_code}&linea={line_number}&oraHHMM="For scheduled time:
curl "https://hellobuswsweb.tper.it/web-services/hellobus.asmx/QueryHellobus?fermata={stop_code}&linea={line_number}&oraHHMM={time_hhmm}"
Important: Ensure proper URL encoding and handle the XML/text response from the API.
4. Parse and Format Response
The API response is plain text. Parse it and format as a bullet list:
Input: TperHellobus: 11B DaSatellite 18:02 (Bus1634 CON PEDANA), 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Output format:
Bus arrivals for line 11 at stop 4476:
β’ 11B DaSatellite 18:02 (Bus1634 CON PEDANA)
β’ 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Split on commas and present each arrival as a bullet point.
5. Error Handling
If the API returns an error or unexpected response:
Common errors might include:
User Interaction Examples
Example 1: Real-time tracking
User: "When is the next bus 11 arriving at stop 4476?"
Claude: [Queries API with oraHHMM empty]
Response:
Bus arrivals for line 11 at stop 4476 (real-time):
β’ 11B DaSatellite 18:02 (Bus1634 CON PEDANA)
β’ 11B DaSatellite 18:18 (Bus5504 CON PEDANA)
Example 2: Scheduled time
User: "Check the schedule for bus 27 at stop 8001 for 6:30 PM"
Claude: [Queries API with oraHHMM=1830]
Response:
Bus arrivals for line 27 at stop 8001 at 18:30:
β’ 27 Orario 18:35 (Bus2045)
β’ 27 Orario 18:50 (Bus3012)
Example 3: Error handling
User: "Bus 99 at stop 1234"
Claude: [Queries API, receives error]
Response: "I couldn't find bus 99 at stop 1234. Please verify the stop code and line number are correct for the TPER network."
Important Notes
Testing
Test cases to verify the skill works: