Skip to content

Commit c905e51

Browse files
committed
Add setting to select tire pressure units
1 parent 65fd0ca commit c905e51

21 files changed

Lines changed: 332 additions & 201 deletions

File tree

grafana/dashboards/internal/drive-details.json

Lines changed: 29 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"editable": true,
2323
"fiscalYearStartMonth": 0,
2424
"graphTooltip": 1,
25-
"iteration": 1656106743302,
25+
"iteration": 1658136653681,
2626
"links": [
2727
{
2828
"icon": "dashboard",
@@ -450,7 +450,7 @@
450450
},
451451
"textMode": "auto"
452452
},
453-
"pluginVersion": "8.5.4",
453+
"pluginVersion": "8.5.6",
454454
"targets": [
455455
{
456456
"format": "table",
@@ -537,7 +537,7 @@
537537
},
538538
"textMode": "auto"
539539
},
540-
"pluginVersion": "8.5.4",
540+
"pluginVersion": "8.5.6",
541541
"targets": [
542542
{
543543
"format": "table",
@@ -623,7 +623,7 @@
623623
},
624624
"textMode": "auto"
625625
},
626-
"pluginVersion": "8.5.4",
626+
"pluginVersion": "8.5.6",
627627
"targets": [
628628
{
629629
"format": "table",
@@ -729,7 +729,7 @@
729729
},
730730
"textMode": "auto"
731731
},
732-
"pluginVersion": "8.5.4",
732+
"pluginVersion": "8.5.6",
733733
"targets": [
734734
{
735735
"format": "table",
@@ -1144,7 +1144,7 @@
11441144
"hide": false,
11451145
"metricColumn": "none",
11461146
"rawQuery": true,
1147-
"rawSql": "SELECT\r\n $__time(date),\r\n convert_tire_pressure(tpms_pressure_fl,'$tire_pressure_units') AS tpms_pressure_front_left_$tire_pressure_units,\r\n convert_tire_pressure(tpms_pressure_fr,'$tire_pressure_units') AS tpms_pressure_front_right_$tire_pressure_units,\r\n convert_tire_pressure(tpms_pressure_rl,'$tire_pressure_units') AS tpms_pressure_rear_left_$tire_pressure_units,\r\n convert_tire_pressure(tpms_pressure_rr,'$tire_pressure_units') AS tpms_pressure_rear_right_$tire_pressure_units\r\nFROM\r\n positions\r\nWHERE\r\n car_id = $car_id AND\r\n $__timeFilter(date) AND\r\n tpms_pressure_fl is not null\r\nORDER BY\r\n date ASC",
1147+
"rawSql": "SELECT\r\n $__time(date),\r\n convert_tire_pressure(tpms_pressure_fl,'$pressure_unit') AS tpms_pressure_front_left_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_fr,'$pressure_unit') AS tpms_pressure_front_right_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_rl,'$pressure_unit') AS tpms_pressure_rear_left_$pressure_unit,\r\n convert_tire_pressure(tpms_pressure_rr,'$pressure_unit') AS tpms_pressure_rear_right_$pressure_unit\r\nFROM\r\n positions\r\nWHERE\r\n car_id = $car_id AND\r\n $__timeFilter(date) AND\r\n tpms_pressure_fl is not null\r\nORDER BY\r\n date ASC",
11481148
"refId": "A",
11491149
"select": [
11501150
[
@@ -1634,7 +1634,7 @@
16341634
},
16351635
"textMode": "value_and_name"
16361636
},
1637-
"pluginVersion": "8.5.4",
1637+
"pluginVersion": "8.5.6",
16381638
"targets": [
16391639
{
16401640
"format": "table",
@@ -1710,7 +1710,7 @@
17101710
"text": {},
17111711
"textMode": "value_and_name"
17121712
},
1713-
"pluginVersion": "8.5.4",
1713+
"pluginVersion": "8.5.6",
17141714
"targets": [
17151715
{
17161716
"datasource": "TeslaMate",
@@ -1923,36 +1923,8 @@
19231923
{
19241924
"current": {
19251925
"selected": false,
1926-
"text": "bar",
1927-
"value": "bar"
1928-
},
1929-
"hide": 0,
1930-
"includeAll": false,
1931-
"label": "Tire Pressure Units",
1932-
"multi": false,
1933-
"name": "tire_pressure_units",
1934-
"options": [
1935-
{
1936-
"selected": true,
1937-
"text": "bar",
1938-
"value": "bar"
1939-
},
1940-
{
1941-
"selected": false,
1942-
"text": "psi",
1943-
"value": "psi"
1944-
}
1945-
],
1946-
"query": "bar, psi",
1947-
"queryValue": "",
1948-
"skipUrlSync": false,
1949-
"type": "custom"
1950-
},
1951-
{
1952-
"current": {
1953-
"selected": false,
1954-
"text": "http://localhost:4000",
1955-
"value": "http://localhost:4000"
1926+
"text": "",
1927+
"value": ""
19561928
},
19571929
"datasource": "TeslaMate",
19581930
"definition": "select base_url from settings limit 1;",
@@ -1971,6 +1943,25 @@
19711943
"tagsQuery": "",
19721944
"type": "query",
19731945
"useTags": false
1946+
},
1947+
{
1948+
"current": {
1949+
"selected": false,
1950+
"text": "bar",
1951+
"value": "bar"
1952+
},
1953+
"definition": "select unit_of_pressure from settings limit 1;",
1954+
"hide": 2,
1955+
"includeAll": false,
1956+
"multi": false,
1957+
"name": "pressure_unit",
1958+
"options": [],
1959+
"query": "select unit_of_pressure from settings limit 1;",
1960+
"refresh": 1,
1961+
"regex": "",
1962+
"skipUrlSync": false,
1963+
"sort": 0,
1964+
"type": "query"
19741965
}
19751966
]
19761967
},

lib/teslamate/settings/global_settings.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ defmodule TeslaMate.Settings.GlobalSettings do
55
schema "settings" do
66
field :unit_of_length, Ecto.Enum, values: [:km, :mi]
77
field :unit_of_temperature, Ecto.Enum, values: [:C, :F]
8+
field :unit_of_pressure, Ecto.Enum, values: [:bar, :psi]
89

910
field :preferred_range, Ecto.Enum, values: [:ideal, :rated]
1011

@@ -86,6 +87,7 @@ defmodule TeslaMate.Settings.GlobalSettings do
8687
|> cast(attrs, [
8788
:unit_of_length,
8889
:unit_of_temperature,
90+
:unit_of_pressure,
8991
:preferred_range,
9092
:base_url,
9193
:grafana_url,
@@ -94,6 +96,7 @@ defmodule TeslaMate.Settings.GlobalSettings do
9496
|> validate_required([
9597
:unit_of_length,
9698
:unit_of_temperature,
99+
:unit_of_pressure,
97100
:preferred_range,
98101
:language
99102
])

lib/teslamate_web/live/settings_live/index.html.heex

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,21 @@
223223
</div>
224224
</div>
225225
</div>
226+
<div class="field is-horizontal">
227+
<div class="field-label is-normal">
228+
<%= label f, :unit_of_pressure, gettext("Tire Pressure"), class: "label" %>
229+
</div>
230+
<div class="field-body">
231+
<div class="field">
232+
<div class="control">
233+
<div class="select is-fullwidth">
234+
<%= select(f, :unit_of_pressure, [:bar, :psi]) %>
235+
</div>
236+
</div>
237+
<p class="help is-danger"><%= error_tag(f, :unit_of_pressure) %></p>
238+
</div>
239+
</div>
240+
</div>
226241
</div>
227242
</div>
228243

priv/gettext/da/LC_MESSAGES/default.po

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ msgstr "Udetemperatur"
324324

325325
#, elixir-autogen, elixir-format
326326
#: lib/teslamate_web/live/car_live/summary.html.heex:287
327-
#: lib/teslamate_web/live/settings_live/index.html.heex:268
327+
#: lib/teslamate_web/live/settings_live/index.html.heex:283
328328
msgid "Version"
329329
msgstr "Version"
330330

@@ -344,19 +344,19 @@ msgid "Remaining Time"
344344
msgstr "Tid tilbage"
345345

346346
#, elixir-autogen, elixir-format
347-
#: lib/teslamate_web/live/settings_live/index.html.heex:248
347+
#: lib/teslamate_web/live/settings_live/index.html.heex:263
348348
#: lib/teslamate_web/templates/layout/root.html.heex:47
349349
msgid "Dashboards"
350350
msgstr "Oversigter"
351351

352352
#, elixir-autogen, elixir-format
353-
#: lib/teslamate_web/live/settings_live/index.html.heex:231
353+
#: lib/teslamate_web/live/settings_live/index.html.heex:246
354354
msgid "URLs"
355355
msgstr "URL'er"
356356

357357
#, elixir-autogen, elixir-format
358358
#: lib/teslamate_web/live/settings_live/index.html.heex:162
359-
#: lib/teslamate_web/live/settings_live/index.html.heex:234
359+
#: lib/teslamate_web/live/settings_live/index.html.heex:249
360360
msgid "Web App"
361361
msgstr "Webapp"
362362

@@ -540,17 +540,17 @@ msgid "Streaming API"
540540
msgstr "Streaming API"
541541

542542
#, elixir-autogen, elixir-format
543-
#: lib/teslamate_web/live/settings_live/index.html.heex:283
543+
#: lib/teslamate_web/live/settings_live/index.html.heex:298
544544
msgid "Documentation"
545545
msgstr "Dokumentation"
546546

547547
#, elixir-autogen, elixir-format
548-
#: lib/teslamate_web/live/settings_live/index.html.heex:279
548+
#: lib/teslamate_web/live/settings_live/index.html.heex:294
549549
msgid "GitHub"
550550
msgstr "GitHub"
551551

552552
#, elixir-autogen, elixir-format
553-
#: lib/teslamate_web/live/settings_live/index.html.heex:274
553+
#: lib/teslamate_web/live/settings_live/index.html.heex:289
554554
#: lib/teslamate_web/templates/layout/root.html.heex:112
555555
msgid "Update available"
556556
msgstr "Opdatering tilgængelig"
@@ -577,7 +577,7 @@ msgid "Software Update available (%{version})"
577577
msgstr "Softwareopdatering tilgængelig (%{version})"
578578

579579
#, elixir-autogen, elixir-format
580-
#: lib/teslamate_web/live/settings_live/index.html.heex:295
580+
#: lib/teslamate_web/live/settings_live/index.html.heex:310
581581
msgid "Sign out"
582582
msgstr "Log Ud"
583583

@@ -635,3 +635,8 @@ msgstr ""
635635
#: lib/teslamate_web/templates/layout/root.html.heex:83
636636
msgid "To ensure that your <strong>Tesla API tokens are stored securely</strong>, an encryption key must be provided to TeslaMate via the <code>ENCRYPTION_KEY</code> environment variable. Otherwise, a <strong>login will be required after every restart</strong>."
637637
msgstr ""
638+
639+
#, elixir-autogen, elixir-format
640+
#: lib/teslamate_web/live/settings_live/index.html.heex:228
641+
msgid "Tire Pressure"
642+
msgstr ""

priv/gettext/de/LC_MESSAGES/default.po

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ msgstr "Außentemperatur"
324324

325325
#, elixir-autogen, elixir-format
326326
#: lib/teslamate_web/live/car_live/summary.html.heex:287
327-
#: lib/teslamate_web/live/settings_live/index.html.heex:268
327+
#: lib/teslamate_web/live/settings_live/index.html.heex:283
328328
msgid "Version"
329329
msgstr ""
330330

@@ -344,19 +344,19 @@ msgid "Remaining Time"
344344
msgstr "Restlaufzeit"
345345

346346
#, elixir-autogen, elixir-format
347-
#: lib/teslamate_web/live/settings_live/index.html.heex:248
347+
#: lib/teslamate_web/live/settings_live/index.html.heex:263
348348
#: lib/teslamate_web/templates/layout/root.html.heex:47
349349
msgid "Dashboards"
350350
msgstr ""
351351

352352
#, elixir-autogen, elixir-format
353-
#: lib/teslamate_web/live/settings_live/index.html.heex:231
353+
#: lib/teslamate_web/live/settings_live/index.html.heex:246
354354
msgid "URLs"
355355
msgstr ""
356356

357357
#, elixir-autogen, elixir-format
358358
#: lib/teslamate_web/live/settings_live/index.html.heex:162
359-
#: lib/teslamate_web/live/settings_live/index.html.heex:234
359+
#: lib/teslamate_web/live/settings_live/index.html.heex:249
360360
msgid "Web App"
361361
msgstr ""
362362

@@ -540,17 +540,17 @@ msgid "Streaming API"
540540
msgstr ""
541541

542542
#, elixir-autogen, elixir-format
543-
#: lib/teslamate_web/live/settings_live/index.html.heex:283
543+
#: lib/teslamate_web/live/settings_live/index.html.heex:298
544544
msgid "Documentation"
545545
msgstr "Dokumentation"
546546

547547
#, elixir-autogen, elixir-format
548-
#: lib/teslamate_web/live/settings_live/index.html.heex:279
548+
#: lib/teslamate_web/live/settings_live/index.html.heex:294
549549
msgid "GitHub"
550550
msgstr ""
551551

552552
#, elixir-autogen, elixir-format
553-
#: lib/teslamate_web/live/settings_live/index.html.heex:274
553+
#: lib/teslamate_web/live/settings_live/index.html.heex:289
554554
#: lib/teslamate_web/templates/layout/root.html.heex:112
555555
msgid "Update available"
556556
msgstr "Update verfügbar"
@@ -577,7 +577,7 @@ msgid "Software Update available (%{version})"
577577
msgstr "Software Update verfügbar (%{version})"
578578

579579
#, elixir-autogen, elixir-format
580-
#: lib/teslamate_web/live/settings_live/index.html.heex:295
580+
#: lib/teslamate_web/live/settings_live/index.html.heex:310
581581
msgid "Sign out"
582582
msgstr "Abmelden"
583583

@@ -635,3 +635,8 @@ msgstr "Der automatisch generierte Verschlüsselungscode, der für die aktuelle
635635
#: lib/teslamate_web/templates/layout/root.html.heex:83
636636
msgid "To ensure that your <strong>Tesla API tokens are stored securely</strong>, an encryption key must be provided to TeslaMate via the <code>ENCRYPTION_KEY</code> environment variable. Otherwise, a <strong>login will be required after every restart</strong>."
637637
msgstr "Um sicherzustellen, dass deine <strong>Tesla-API-Tokens sicher gespeichert</strong> werden, muss TeslaMate ein Verschlüsselungscode mittels der Umgebungsvariable <code>ENCRYPTION_KEY</code> übergeben werden."
638+
639+
#, elixir-autogen, elixir-format
640+
#: lib/teslamate_web/live/settings_live/index.html.heex:228
641+
msgid "Tire Pressure"
642+
msgstr "Reifendruck"

priv/gettext/default.pot

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ msgstr ""
323323

324324
#, elixir-autogen, elixir-format
325325
#: lib/teslamate_web/live/car_live/summary.html.heex:287
326-
#: lib/teslamate_web/live/settings_live/index.html.heex:268
326+
#: lib/teslamate_web/live/settings_live/index.html.heex:283
327327
msgid "Version"
328328
msgstr ""
329329

@@ -343,19 +343,19 @@ msgid "Remaining Time"
343343
msgstr ""
344344

345345
#, elixir-autogen, elixir-format
346-
#: lib/teslamate_web/live/settings_live/index.html.heex:248
346+
#: lib/teslamate_web/live/settings_live/index.html.heex:263
347347
#: lib/teslamate_web/templates/layout/root.html.heex:47
348348
msgid "Dashboards"
349349
msgstr ""
350350

351351
#, elixir-autogen, elixir-format
352-
#: lib/teslamate_web/live/settings_live/index.html.heex:231
352+
#: lib/teslamate_web/live/settings_live/index.html.heex:246
353353
msgid "URLs"
354354
msgstr ""
355355

356356
#, elixir-autogen, elixir-format
357357
#: lib/teslamate_web/live/settings_live/index.html.heex:162
358-
#: lib/teslamate_web/live/settings_live/index.html.heex:234
358+
#: lib/teslamate_web/live/settings_live/index.html.heex:249
359359
msgid "Web App"
360360
msgstr ""
361361

@@ -539,17 +539,17 @@ msgid "Streaming API"
539539
msgstr ""
540540

541541
#, elixir-autogen, elixir-format
542-
#: lib/teslamate_web/live/settings_live/index.html.heex:283
542+
#: lib/teslamate_web/live/settings_live/index.html.heex:298
543543
msgid "Documentation"
544544
msgstr ""
545545

546546
#, elixir-autogen, elixir-format
547-
#: lib/teslamate_web/live/settings_live/index.html.heex:279
547+
#: lib/teslamate_web/live/settings_live/index.html.heex:294
548548
msgid "GitHub"
549549
msgstr ""
550550

551551
#, elixir-autogen, elixir-format
552-
#: lib/teslamate_web/live/settings_live/index.html.heex:274
552+
#: lib/teslamate_web/live/settings_live/index.html.heex:289
553553
#: lib/teslamate_web/templates/layout/root.html.heex:112
554554
msgid "Update available"
555555
msgstr ""
@@ -576,7 +576,7 @@ msgid "Software Update available (%{version})"
576576
msgstr ""
577577

578578
#, elixir-autogen, elixir-format
579-
#: lib/teslamate_web/live/settings_live/index.html.heex:295
579+
#: lib/teslamate_web/live/settings_live/index.html.heex:310
580580
msgid "Sign out"
581581
msgstr ""
582582

@@ -634,3 +634,8 @@ msgstr ""
634634
#: lib/teslamate_web/templates/layout/root.html.heex:83
635635
msgid "To ensure that your <strong>Tesla API tokens are stored securely</strong>, an encryption key must be provided to TeslaMate via the <code>ENCRYPTION_KEY</code> environment variable. Otherwise, a <strong>login will be required after every restart</strong>."
636636
msgstr ""
637+
638+
#, elixir-autogen, elixir-format
639+
#: lib/teslamate_web/live/settings_live/index.html.heex:228
640+
msgid "Tire Pressure"
641+
msgstr ""

0 commit comments

Comments
 (0)