46 lines
1.6 KiB
Markdown
46 lines
1.6 KiB
Markdown
# TraccarOnICE
|
|
This is a small python script which allows you to send the location of the ICE you are currently in to your Traccar instance.
|
|
Most ICEs expose their current geolocation in the "WifiOnICE" network. This allows iceportal.de to show you a map with points of interest around you.
|
|
This also allows us to get a pretty good idea where the train is. This information can be collected and sent to a Traccar server.
|
|
|
|
I wrote this tool out of frustration, because my train journeys would never properly reflect in Traccar.
|
|
|
|
## Working prinicipal
|
|
The endpoint `https://iceportal.de/api1/rs/status` returns a json object with much interesting information:
|
|
```json
|
|
{
|
|
"connection": true,
|
|
"serviceLevel": "AVAILABLE_SERVICE",
|
|
"gpsStatus": "VALID",
|
|
"internet": "HIGH",
|
|
"latitude": 51.962427,
|
|
"longitude": 8.474433166666667,
|
|
"tileY": 218,
|
|
"tileX": -81,
|
|
"series": "412",
|
|
"serverTime": 1699645080972,
|
|
"speed": 192,
|
|
"trainType": "ICE",
|
|
"tzn": "ICE9223",
|
|
"wagonClass": "SECOND",
|
|
"connectivity": {
|
|
"currentState": "WEAK",
|
|
"nextState": "UNSTABLE",
|
|
"remainingTimeSeconds": 600
|
|
},
|
|
"bapInstalled": true
|
|
}
|
|
```
|
|
|
|
I request this information regularly, check if the location has changed (the iceportal is somewhat slow) and then send it off to Traccar.
|
|
Little transformation is needed. Only the speed has to be converted to knots, which is handeled in the script.
|
|
|
|
## Running it yourself
|
|
When on the go I often use Termux on Android to run the Python script.
|
|
There are two lines which need changing:
|
|
|
|
Line 19: Your Traccar-Server URL
|
|
|
|
Line 55: The identifier of your tracker
|
|
|
|
Then you can go ahead and run `python tracarOnIce.py` |