Commit Graph

627 Commits

Author SHA1 Message Date
Wilfried Chauveau 0db778e06c feat: Update TeslaFi importer to accept newer export formats (#3431)
* Update TeslaFi importer to accept newer export formats

* Update documentation
2024-05-24 09:01:50 +02:00
Jakob Lichterfeld 10995a3ce5 Revert "Dynamic endpoints and token to use official Tesla API (self-hosted or from third party provider) (#3866)"
This reverts commit 263f207dc9.
2024-05-20 14:07:26 +02:00
jlestel 263f207dc9 Dynamic endpoints and token to use official Tesla API (self-hosted or from third party provider) (#3866)
* feat: endpoints by env

* fix: typo

* fix: useless env

* fix: format

* fix: distinct auth domain and url

* format

* fix: force issuer url if needed

* feat: new streaming based on vin

* fix refresh

* revert

* up

* feat: no need for access token / refresh token if the TOKEN env var is present

* feat: update login if token env var exists

* feat: add ENV var to allow insecure wss

* fix: remove TESLA_CN

* fix(naming): TESLA_API_URL to TESLA_API_DOMAIN

* feat: add an env var to allo invalid certs on WSS

* doc: add API domains env vars description

* fix: typo

* feat: add env var to change log level

* fix: APP_LOG_LEVEL

* feat: add TOKEN documention and wording

* fix: refacto insecure param

* feat: naming and doc

* fix: missing env var usage

---------

Co-authored-by: Julien <julien@citio.digital>
2024-05-20 13:11:13 +02:00
dyxyl 7a5625f09f fix: errors from Timex.Timezone.local() during switchover to DST. (#3848)
* Fix errors from Timex.Timezone.local() during switchover to DST.

* Update the gettext files to match.
2024-04-17 14:49:41 +02:00
Brian May c684252940 Publish extra active_route fields to mqtt output (#3789)
This refactors the existing code to make it more maintainable.

Nil values are published as "nil" string. This ensures that they will
get published, and ensures that MQTT doesn't drop the retained data.

Fixes #3748
2024-04-05 17:29:00 +11:00
b1c1l1 97cfb79493 feat: Add URL_PATH environment variable for reverse proxy deployments (#3771)
* Add URL_PATH environment variable for reverse proxy deployments

For example, this can be used to run TeslaMate behind a reverse proxy, using a
URL path such as "/teslamate".

* gettext: update pot and po files

Generated using:
  mix gettext.extract --merge

* web: run mix format

* gettext: update pot and po files

Re-generating gettext files after running mix format.

Generated using:
  mix gettext.extract --merge
2024-03-25 09:21:34 +01:00
Brian May 2b5cdbdffd Add nix flake (#3485)
This will add support for nix flakes. Which really helps with my
development on nixos. This has two basic parts:

1. DEVELOPMENT

After this you can use the following commands on computer with nix and a
patched version of direnv:

direnv allow
devenv up

And it will automatically start and instance of postgresql and mosquitto
for development.

And the environment variables are already configured for teslamate.

So then can start teslamate with:

npm install --prefix ./assets && npm run deploy --prefix ./assets
iex -S mix phx.server

This part is all working as designed. And pretty simple and straight
forward.

2. NIX PACKAGE OF TESLA

This is 99% complete, but some pain points I haven't addressed yet.
Because I don't yet know of good solutions.

* There are two checksums in flake.nix that needs to be updated whenever
  mix.lock or package-lock.json changes.
2024-03-19 09:37:17 +01:00
Brian May b5285d2ace Add location topic (lat and long in one json blob) (#3729)
* Add location topic

Fixes #3660.

* doc: update mqtt topics with new location topic

---------

Co-authored-by: Jakob Lichterfeld <jakob-lichterfeld@gmx.de>
2024-03-18 08:36:21 +01:00
Brian May cdd6298f55 Replace tortoise library with tortoise311 (#3697) 2024-03-16 11:55:04 +01:00
Michael Vestergaard 46b971070a Fix agressive switch to offline when stream gets offline message (#3672)
* Changed when stream reports offline to fetch data and let result decide the real state instead of switching directly to offline.

* Adjusted test
2024-03-16 11:52:55 +01:00
Long Zheng 78fe8116ad Add navigation active route drive state data (#3657)
* Add navigation active route drive state data

* Add active_route data to MQTT

* Update MQTT documentation

* Fix streaming test drive state
2024-02-08 08:45:42 +01:00
marvelm da819054f6 feat: Upgrade web development framework to Phoenix 1.7 (#3615)
* Upgrade to phoenix 1.7.0
The minimal changes necessary to compile the application

* Import Phoenix.Component instead of LiveView

* Fix compilation warnings

* mix format

* Update tests to trim newline characters

* mix gettext.extract --merge

* style: correct linting

* rebuild gettext

* fix: correct spacing before unit for energy added

* fix: use unicode character for whitespace

* fix: spacing with witespace

* fix: use numeric value for charge_energy_added in charging test

* fix: avoid warning about unsued function, which is actually used in plug

* fix: use whitespace in test before charge_energy_added

---------

Co-authored-by: JakobLichterfeld <jakob-lichterfeld@gmx.de>
2024-02-07 19:23:53 +01:00
JakobLichterfeld a09a7fa30c fix: use product api endpoint to fetch vehicles (#3630)
* fix: use product api endpoint to fetch vehicles

* feat: add handle_response function in Vehicle module to filter for only vehicles in products api endpoint

* style: correct linting
2024-02-02 09:09:35 +01:00
Nir Klinger 00a704b394 Added expected finish charging localtime to teslamate site (#3646)
* Added expected finish charging localtime to teslamate site

* format text

* fixing indentation

* fixing indentation

* format text

* Remove UTC timezone and use the local timezone
2024-02-02 09:08:46 +01:00
Michael Vestergaard 1857f25d0f Handle stream getting the message "Vehicle is offline" and change the state to offline in vehicle (#3508) 2024-01-19 14:09:59 +01:00
Nir Klinger b5fa0242a3 Fix an issue when car is could enter sleep mode while dog mode is enabled (#3538)
* Fix an issue when car is could enter sleep mode while dog mode is enabled.

* Update pot files

* revert change

* Fix tests

* Fix tests and issue when try to sleep was not showing

* Fix lint issue
2023-12-12 13:18:03 +01:00
Brian May b643b45ca0 Add charging_state to VehicleSummary (#3471)
* Add charging_state to VehicleSummary

Fixes: #3078

* WIP
2023-11-23 09:06:51 +01:00
JakobLichterfeld b03783be9c Revert "Add charging_state to VehicleSummary (#3087)" (#3468)
This reverts commit 6d0405dbff. as it breaks the elixir test cases
2023-11-20 18:55:17 +01:00
Brian May 6d0405dbff Add charging_state to VehicleSummary (#3087)
Fixes: #3078
2023-11-16 16:20:11 +01:00
libotony c520af5732 ui: sync meta theme-color with header background color (#2840) 2023-11-16 08:49:22 +01:00
Nir Klinger fba87d7e88 added tire low pressure icon to teslamate web (#3424)
* added tire low pressure icon to teslamate web

* updated new fields to mqtt md

* Update default.pot and errors.pot
2023-11-13 19:07:03 -06:00
Adrian Kumpf 9df62aee54 Update repo URL 2023-11-12 19:30:36 +01:00
Adrian Kumpf b545eaf8f4 Remove donation links 2023-11-12 19:26:52 +01:00
Adrian Kumpf 2ac9ac49bd Update srtm to 0.8.0 2023-11-12 19:12:47 +01:00
Adrian Kumpf faa002bab4 Trim geo fence name 2023-11-12 17:51:28 +01:00
Matthias Wirtz ed70976770 Endpoints Query Param, Docker 60s delay fixed, Typo fixed, Update several Dependencies (#3398)
* Endpoints Query Param, Docker 60s delay fixed, Typo fixed

* Update dependencies
2023-11-12 17:51:14 +01:00
Adrian Kumpf adf798ee49 Fix deprecation warnings 2023-06-11 01:10:35 +02:00
Adrian Kumpf b2b0c4555d Format code 2023-06-11 00:58:26 +02:00
Adrian Kumpf e243645abb Add Dialyzer 2023-06-10 18:44:18 +02:00
Adrian Kumpf db59717d04 Fix deprecation warnings on Elixir v1.15 2023-06-10 18:44:18 +02:00
Adrian Kumpf 6af97bafc8 Read vehicle name from vehicle_data response 2023-06-10 17:29:51 +02:00
Adrian Kumpf 8756c66bca Fix typos 2023-02-03 21:20:10 +01:00
Martin Hüser 8377f361ce fix gpx format (#2925)
some tools, e.g. Garmin Basecamp, expect a proper namespace
definition in the xml root element and are more sensitive to
xml schema violations.

Track point elevation is specified to be an element of type
xsd:decimal in the gpx schema. But Teslamate renders an
empty element <ele></ele> when no elevation data is present.
This fix does not render an <ele> element when no elevation
is present

Also the gpx schema requires a "creator" attribute on the
gpx root element.
2023-01-13 14:00:36 +01:00
Adrian Kumpf 4931217ca7 Update Elixir dependencies 2023-01-13 11:02:14 +01:00
Adrian Kumpf a413e8ce2c Add setting to select tire pressure units 2022-07-18 11:35:14 +02:00
Adrian Kumpf 2b3e127259 Handle invalid JWTs 2022-07-15 12:35:35 +02:00
Brian May 4a11ef8421 If no geofence is found map then use default value (#2564)
This is required because the default value is "" which tells the mqtt
server to delete the retained value.

This in turn means that applications that care about when the car is in
a unknown location will not get the retained value.

This is a bit different from all of the other values in
`@always_published`. For them "" is only published if the value is
unknown or an error occurred. So it makes sense to delete the retained
value.

In this case however, a value of "" generally means "the car is outside
any known geofence" which is a valid condition it itself, and it should
be retained.

There was speculation this might affect the shift_state, but
unfortunately this was not followed up with any evidence or details. #1912

There are any number of solutions that could be deployed here. The
advantage of this solution however is it is not going to break anything
unless you specifically define the TESLAMATE_DEFAULT_GEOFENCE variable.

Fixes: #1336
2022-07-15 10:59:46 +02:00
NirKli 7a9c6b9ad1 Added tire pressure (#2706)
* - Added support for tire pressure graph per drive

* - Fixed migration script

* - Added tire pressure documentation in mqtt.md

* Use add command instead of add_if_not_exists

Co-authored-by: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com>

* Remove drop function command from migration script

Co-authored-by: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com>

* Format code

Co-authored-by: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com>
2022-06-24 15:24:39 +02:00
Adrian Kumpf a0e12c3808 Store marketing names
... and identify new Model S and X.

Closes #2494, #2496
2022-04-22 15:42:25 +02:00
Adrian Kumpf 7d2a841f1f Bump deps 2022-04-04 14:24:04 +02:00
Adrian Kumpf b209d348f8 Restart stream process if token expired
Addresses #2450
2022-02-20 14:18:00 +01:00
Adrian Kumpf bbdc2d25ae Move encryption key warning into .container 2022-02-18 17:21:16 +01:00
Adrian Kumpf 0d6e288c70 Encrypt API tokens (#2360)
Store API tokens encrypted in the database.

During the database migration a randomly generated key will be used encrypt the tokens if no ENCRYPTION_KEY environment variable was provided.

If the application is started without the presence of an ENCRYPTION_KEY (or if the key failed to decrypt the existing tokens), the UI will display a warning with further instructions.
2022-02-18 17:03:13 +01:00
Adrian Kumpf a8bcb906b1 Add charge_current_request(_max) MQTT topics
Implements #2412
2022-02-09 17:13:35 +01:00
cwanja c89088f7d6 Update vehicle.ex (#2455)
Added support for the 2021.5+ Model X. Fixes #2454
2022-02-09 16:01:01 +01:00
cwanja 66254de906 Update summary.html.heex (#2390)
* Update summary.html.heex

Create a link on the summary page to link to Not a Tesla App release notes page per discussion request #2367 

Full disclosure - not proficient in Elixir, but understand HTML and capable of digging through other code and comparing. Just not sure how the `@summary.version` is going to be treated in the link text.

* Fix string interpolation

* Update tests

Co-authored-by: Adrian Kumpf <8999358+adriankumpf@users.noreply.github.com>
2022-01-28 12:16:17 +01:00
Adrian Kumpf b6a5219090 Don't exchange SSO token for Chinese accounts
Addresses #2378
2022-01-26 18:03:56 +01:00
Adrian Kumpf d6d4d62ac7 Skip unnecessary locale downloads 2022-01-23 23:57:24 +01:00
Adrian Kumpf 25e572bb9b Don't warn in case of common faulty update status
After successfully installing an update the Tesla API often reports
"downloading" as `status` while `install_perc` is at 100%.
2022-01-22 13:03:48 +01:00
Adrian Kumpf 6c53788738 Don't suspend logging while downloading an update
Fixes #2194
2022-01-22 13:00:50 +01:00