TeslaMate
Zaimportuj dane dotyczące jazdy i ładowania z aplikacji TeslaMate.
Eksportuj z normalnej instalacji Docker
W powłoce przejdź do katalogu TeslaMate i uruchom to jednowierszowe polecenie:
docker-compose exec -T database psql -U $(docker-compose exec -T database env | grep POSTGRES_USER | cut -d"=" -f2) -d $(docker-compose exec -T database env | grep POSTGRES_DB | cut -d"=" -f2) -c "\copy (WITH positiondata AS(SELECT cars.vin, positions.date, positions.latitude, positions.longitude, positions.speed, positions.power, positions.odometer, positions.ideal_battery_range_km, positions.battery_level, positions.outside_temp, positions.is_climate_on, positions.inside_temp, positions.rated_battery_range_km, positions.usable_battery_level, NULL :: NUMERIC AS charge_energy_added, NULL :: NUMERIC AS charger_actual_current, NULL :: NUMERIC AS charger_phases, NULL :: NUMERIC AS charger_pilot_current, NULL :: NUMERIC AS charger_power, NULL :: NUMERIC AS charger_voltage, NULL :: BOOLEAN AS fast_charger_present, NULL AS conn_charge_cable, NULL AS fast_charger_brand, NULL AS fast_charger_type, ( SELECT B.version FROM updates B WHERE B.end_date <= positions.date AND B.car_id = positions.car_id ORDER BY B.end_date DESC LIMIT 1) AS version, Row_number() over ( PARTITION BY positions.car_id, (Cast(Extract(epoch FROM positions.date) AS INTEGER) / 10) ORDER BY positions.DATE ASC) AS rn FROM positions inner join cars ON cars.id = positions.car_id), chargingdata AS (SELECT cars.vin, charges.date, positions.latitude, positions.longitude, NULL :: SMALLINT AS speed, NULL :: SMALLINT AS power, NULL :: SMALLINT AS odometer, charges.ideal_battery_range_km, charges.battery_level, charges.outside_temp, NULL :: BOOLEAN AS is_climate_on, NULL :: NUMERIC AS inside_temp, charges.rated_battery_range_km, charges.usable_battery_level, charges.charge_energy_added, charges.charger_actual_current, charges.charger_phases, charges.charger_pilot_current, charges.charger_power, charges.charger_voltage, charges.fast_charger_present, charges.conn_charge_cable, charges.fast_charger_brand, charges.fast_charger_type, ( SELECT B.version FROM updates B WHERE B.end_date <= charges.date AND B.car_id = positions.car_id ORDER BY B.end_date DESC LIMIT 1 ) AS version, Row_number() over ( PARTITION BY charges.charging_process_id, (Cast(Extract( epoch FROM charges.date) AS INTEGER) / 10) ORDER BY charges.date ASC) AS rn FROM charges inner join charging_processes ON charging_processes.id = charges.charging_process_id inner join cars ON cars.id = charging_processes.car_id inner join positions ON positions.id = charging_processes.position_id) SELECT vin, date, latitude, longitude, speed, power, odometer, ideal_battery_range_km, battery_level, inside_temp, outside_temp, is_climate_on, rated_battery_range_km, usable_battery_level, charge_energy_added, charger_actual_current, charger_phases, charger_pilot_current, charger_power, charger_voltage, fast_charger_present, conn_charge_cable, fast_charger_brand, fast_charger_type, version FROM positiondata WHERE rn = 1 UNION SELECT vin, date, latitude, longitude, speed, power, odometer, ideal_battery_range_km, battery_level, inside_temp, outside_temp, is_climate_on, rated_battery_range_km, usable_battery_level, charge_energy_added, charger_actual_current, charger_phases, charger_pilot_current, charger_power, charger_voltage, fast_charger_present, conn_charge_cable, fast_charger_brand, fast_charger_type, version FROM chargingdata WHERE rn = 1 ORDER BY DATE ASC) TO 'teslamate.csv' csv header" && docker-compose exec -T database cat teslamate.csv > teslamate.csv && tail -n +2 teslamate.csv | split -d -l 1000000 - teslamate-export- && for file in teslamate-export-*; do head -n 1 teslamate.csv > tmp_file && cat "$file" >> tmp_file && mv -f tmp_file "$file.csv" && gzip "$file.csv" && rm "$file"; done
Eksport z ręcznej instalacji innej niż Docker
W powłoce uruchom to jednowierszowe polecenie, zastępując swoją nazwę użytkownika i nazwę bazy danych:
psql -U YOUR_USER_NAME -d YOUR_DB_NAME -W -c "\copy (WITH positiondata AS(SELECT cars.vin, positions.date, positions.latitude, positions.longitude, positions.speed, positions.power, positions.odometer, positions.ideal_battery_range_km, positions.battery_level, positions.outside_temp, positions.is_climate_on, positions.inside_temp, positions.rated_battery_range_km, positions.usable_battery_level, NULL :: NUMERIC AS charge_energy_added, NULL :: NUMERIC AS charger_actual_current, NULL :: NUMERIC AS charger_phases, NULL :: NUMERIC AS charger_pilot_current, NULL :: NUMERIC AS charger_power, NULL :: NUMERIC AS charger_voltage, NULL :: BOOLEAN AS fast_charger_present, NULL AS conn_charge_cable, NULL AS fast_charger_brand, NULL AS fast_charger_type, ( SELECT B.version FROM updates B WHERE B.end_date <= positions.date AND B.car_id = positions.car_id ORDER BY B.end_date DESC LIMIT 1) AS version, Row_number() over ( PARTITION BY positions.car_id, (Cast(Extract(epoch FROM positions.date) AS INTEGER) / 10) ORDER BY positions.DATE ASC) AS rn FROM positions inner join cars ON cars.id = positions.car_id), chargingdata AS (SELECT cars.vin, charges.date, positions.latitude, positions.longitude, NULL :: SMALLINT AS speed, NULL :: SMALLINT AS power, NULL :: SMALLINT AS odometer, charges.ideal_battery_range_km, charges.battery_level, charges.outside_temp, NULL :: BOOLEAN AS is_climate_on, NULL :: NUMERIC AS inside_temp, charges.rated_battery_range_km, charges.usable_battery_level, charges.charge_energy_added, charges.charger_actual_current, charges.charger_phases, charges.charger_pilot_current, charges.charger_power, charges.charger_voltage, charges.fast_charger_present, charges.conn_charge_cable, charges.fast_charger_brand, charges.fast_charger_type, ( SELECT B.version FROM updates B WHERE B.end_date <= charges.date AND B.car_id = positions.car_id ORDER BY B.end_date DESC LIMIT 1 ) AS version, Row_number() over ( PARTITION BY charges.charging_process_id, (Cast(Extract( epoch FROM charges.date) AS INTEGER) / 10) ORDER BY charges.date ASC) AS rn FROM charges inner join charging_processes ON charging_processes.id = charges.charging_process_id inner join cars ON cars.id = charging_processes.car_id inner join positions ON positions.id = charging_processes.position_id) SELECT vin, date, latitude, longitude, speed, power, odometer, ideal_battery_range_km, battery_level, inside_temp, outside_temp, is_climate_on, rated_battery_range_km, usable_battery_level, charge_energy_added, charger_actual_current, charger_phases, charger_pilot_current, charger_power, charger_voltage, fast_charger_present, conn_charge_cable, fast_charger_brand, fast_charger_type, version FROM positiondata WHERE rn = 1 UNION SELECT vin, date, latitude, longitude, speed, power, odometer, ideal_battery_range_km, battery_level, inside_temp, outside_temp, is_climate_on, rated_battery_range_km, usable_battery_level, charge_energy_added, charger_actual_current, charger_phases, charger_pilot_current, charger_power, charger_voltage, fast_charger_present, conn_charge_cable, fast_charger_brand, fast_charger_type, version FROM chargingdata WHERE rn = 1 ORDER BY DATE ASC) TO 'teslamate.csv' csv header" && tail -n +2 teslamate.csv | split -d -l 1000000 - teslamate-export- && for file in teslamate-export-*; do head -n 1 teslamate.csv > tmp_file && cat "$file" >> tmp_file && mv -f tmp_file "$file.csv" && gzip "$file.csv" && rm "$file"; done
Wskazówka: Aby uruchomić to polecenie w Unraid, najpierw odwiedź Docker na pulpicie nawigacyjnym Unraid, a następnie wybierz kontener postgresql i wybierz Console.
Importuj do Tessie
Odwiedź tę stronę, kliknij Import TeslaMate Export i wybierz teslamate-export-00.csv.gz.
To wszystko! Tessie przetworzy wszystkie Twoje dane, a po zakończeniu otrzymasz wiadomość e-mail. W zależności od długości historii Twojego pojazdu, proces ten może potrwać kilka godzin.
Jeśli istnieją dodatkowe pliki eksportu, takie jak teslamate-export-01.csv.gz, zaimportuj każdy z tych plików w kolejności.