Weather update client in Elixir

defmodule Wuclient do
@moduledoc """
Generated by erl2ex (http://github.com/dazuma/erl2ex)
From Erlang source: (Unknown source file)
At: 2019-12-20 13:57:39

"""

def main(args) do
{:ok, context} = :erlzmq.context()
:io.format('Collecting updates from weather server…~n')
{:ok, subscriber} = :erlzmq.socket(context, :sub)
:ok = :erlzmq.connect(subscriber, 'tcp://localhost:5556')
filter = case(args) do
[] ->
"10001"
[arg1 | _] ->
:erlang.list_to_binary(arg1)
end
:ok = :erlzmq.setsockopt(subscriber, :subscribe, filter)
updateNbr = 5
totalTemp = collect_temperature(subscriber, updateNbr, 0)
:io.format('Average temperature for zipcode \'~s\' was ~bF~n', [filter, trunc(totalTemp / updateNbr)])
:ok = :erlzmq.close(subscriber)
:ok = :erlzmq.term(context)
end

def collect_temperature(_subscriber, 0, total) do
total
end

def collect_temperature(subscriber, n, total) when n > 0 do
{:ok, msg} = :erlzmq.recv(subscriber)
collect_temperature(subscriber, n - 1, total + msg_temperature(msg))
end

def msg_temperature(msg) do
{:ok, [_, temp, _], _} = :io_lib.fread('~d ~d ~d', :erlang.binary_to_list(msg))
temp
end

end

Wuclient.main([])