TeslaMate
Sürüş ve şarj verilerinizi TeslaMate'ten içe aktarın.
Normal bir Docker kurulumundan dışa aktarma
Bir kabukta TeslaMate dizininize gidin ve bu tek satırlık komutu çalıştırın:
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
Docker olmayan manuel bir kurulumdan dışa aktarma
Bir kabukta, kullanıcı adınızı ve veritabanı adınızı değiştirerek bu tek satırlık komutu çalıştırın:
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
İpucu: Bu komutu Unraid üzerinde çalıştırmak için önce Unraid panosunda Docker'ı ziyaret edin, ardından postgresql konteynerini seçin ve Console'u seçin.
Tessie'ye aktarın
Bu sayfayı ziyaret edin, TeslaMate Dışa Aktar'a tıklayın ve teslamate-export-00.csv.gz dosyasını seçin.
İşte bu kadar! Tessie tüm verilerinizi işleyecek ve işlem tamamlandığında bir e-posta alacaksınız. Araç geçmişinizin uzunluğuna bağlı olarak bu işlem birkaç saat sürebilir.
teslamate-export-01.csv.gz gibi ek dışa aktarma dosyaları varsa, bu dosyaların her birini sırayla içe aktarın.