Code Monkey home page Code Monkey logo

Comments (7)

damccull avatar damccull commented on June 1, 2024 1

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.

from teslamate.

keithdw1972 avatar keithdw1972 commented on June 1, 2024 1

Miller is your friend here... although that involved remembering how to drive it!

All sorted... thanks for the help.

from teslamate.

dyxyl avatar dyxyl commented on June 1, 2024

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).

from teslamate.

damccull avatar damccull commented on June 1, 2024

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.

from teslamate.

keithdw1972 avatar keithdw1972 commented on June 1, 2024

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

from teslamate.

damccull avatar damccull commented on June 1, 2024

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.

from teslamate.

keithdw1972 avatar keithdw1972 commented on June 1, 2024

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)

from teslamate.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.