TeslaPowerwall (tesla_powerwall v0.1.1)

Link to this section Summary

Link to this section Types

Link to this type

device_type()

Specs

device_type() :: :GW1 | :GW2 | :SWC
Link to this type

grid_status_type()

Specs

grid_status_type() ::
  :connected | :islanded_ready | :islanded | :transition_to_grid
Link to this type

powerwall_api_error()

Specs

powerwall_api_error() :: :error_page_not_found
Link to this type

powerwall_error()

Specs

powerwall_error() ::
  :missing_key
  | :powerwall_version_required
  | powerwall_parse_error()
  | powerwall_api_error()
Link to this type

powerwall_parse_error()

Specs

powerwall_parse_error() :: :unknown_device_type | :invalid_grid_status

Link to this section Functions

Link to this function

get(powerwall, path)

Specs

get(TeslaPowerwall.Powerwall, String.t()) :: any()
Link to this function

get_charge(powerwall)

Specs

get_charge(TeslaPowerwall.Powerwall) :: {:ok, float()} | {:error, any()}
Link to this function

get_device_type(powerwall)

Link to this function

get_grid_status(powerwall)

Specs

get_grid_status(TeslaPowerwall.Powerwall) ::
  {:ok, grid_status_type()} | {:error, any()}
Link to this function

get_meters(powerwall)

Specs

get_meters(TeslaPowerwall.Powerwall) :: any() | {:error}
Link to this function

get_powerwalls(powerwall)

Link to this function

get_serial_numbers(powerwall)

Link to this function

get_site_info(powerwall)

Link to this function

get_sitemaster(powerwall)

Link to this function

get_status(powerwall)

Link to this function

get_status_and_update(powerwall)

Link to this function

get_version(powerwall)

Link to this function

get_version_and_update(powerwall)

Link to this function

new(endpoint, finch_name \\ TeslaPowerwallFinch)

Specs

new(String.t(), any()) :: TeslaPowerwall.Powerwall
Link to this function

start_finch(powerwall)

Starts finch based on the configuration of powerwall.

Most powerwalls serve a self signed certificate. As such a normal request will fail because of the 'invalid' certificate. To circumvent this the finch client must be instructed to not verify the certificate. This can be achieved by passing [transport_opts: [verify: :verify_none]] to the conn_opts when configuring the Finch pool:

Example

  Finch.start_link(
    name: TeslaPowerwallFinch,
    pools: %{
      "192.0.2.100" => [size: 5, conn_opts: [transport_opts: [verify: :verify_none]]]
    }
  )

When using a different name than TeslaPowerwallFinch it must be passed to the Powerwall struct either when calling TeslaPowerwall.new\2 or by manually setting finch_name of your powerwall struct.