HueSDK.Discovery behaviour (HueSDK v0.1.0) View Source
Automatic discovery of Hue Bridge devices available on the local network.
See HueSDK.Discovery.discover/2 for examples.
Link to this section Summary
Types
A list of discovered Hue Bridge devices, tagged by the discovery strategy.
Functions
Attempts to discover all available Hue Bridge devices on the local network.
Callbacks
Attempts to discover all available Hue Bridge devices on the local network.
Link to this section Types
Specs
discovery_result() :: {atom(), [HueSDK.Bridge.t()]}
A list of discovered Hue Bridge devices, tagged by the discovery strategy.
Link to this section Functions
Attempts to discover all available Hue Bridge devices on the local network.
Examples
Discovering a Hue Bridge device via the discovery portal URL:
HueSDK.Discovery.discover(HueSDK.Discovery.NUPNP)
{:nupnp, [%HueSDK.Bridge{}]}Discovering a Hue Bridge device via multicast DNS:
HueSDK.Discovery.discover(HueSDK.Discovery.MDNS)
{:mdns, [%HueSDK.Bridge{}]}Discovering a Hue Bridge device via a manually supplied IP address :
HueSDK.Discovery.discover(HueSDK.Discovery.ManualIP, ip_address: "127.0.0.1")
{:manual_ip, [%HueSDK.Bridge{}]}An empty list is returned if no Hue Bridge devices are found:
HueSDK.Discovery.discover(HueSDK.Discovery.ManualIP, ip_address: "000.0.0.0")
{:mdns, []}If invalid options are given, a NimbleOptions.ValidationError is raised:
HueSDK.Discovery.discover(HueSDK.Discovery.ManualIP, invalid_opt: :invalid_opt)
** (NimbleOptions.ValidationError) unknown options [:invalid_opt], valid options are: [:ip_address, :mdns_namespace, :max_attempts, :sleep]Options
:ip_address- The IP address of the Hue Bridge, required for manual discovery.:mdns_namespace- The multicast DNS namespace to query. The default value is"_hue._tcp.local".:max_attempts- How many discovery attempts are made before giving up. The default value is10.:sleep- How long to wait in miliseconds between each attempt. The default value is5000.
Link to this section Callbacks
Specs
do_discovery(keyword()) :: discovery_result()
Attempts to discover all available Hue Bridge devices on the local network.
See HueSDK.Discovery.discover/2 for more information.