From 43807f4bb0e73ee67812fb77c8fc09e96384e797 Mon Sep 17 00:00:00 2001 From: Adrian Kumpf Date: Sun, 29 Sep 2019 19:27:39 +0200 Subject: [PATCH] Report if windows are open (v10) --- README.md | 1 + lib/teslamate/vehicles/vehicle/summary.ex | 10 ++++++++-- lib/teslamate_web/templates/car/summary.html.leex | 6 ++++++ mix.exs | 2 +- mix.lock | 2 +- priv/gettext/de/LC_MESSAGES/default.po | 4 ++++ priv/gettext/default.pot | 15 +++++++++++---- priv/gettext/en/LC_MESSAGES/default.po | 4 ++++ 8 files changed, 36 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f7cd2454..0e046e45 100644 --- a/README.md +++ b/README.md @@ -210,6 +210,7 @@ teslamate/cars/$car_id/outside_temp teslamate/cars/$car_id/inside_temp teslamate/cars/$car_id/locked teslamate/cars/$car_id/sentry_mode +teslamate/cars/$car_id/windows_open ``` ## FAQ diff --git a/lib/teslamate/vehicles/vehicle/summary.ex b/lib/teslamate/vehicles/vehicle/summary.ex index f4c32ade..956e22e3 100644 --- a/lib/teslamate/vehicles/vehicle/summary.ex +++ b/lib/teslamate/vehicles/vehicle/summary.ex @@ -24,7 +24,8 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do :plugged_in, :scheduled_charging_start_time, :charge_limit_soc, - :charger_power + :charger_power, + :windows_open ] def into(nil, %{state: :start}) do @@ -69,7 +70,12 @@ defmodule TeslaMate.Vehicles.Vehicle.Summary do outside_temp: get_in_struct(vehicle, [:climate_state, :outside_temp]), inside_temp: get_in_struct(vehicle, [:climate_state, :inside_temp]), locked: get_in_struct(vehicle, [:vehicle_state, :locked]), - sentry_mode: get_in_struct(vehicle, [:vehicle_state, :sentry_mode]) + sentry_mode: get_in_struct(vehicle, [:vehicle_state, :sentry_mode]), + windows_open: + get_in_struct(vehicle, [:vehicle_state, :fd_window]) == 1 or + get_in_struct(vehicle, [:vehicle_state, :fp_window]) == 1 or + get_in_struct(vehicle, [:vehicle_state, :rd_window]) == 1 or + get_in_struct(vehicle, [:vehicle_state, :rp_window]) == 1 } end diff --git a/lib/teslamate_web/templates/car/summary.html.leex b/lib/teslamate_web/templates/car/summary.html.leex index 2127b825..555c2e55 100644 --- a/lib/teslamate_web/templates/car/summary.html.leex +++ b/lib/teslamate_web/templates/car/summary.html.leex @@ -151,6 +151,12 @@ <%= (if @summary.locked, do: gettext("yes"), else: gettext("no")) %> <% end %> + <%= if @summary.windows_open == true do %> + + <%= gettext "Windows open" %> + <%= (if @summary.windows_open, do: gettext("yes"), else: gettext("no")) %> + + <% end %> <%= if @summary.sentry_mode do %> <%= gettext "Sentry Mode" %> diff --git a/mix.exs b/mix.exs index 428b6e15..2f62bd55 100644 --- a/mix.exs +++ b/mix.exs @@ -47,7 +47,7 @@ defmodule TeslaMate.MixProject do {:jason, "~> 1.0"}, {:plug_cowboy, "~> 2.0"}, # Custom - {:tesla_api, github: "mgwidmann/tesla_api"}, + {:tesla_api, github: "adriankumpf/tesla_api", branch: "v10"}, {:gen_state_machine, "~> 2.0"}, {:ecto_enum, "~> 1.2"}, {:phoenix_live_view, "~> 0.1"}, diff --git a/mix.lock b/mix.lock index 9d4653b5..09f13501 100644 --- a/mix.lock +++ b/mix.lock @@ -43,7 +43,7 @@ "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm"}, "telemetry": {:hex, :telemetry, "0.4.0", "8339bee3fa8b91cb84d14c2935f8ecf399ccd87301ad6da6b71c09553834b2ab", [:rebar3], [], "hexpm"}, "tesla": {:hex, :tesla, "1.3.0", "f35d72f029e608f9cdc6f6d6fcc7c66cf6d6512a70cfef9206b21b8bd0203a30", [:mix], [{:castore, "~> 0.1", [hex: :castore, repo: "hexpm", optional: true]}, {:exjsx, ">= 3.0.0", [hex: :exjsx, repo: "hexpm", optional: true]}, {:fuse, "~> 2.4", [hex: :fuse, repo: "hexpm", optional: true]}, {:gun, "~> 1.3", [hex: :gun, repo: "hexpm", optional: true]}, {:hackney, "~> 1.6", [hex: :hackney, repo: "hexpm", optional: true]}, {:ibrowse, "~> 4.4.0", [hex: :ibrowse, repo: "hexpm", optional: true]}, {:jason, ">= 1.0.0", [hex: :jason, repo: "hexpm", optional: true]}, {:mime, "~> 1.0", [hex: :mime, repo: "hexpm", optional: false]}, {:mint, "~> 0.4", [hex: :mint, repo: "hexpm", optional: true]}, {:poison, ">= 1.0.0", [hex: :poison, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.3", [hex: :telemetry, repo: "hexpm", optional: true]}], "hexpm"}, - "tesla_api": {:git, "https://github.com/mgwidmann/tesla_api.git", "435c753ab6c34876c1b0e9a8cb3ac0ce26c79940", []}, + "tesla_api": {:git, "https://github.com/adriankumpf/tesla_api.git", "da8941cd4b93530d1a059116cd047a30a9132b81", [branch: "v10"]}, "tortoise": {:hex, :tortoise, "0.9.4", "3bca5f4475f80a5bd45aab644ddb3364dd0956b67f4202dcef6ed20e045ea3a6", [:mix], [{:gen_state_machine, "~> 2.0", [hex: :gen_state_machine, repo: "hexpm", optional: false]}], "hexpm"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, } diff --git a/priv/gettext/de/LC_MESSAGES/default.po b/priv/gettext/de/LC_MESSAGES/default.po index 256f84bb..6a48b5eb 100644 --- a/priv/gettext/de/LC_MESSAGES/default.po +++ b/priv/gettext/de/LC_MESSAGES/default.po @@ -290,3 +290,7 @@ msgstr "Allgemein" #, elixir-format msgid "Do you really want to delete '%{geo_fence}'?" msgstr "Willst du wirklich '%{geo_fence}' löschen?" + +#, elixir-format +msgid "Windows open" +msgstr "Fenster geöffnet" diff --git a/priv/gettext/default.pot b/priv/gettext/default.pot index f0665575..a771a8f6 100644 --- a/priv/gettext/default.pot +++ b/priv/gettext/default.pot @@ -16,7 +16,7 @@ msgid "Status" msgstr "" #, elixir-format -#: lib/teslamate_web/templates/car/summary.html.leex:162 +#: lib/teslamate_web/templates/car/summary.html.leex:168 msgid "Speed" msgstr "" @@ -61,12 +61,12 @@ msgid "updating" msgstr "" #, elixir-format -#: lib/teslamate_web/templates/car/summary.html.leex:187 +#: lib/teslamate_web/templates/car/summary.html.leex:193 msgid "Inside temperature" msgstr "" #, elixir-format -#: lib/teslamate_web/templates/car/summary.html.leex:175 +#: lib/teslamate_web/templates/car/summary.html.leex:181 msgid "Outside temperature" msgstr "" @@ -79,6 +79,7 @@ msgstr "" #: lib/teslamate_web/templates/car/summary.html.leex:120 #: lib/teslamate_web/templates/car/summary.html.leex:151 #: lib/teslamate_web/templates/car/summary.html.leex:157 +#: lib/teslamate_web/templates/car/summary.html.leex:163 msgid "no" msgstr "" @@ -86,11 +87,12 @@ msgstr "" #: lib/teslamate_web/templates/car/summary.html.leex:120 #: lib/teslamate_web/templates/car/summary.html.leex:151 #: lib/teslamate_web/templates/car/summary.html.leex:157 +#: lib/teslamate_web/templates/car/summary.html.leex:163 msgid "yes" msgstr "" #, elixir-format -#: lib/teslamate_web/templates/car/summary.html.leex:156 +#: lib/teslamate_web/templates/car/summary.html.leex:162 msgid "Sentry Mode" msgstr "" @@ -378,3 +380,8 @@ msgstr "" #: lib/teslamate_web/templates/geo_fence/index.html.leex:51 msgid "Do you really want to delete '%{geo_fence}'?" msgstr "" + +#, elixir-format +#: lib/teslamate_web/templates/car/summary.html.leex:156 +msgid "Windows open" +msgstr "" diff --git a/priv/gettext/en/LC_MESSAGES/default.po b/priv/gettext/en/LC_MESSAGES/default.po index 2e8660c1..41e8150a 100644 --- a/priv/gettext/en/LC_MESSAGES/default.po +++ b/priv/gettext/en/LC_MESSAGES/default.po @@ -290,3 +290,7 @@ msgstr "" #, elixir-format msgid "Do you really want to delete '%{geo_fence}'?" msgstr "" + +#, elixir-format +msgid "Windows open" +msgstr ""