Closed keithdw1972 closed 9 months ago
You say
Copied them to the docker container, in a 'temp folder.
and then
Copied the files into the ./import directory.
but the instructions say to "Copy the exported CSV files into a directory named import
next to the docker-compose.yml". That is on the docker host, not in the docker container. It gets mounted in the container by docker.
If that's not enough to solve it, then the output of:
docker exec teslamate-1 ls -la import
would be useful (replace teslamate-1 with the name of the TeslaMate container).
It's not explicitly called out, which is annoying, but you look at the filenames in the example in the docs and see they're all prefixed with "TeslaFi". If you rename your files by adding that prefix, but leave the rest of the filename as is, it should work.
However...you will likely need to edit every single line in your csv files to change the 5th field, "car id" I think, to a value of 1
to get them to import properly.
So, two tasks to import:
1) Rename all files to add TeslaFi
as a prefix
2) Add car id of 1
to field 5 in all rows of all csvs.
Note: DO NOT let excel modify the date format of the date fields or it'll also fail. Excel will do this automatically. I do not know how to prevent it. I used a text editor and regex to handle my car id field.
Thanks damccull, it now recognises that there are files to import. The import fails with an invalid date format now though:
2024-01-16 10:06:46.647 [error] Task #PID<0.2591.0> started from TeslaMate.Import terminating (MatchError) no match of right hand side value: {:error, {:invalid_date_format, "30/12/2022 22:32"}} (teslamate 1.28.2) lib/teslamate/import/line_parser.ex:80: TeslaMate.Import.LineParser.into_vehicle/3 (stdlib 5.1.1) maps.erl:416: :maps.fold_1/4 (teslamate 1.28.2) lib/teslamate/import/line_parser.ex:20: TeslaMate.Import.LineParser.parse/2 (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2 (elixir 1.15.7) lib/task/supervised.ex:36: Task.Supervised.reply/4 Function: &:erlang.apply/2 Args: [#Function<7.111590375/1 in TeslaMate.Import.create_event_streams/2>, [%{"charge_energy_added" => "", "outside_temp" => "", "elevation" => "", "rear_seat_heaters" => "", "fan_status" => "", "scheduled_charging_start_time" => "", "spoiler_type" => "", "id" => "", "max_range_charge_counter" => "", "locked" => "", "gui_temperature_units" => "", "battery_range" => "", "vin" => "", "idleNumber" => "0", "calendar_enabled" => "", "rhd" => "", "rear_seat_type" => "", "heading" => "", "seat_heater_right" => "", "charger_phases" => "", "outside_tempF" => "", "rerunning" => "0", "trip_charging" => "", "fast_charger_present" => "", "car_type" => "", "calendar_supported" => "", "gui_distance_units" => "", "driver_temp_setting" => "", "gps_as_of" => "", "right_temp_direction" => "", "notifications_supported" => "", "sun_roof_installed" => "", "api_version" => "", "seat_heater_rear_right_back" => "", "charging_state" => "", "gui_range_display" => "", "remote_start_enabled" => "", "seat_heater_rear_left_back" => "", "ft" => "", "eu_vehicle" => "", "df" => "", "charge_current_request_max" => "", "is_front_defroster_on" => "", "gui_charge_rate_units" => "", "valet_mode" => "", "pf" => "", "running" => "0", ...}]] 2024-01-16 10:06:46.647 [error] Task #PID<0.2590.0> started from TeslaMate.Import terminating (MatchError) no match of right hand side value: {:error, {:invalid_date_format, "30/12/2022 22:21"}} (teslamate 1.28.2) lib/teslamate/import/line_parser.ex:80: TeslaMate.Import.LineParser.into_vehicle/3 (stdlib 5.1.1) maps.erl:416: :maps.fold_1/4 (teslamate 1.28.2) lib/teslamate/import/line_parser.ex:20: TeslaMate.Import.LineParser.parse/2 (elixir 1.15.7) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2 (elixir 1.15.7) lib/task/supervised.ex:36: Task.Supervised.reply/4 Function: &:erlang.apply/2 Args: [#Function<7.111590375/1 in TeslaMate.Import.create_event_streams/2>, [%{"charge_energy_added" => "", "outside_temp" => "", "elevation" => "", "rear_seat_heaters" => "", "fan_status" => "", "scheduled_charging_start_time" => "", "spoiler_type" => "", "id" => "", "max_range_charge_counter" => "", "locked" => "", "gui_temperature_units" => "", "battery_range" => "", "vin" => "", "idleNumber" => "0", "calendar_enabled" => "", "rhd" => "", "rear_seat_type" => "", "heading" => "", "seat_heater_right" => "", "charger_phases" => "", "outside_tempF" => "", "rerunning" => "0", "trip_charging" => "", "fast_charger_present" => "", "car_type" => "", "calendar_supported" => "", "gui_distance_units" => "", "driver_temp_setting" => "", "gps_as_of" => "", "right_temp_direction" => "", "notifications_supported" => "", "sun_roof_installed" => "", "api_version" => "", "seat_heater_rear_right_back" => "", "charging_state" => "", "gui_range_display" => "", "remote_start_enabled" => "", "seat_heater_rear_left_back" => "", "ft" => "", "eu_vehicle" => "", "df" => "", "charge_current_request_max" => "", "is_front_defroster_on" => "", "gui_charge_rate_units" => "", "valet_mode" => "", "pf" => "", "running" => "0", ...}]] 2024-01-16 10:06:46.651 [error] GenStateMachine TeslaMate.Import terminating ** (FunctionClauseError) no function clause matching in anonymous fn/1 in TeslaMate.Import.create_event_streams/2 (teslamate 1.28.2) anonymous fn({:exit, {{:badmatch, {:error, {:invalid_date_format, "30/12/2022 22:21"}}}, [{TeslaMate.Import.LineParser, :into_vehicle, 3, [file: ~c"lib/teslamate/import/line_parser.ex", line: 80]}, {:maps, :fold_1, 4, [file: ~c"maps.erl", line: 416]}, {TeslaMate.Import.LineParser, :parse, 2, [file: ~c"lib/teslamate/import/line_parser.ex", line: 20]}, {Task.Supervised, :invoke_mfa, 2, [file: ~c"lib/task/supervised.ex", line: 101]}, {Task.Supervised, :reply, 4, [file: ~c"lib/task/supervised.ex", line: 36]}]}}) in TeslaMate.Import.create_event_streams/2
That's almost guaranteed to be because you opened it in Excel to add the 1 to the car id column and saved it. Excel saves dates in it's own format which is not going to match what the files originally had. That's why I mentioned that I used a regex find and replace in a text editor to do mine. Explaining that is beyond my available time though... You will need to find a way to edit the csv file without using Excel, or a way to tell excel to leave the existing date columns intact.
thats kinda what i expected you to say... ive redownloaded and checked the format, all fields 'appear' to be in the same format...
then again, i am using Excel for both (shrug)
thats kinda what i expected you to say... ive redownloaded and checked the format, all fields 'appear' to be in the same format...
then again, i am using Excel for both (shrug)
Open the raw csv in notepad or, better, vs code or another fancy editor instead of Excel. Excel will display the pretty date in the cell you see, but underneath converts it to an integer. It is likely the number of seconds since a specific time defined by Microsoft. Anyway, open a csv saved by Excel and the raw one from teslafi and look at the differences in the dates.
You can probably use any of the tons of free online or installed csv editors out there to do it though. Just Google "csv editor" and add "online" or your operating system.
It would be nice to see the importer updated to recognize the missing car id and sub in a default. If I knew anything about elixir I'd consider opening a pr, but I do not.
Miller is your friend here... although that involved remembering how to drive it!
All sorted... thanks for the help.
Is there an existing issue for this?
What happened?
Downloaded a years worth of TeslaFi csvs. Copied them to the docker container, in a 'temp folder. Stopped Teslamate container Copied the files into the ./import directory. Started the Teslamate container.
Expected Behavior
The documentation says to navigate to the /admin page of Teslamate and there will be an import screen, detailing the files.
Steps To Reproduce
Download TeslaFi csvs. Copied to the docker container, in a 'temp folder. Stopped Teslamate container Copied the files into the ./import directory. Start the Teslamate container.
Relevant log output
Screenshots
No response
Additional data
No response
Type of installation
Docker
Version
1.28.2