TeslaMate
Importați datele de conducere și de încărcare din TeslaMate.
Exportați dintr-o instalare Docker normală
Într-un shell, navigați în directorul TeslaMate și rulați această comandă de o linie:
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
Exportați dintr-o instalare manuală non-Docker
Într-un shell, rulați această comandă de o linie, înlocuind numele de utilizator și numele bazei de date:
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
Sfat: Pentru a rula această comandă pe Unraid, vizitați mai întâi Docker în tabloul de bord Unraid, apoi selectați containerul postgresql și selectați Console.
Importați în Tessie
Accesați această pagină, faceți clic pe Import TeslaMate Export și selectați teslamate-export-00.csv.gz.
Asta e! Tessie va procesa toate datele dvs. și veți primi un e-mail atunci când va fi gata. În funcție de lungimea istoricului vehiculului dumneavoastră, acest proces poate dura câteva ore.
Dacă există fișiere de export suplimentare, cum ar fi teslamate-export-01.csv.gz, importați fiecare dintre aceste fișiere în ordine.