espex 0.10.0 advertises API 1.15 and later. This page covers what 1.15 added.
What's new
API 1.15 adds DeviceCapabilitiesRequest. A client on 1.15 or later
asks for the device's optional features with it and reads them from
DeviceCapabilitiesResponse, ignoring the matching DeviceInfoResponse
fields:
DeviceCapabilitiesResponse | Replaces in DeviceInfoResponse |
|---|---|
bluetooth_proxy.feature_flags | bluetooth_proxy_feature_flags |
zwave_proxy.feature_flags, zwave_proxy.home_id | zwave_proxy_feature_flags, zwave_home_id |
serial_proxies | serial_proxies |
What espex implements
espex answers the request from the same state it builds
DeviceInfoResponse from (Espex.DeviceConfig.to_device_capabilities_response/2),
so the two answers on one connection always agree:
- the Bluetooth flags from the
:bluetooth_scannerand:bluetooth_proxyadapters (Espex.BluetoothScanner,Espex.BluetoothProxy), including the optional callbacks each one exports; - the Z-Wave flags and home id from
Espex.ZWaveProxy.feature_flags/0andEspex.ZWaveProxy.home_id/0; - the serial ports from
Espex.SerialProxy.list_instances/0.
espex reports no voice assistant features and no Bluetooth MAC address. Later versions add fields to this message: Sendspin and the device wizard in API 1.18.
Usage
Nothing to configure: the answer follows the adapters you start espex with.
Espex.start_link(
device_config: [name: "my-device"],
bluetooth_proxy: MyApp.BLEProxy,
serial_proxy: MyApp.SerialPorts
)Like DeviceInfoResponse, the answer is fixed when the connection is
accepted. After Espex.update_adapters/2, call
Espex.disconnect_clients/1 so clients reconnect and ask again.
Upgrade notes
None for adapters: the message is built from what they already report.