Skip to content

Commit

Permalink
Append °C to temperature value
Browse files Browse the repository at this point in the history
  • Loading branch information
mnishiguchi authored and fhunleth committed Oct 30, 2022
1 parent cd97c17 commit ff87501
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/nerves_motd.ex
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ defmodule NervesMOTD do
defp temperature_row() do
case runtime_mod().cpu_temperature() do
{:ok, temperature_c} ->
[{"Temperature", :erlang.float_to_binary(temperature_c, decimals: 1)}]
[{"Temperature", [:erlang.float_to_binary(temperature_c, decimals: 1), "°C"]}]

_ ->
nil
Expand Down
2 changes: 1 addition & 1 deletion test/nerves_motd_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ defmodule NervesMOTDTest do
|> Mox.expect(:applications, 1, default_applications_code())
|> Mox.expect(:cpu_temperature, 1, fn -> {:ok, 41.234} end)

assert capture_motd() =~ ~r/Temperature : 41.2/
assert capture_motd() =~ ~r/Temperature : 41.2°C/
end

test "Temperature when unavailable" do
Expand Down

0 comments on commit ff87501

Please sign in to comment.