Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/espex.ex
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ defmodule Espex do
@spec device_config(GenServer.server()) :: DeviceConfig.t()
def device_config(server \\ Server), do: Server.device_config(server)

@doc since: "0.10.0"
@doc """
Replace or merge the running server's `%DeviceConfig{}`.

Expand Down Expand Up @@ -145,6 +146,7 @@ defmodule Espex do
Server.update_device_config(server, config_or_opts)
end

@doc since: "0.10.0"
@doc """
Replace some or all of the running server's adapter modules.

Expand Down Expand Up @@ -176,6 +178,7 @@ defmodule Espex do
Server.update_adapters(server, changes)
end

@doc since: "0.10.0"
@doc """
Ask every currently-connected client to disconnect.

Expand All @@ -198,7 +201,8 @@ defmodule Espex do
that is already being disconnected. Use an `Espex.ConnectionListener`
or `connected_clients/1` to observe the drop and the return.

`reason` is carried in `DisconnectRequest.reason` (ESPHome 2026.7+):
`reason` is carried in `DisconnectRequest.reason` (ESPHome 2026.7+;
the argument is new in 0.10.0):

* `:unspecified` (default) — an ordinary reconnect request; Home
Assistant comes back after its cooldown.
Expand Down Expand Up @@ -240,6 +244,7 @@ defmodule Espex do
end)
end

@doc since: "0.7.0"
@doc """
Broadcast a Z-Wave home-ID change to **every** connected client.

Expand Down Expand Up @@ -270,6 +275,7 @@ defmodule Espex do
end)
end

@doc since: "0.5.0"
@doc """
List the currently-connected native-API clients as
`Espex.ClientInfo` structs.
Expand Down
1 change: 1 addition & 0 deletions lib/espex/bluetooth_proxy.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.BluetoothProxy do
@moduledoc since: "0.2.0"
@moduledoc """
Behaviour for Bluetooth Low Energy active-proxy adapters.

Expand Down
1 change: 1 addition & 0 deletions lib/espex/bluetooth_proxy/characteristic.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.BluetoothProxy.Characteristic do
@moduledoc since: "0.2.0"
@moduledoc """
A GATT characteristic inside a `Espex.BluetoothProxy.Service`.

Expand Down
1 change: 1 addition & 0 deletions lib/espex/bluetooth_proxy/descriptor.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.BluetoothProxy.Descriptor do
@moduledoc since: "0.2.0"
@moduledoc """
A GATT descriptor inside a `Espex.BluetoothProxy.Characteristic`.

Expand Down
1 change: 1 addition & 0 deletions lib/espex/bluetooth_proxy/service.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.BluetoothProxy.Service do
@moduledoc since: "0.2.0"
@moduledoc """
A GATT service streamed from a `Espex.BluetoothProxy` adapter.

Expand Down
1 change: 1 addition & 0 deletions lib/espex/bluetooth_scanner.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.BluetoothScanner do
@moduledoc since: "0.2.0"
@moduledoc """
Behaviour for Bluetooth Low Energy scanner adapters.

Expand Down
1 change: 1 addition & 0 deletions lib/espex/client_info.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.ClientInfo do
@moduledoc since: "0.5.0"
@moduledoc """
A snapshot of one currently-connected ESPHome native-API client.

Expand Down
1 change: 1 addition & 0 deletions lib/espex/connection_listener.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.ConnectionListener do
@moduledoc since: "0.5.0"
@moduledoc """
Behaviour for being notified when the set of connected native-API
clients changes.
Expand Down
3 changes: 3 additions & 0 deletions lib/espex/device_config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ defmodule Espex.DeviceConfig do
def encrypted?(%__MODULE__{psk: nil}), do: false
def encrypted?(%__MODULE__{psk: <<_::binary-size(32)>>}), do: true

@doc since: "0.4.0"
@doc """
Set the PSK from runtime-supplied input (e.g. a
`NoiseEncryptionSetKeyRequest`), returning a tagged result.
Expand All @@ -172,6 +173,7 @@ defmodule Espex.DeviceConfig do
end
end

@doc since: "0.10.0"
@doc """
Validate a caller-built `%DeviceConfig{}` for use at runtime, returning
a tagged result.
Expand All @@ -186,6 +188,7 @@ defmodule Espex.DeviceConfig do
def validate(%__MODULE__{psk: psk} = config) when is_binary(psk), do: put_psk(config, psk)
def validate(%__MODULE__{}), do: {:error, :invalid_psk_length}

@doc since: "0.10.0"
@doc """
Apply runtime-supplied keyword options onto an existing config,
returning a tagged result.
Expand Down
1 change: 1 addition & 0 deletions lib/espex/entity_provider.ex
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ defmodule Espex.EntityProvider do
"""
@callback handle_command(command :: struct()) :: :ok | {:error, term()}

@doc since: "0.9.0"
@doc """
Same as `c:handle_command/1`, but also given the originating
connection's security context. Preferred when exported — Espex calls
Expand Down
1 change: 1 addition & 0 deletions lib/espex/psk_store.ex
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defmodule Espex.PskStore do
@moduledoc since: "0.4.0"
@moduledoc """
Behaviour for persisting the Noise pre-shared key when Home Assistant
provisions or rotates it at runtime via `NoiseEncryptionSetKeyRequest`.
Expand Down
3 changes: 3 additions & 0 deletions lib/espex/serial_proxy.ex
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ defmodule Espex.SerialProxy do
drive, a list of `:rts` / `:dtr` (default `[]`). Advertised to the
client as a bitmask so it knows which pins `set_modem_pins/3` will
honour. Set it when the adapter implements `c:set_modem_pins/3`.
Since 0.10.0.

The list is snapshotted at connection-accept time and cached by the
client; see the "Architecture" guide for why changes require a
Expand Down Expand Up @@ -229,6 +230,7 @@ defmodule Espex.SerialProxy do
]
end

@doc since: "0.8.0"
@doc """
The fallback options used when espex lazily opens an instance and the
adapter does not export `c:default_open_opts/1`: 9600-8-N-1, no flow
Expand Down Expand Up @@ -301,6 +303,7 @@ defmodule Espex.SerialProxy do
@callback request(handle(), request_type()) ::
{:ok, request_status()} | {:error, term()}

@doc since: "0.8.0"
@doc """
Return the options espex should use when it opens `instance` lazily —
i.e. when a client sends a write/subscribe/modem-pins/flush request
Expand Down
3 changes: 2 additions & 1 deletion lib/espex/serial_proxy/info.ex
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ defmodule Espex.SerialProxy.Info do
alias Espex.Proto

@type port_type :: :ttl | :rs232 | :rs485
@typedoc "A modem control line the port can drive via `set_modem_pins/3`."
@typedoc "A modem control line the port can drive via `set_modem_pins/3`. Since 0.10.0."
@type line :: :rts | :dtr

@type t :: %__MODULE__{
Expand Down Expand Up @@ -49,6 +49,7 @@ defmodule Espex.SerialProxy.Info do
}
end

@doc since: "0.10.0"
@doc """
Encode a list of modem lines as the `configured_line_states` bitmask
(`:rts` → bit 0, `:dtr` → bit 1).
Expand Down
8 changes: 5 additions & 3 deletions lib/espex/supervisor.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,10 @@ defmodule Espex.Supervisor do
connections are built from, `Espex.update_adapters/2` swaps the adapter
modules, and `Espex.disconnect_clients/1` asks every connected client
to disconnect and come back — together they make Home Assistant re-read
`DeviceInfo` and the entity list without restarting this tree. `disconnect_grace_ms` bounds how long a
connection waits for the client's `DisconnectResponse` before closing
the socket anyway.
`DeviceInfo` and the entity list without restarting this tree. All
three, and the option below, are new in 0.10.0. `disconnect_grace_ms`
bounds how long a connection waits for the client's
`DisconnectResponse` before closing the socket anyway.
"""

use Supervisor
Expand Down Expand Up @@ -194,6 +195,7 @@ defmodule Espex.Supervisor do
@spec registry_name(atom()) :: atom()
def registry_name(server_name), do: Module.concat(server_name, "Registry")

@doc since: "0.5.0"
@doc """
Return the conventional connected-clients Registry name for a given
server name. This is the unique-key registry that backs
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ defmodule Espex.MixProject do
use Mix.Project

@app :espex
@version "0.9.0"
@version "0.10.0"
@source_url "https://github.com/bbangert/espex"

def project do
Expand Down
Loading