Configuration for connecting to a Home Assistant instance.
:url- base URL, e.g."http://homeassistant.local:8123"(required):token- a long-lived access token (required):ssl_options-:sslclient options forhttps://URLs, used instead of the defaults. Whennil(the default), the server certificate is verified against the system CA store (:public_key.cacerts_get/0); if the system has no store (common on Nerves), a warning is logged and the certificate is not verified. To verify without a system store, pass CAs yourself, e.g.[verify: :verify_peer, cacertfile: CAStore.file_path()]with thecastorepackage, or[verify: :verify_peer, cacertfile: "/data/ha-ca.pem"]for a self-signed certificate. These replace the defaults; addcustomize_hostname_check: [match_fun: :public_key.pkix_verify_hostname_match_fun(:https)]for wildcard certificates. Pass[verify: :verify_none]to skip verification explicitly. Plainhttp://sends the token unencrypted.:ping_interval- ms between keepalive pings while connected (default30_000);nildisables pings:ping_timeout- ms to wait for the pong before the connection is treated as dead and re-established (default10_000):backoff_initial/:backoff_max- reconnect delay bounds in ms (default1_000/30_000); seeHassock.Connection.Backoff:connect_timeout- ms from the start of a connection attempt toauth_okbefore the attempt is abandoned, and ms HA gets to answer each subscription restore before the connection is re-made (default15_000)
inspect/1 leaves out :token and :ssl_options, so they don't end up
in logs or crash reports.
Summary
Functions
WebSockex connection options for this config: TLS settings for wss://,
nothing for ws://.
Build the WebSocket URL from a base HA URL.
Types
@type t() :: %Hassock.Config{ backoff_initial: pos_integer(), backoff_max: pos_integer(), connect_timeout: pos_integer(), ping_interval: pos_integer() | nil, ping_timeout: pos_integer(), ssl_options: [:ssl.tls_client_option()] | nil, token: String.t(), url: String.t() }
Functions
WebSockex connection options for this config: TLS settings for wss://,
nothing for ws://.
Build the WebSocket URL from a base HA URL.
Converts http:// to ws:// and https:// to wss:// (in any letter
case), and appends /api/websocket.