diff --git a/ambient.d/trains/CZ_CD.fish b/ambient.d/trains/CZ_CD.fish new file mode 100644 index 0000000..671504c --- /dev/null +++ b/ambient.d/trains/CZ_CD.fish @@ -0,0 +1,13 @@ +ambient_is_ssid "CDWiFi"; or exit + +curl -s http://cdwifi.cz/portal/api/vehicle/realtime | jq -r '{ + "AMBIENT_CZ_CD_GPS_LAT": (.gpsLat), + "AMBIENT_CZ_CD_GPS_LNG": (.gpsLng), + "AMBIENT_CZ_CD_PREV_GPS_LAT": (.gpsLat), + "AMBIENT_CZ_CD_PREV_GPS_LNG": (.gpsLng), + "AMBIENT_CZ_CD_PREV_GPS_LNG": (.gpsLng), + "AMBIENT_CZ_CD_SPEED": (.speed), + "AMBIENT_CZ_CD_DELAY": (.delay), + "AMBIENT_CZ_CD_ALTITUDE": (.altitude), + "AMBIENT_CZ_CD_TEMPERATURE": (.temperature), +} | to_entries | map(select(.value != null)) | map(.key + "=" + (.value | tostring)) | join("\n")' diff --git a/widgets.d/trains/CZ_CD.fish b/widgets.d/trains/CZ_CD.fish new file mode 100644 index 0000000..4ec51f8 --- /dev/null +++ b/widgets.d/trains/CZ_CD.fish @@ -0,0 +1,3 @@ +if set -q AMBIENT_CZ_CD_SPEED + echo "💨 $AMBIENT_CZ_CD_SPEED km/h" +end