FritzApi v2.0.0-rc.0 FritzApi View Source

Fritz!Box Home Automation API Client for Elixir (documentation).

Usage

iex> {:ok, client} = FritzApi.Client.new()
...>                 |> FritzApi.Client.login("admin", "changeme")

iex> FritzApi.get_device_list_infos(client)
{:ok, [%FritzApi.Actor{
  ain: "687690315761",
  fwversion: "03.87",
  id: 21,
  manufacturer: "AVM",
  name: "FRITZ!DECT #1",
  powermeter: %{energy: 0.475, power: 0.0},
  present: true,
  productname: "FRITZ!DECT 200",
  switch: %{
    devicelock: false,
    lock: false,
    mode: :manual,
    state: false
  },
  temperature: %{
    celsius: 23.5,
    offset: 0.0
  }
}]}

iex> FritzApi.set_switch_off(client, "687690315761")
:ok

iex> FritzApi.get_temperature(client, "687690315761")
{:ok, 23.5}

Link to this section Summary

Functions

Disable the target temperature of the radiator controller.

Enabele the target temperature of the radiator controller.

Get essential information of all smart home devices.

Get the comfort temperature (Celsius) set for time switching of the radiator controller.

Get the economy temperature (Celsius) set for time switching of the radiator controller.

Get the target temperature (Celsius) currently set for the radiator controller.

Get the total energy usage (kWh) of the switch.

Get the actuator identification numbers (AIN) of all known actors.

Get the name of the actor.

Get the current power consumption (Watt) of the switch.

Get the current connection state of the actor.

Get the current switching state.

Get the last measured temperature (Celsius) of the actor.

Set the target temperature (Celsius) of the radiator controller.

Turn off the switch.

Turn on the switch.

Toggle the switch.

Link to this section Types

Specs

ain() :: String.t()

Specs

password() :: String.t()

Specs

session_id() :: String.t()

Specs

useranme() :: String.t()

Link to this section Functions

Link to this function

disable_hkr_target_temperature(client, ain)

View Source

Specs

disable_hkr_target_temperature(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | :ok

Disable the target temperature of the radiator controller.

Example

iex> FritzApi.disable_hkr_target_temperature(client, "687690315761")
{:ok, 23.5}
Link to this function

enable_hkr_target_temperature(client, ain)

View Source

Specs

enable_hkr_target_temperature(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | :ok

Enabele the target temperature of the radiator controller.

Example

iex> FritzApi.enable_hkr_target_temperature(client, "687690315761")
{:ok, 23.5}
Link to this function

get_device_list_infos(client)

View Source

Specs

get_device_list_infos(FritzApi.Client.t()) ::
  {:error, FritzApi.Error.t()} | {:ok, [FritzApi.Actor.t()]}

Get essential information of all smart home devices.

Example

iex> FritzApi.get_device_list_infos(client)
{:ok, [%FritzApi.Actor{
   ain: "687690315761",
   alert: nil,
   functions: ["Energie Messgerät", "Temperatursensor",
     "Schaltsteckdose", "Mikrofon"],
   fwversion: "04.17",
   id: "1",
   manufacturer: "AVM",
   name: "Aussensteckdose",
   powermeter: %FritzApi.Powermeter{
     energy: 8.94,
     power: 0.0,
     voltage: 231.17
   },
   present: true,
   productname: "FRITZ!DECT 210",
   switch: %FritzApi.Switch{
     devicelock: false,
     lock: false,
     mode: :auto,
     state: false
   },
   temperature: %FritzApi.Temperature{
     celsius: 21.0,
     offset: 0.0
   }
 }]}
Link to this function

get_hkr_comfort_temperature(client, ain)

View Source

Specs

get_hkr_comfort_temperature(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | :on | :off | float()}

Get the comfort temperature (Celsius) set for time switching of the radiator controller.

Example

iex> FritzApi.get_hkr_comfort_temperature(client, "687690315761")
{:ok, 23.5}
Link to this function

get_hkr_economy_temperature(client, ain)

View Source

Specs

get_hkr_economy_temperature(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | :on | :off | float()}

Get the economy temperature (Celsius) set for time switching of the radiator controller.

Example

iex> FritzApi.get_hkr_economy_temperature(client, "687690315761")
{:ok, 23.5}
Link to this function

get_hkr_target_temperature(client, ain)

View Source

Specs

get_hkr_target_temperature(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | :on | :off | float()}

Get the target temperature (Celsius) currently set for the radiator controller.

Example

iex> FritzApi.get_hkr_target_temperature(client, "687690315761")
{:ok, 23.5}
Link to this function

get_session_id(client, username, password)

View Source

Specs

get_session_id(FritzApi.Client.t(), useranme(), password()) ::
  {:ok, session_id()} | {:error, FritzApi.Error.t()}
Link to this function

get_switch_energy(client, ain)

View Source

Specs

get_switch_energy(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | float()}

Get the total energy usage (kWh) of the switch.

Returns {:ok, :unknown} if the state is unknown.

Example

iex> FritzApi.get_switch_energy(client, "687690315761")
{:ok, 0.475}

Specs

get_switch_list(FritzApi.Client.t()) ::
  {:error, FritzApi.Error.t()} | {:ok, [ain()]}

Get the actuator identification numbers (AIN) of all known actors.

Example

iex> FritzApi.get_switch_list(client)
{:ok, ["687690315761"]}
Link to this function

get_switch_name(client, ain)

View Source

Specs

get_switch_name(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, String.t()}

Get the name of the actor.

Example

iex> FritzApi.get_switch_name(client, "687690315761")
{:ok, "FRITZ!DECT #1"}
Link to this function

get_switch_power(client, ain)

View Source

Specs

get_switch_power(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | float()}

Get the current power consumption (Watt) of the switch.

Returns {:ok, :unknown} if the state is unknown.

Example

iex> FritzApi.get_switch_power(client, "687690315761")
{:ok, 0.0}
Link to this function

get_switch_present(client, ain)

View Source

Specs

get_switch_present(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, boolean()}

Get the current connection state of the actor.

Example

iex> FritzApi.get_switch_present(client, "687690315761")
{:ok, true}
Link to this function

get_switch_state(client, ain)

View Source

Specs

get_switch_state(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | :on | :off}

Get the current switching state.

Returns {:ok, :unknown} if the state is unknown.

Example

iex> FritzApi.get_switch_state(client, "687690315761")
{:ok, :on}
Link to this function

get_temperature(client, ain)

View Source

Specs

get_temperature(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :unknown | float()}

Get the last measured temperature (Celsius) of the actor.

Returns {:ok, :unknown} if the temperature could not be measured.

Example

iex> FritzApi.get_temperature(client, "687690315761")
{:ok, 23.5}
Link to this function

set_hkr_target_temperature(client, ain, temp)

View Source

Specs

set_hkr_target_temperature(FritzApi.Client.t(), ain(), 8..28) ::
  {:error, FritzApi.Error.t()} | :ok

Set the target temperature (Celsius) of the radiator controller.

Example

iex> FritzApi.set_hkr_target_temperature(client, "687690315761", 21.5)
{:ok, 23.5}
Link to this function

set_switch_off(client, ain)

View Source

Specs

set_switch_off(FritzApi.Client.t(), ain()) :: {:error, FritzApi.Error.t()} | :ok

Turn off the switch.

Example

iex> FritzApi.set_switch_off(client, "687690315761")
:ok
Link to this function

set_switch_on(client, ain)

View Source

Specs

set_switch_on(FritzApi.Client.t(), ain()) :: {:error, FritzApi.Error.t()} | :ok

Turn on the switch.

Example

iex> FritzApi.set_switch_on(client, "687690315761")
:ok
Link to this function

set_switch_toggle(client, ain)

View Source

Specs

set_switch_toggle(FritzApi.Client.t(), ain()) ::
  {:error, FritzApi.Error.t()} | {:ok, :on | :off}

Toggle the switch.

Example

iex> FritzApi.set_switch_toggle(client, "687690315761")
{:ok, :off}