Method ProbeAsync
- Namespace
- Yeelight
- Assembly
- YeelightClient.dll
ProbeAsync(IPAddress, CancellationToken)
Asks one address whether a Yeelight light is there, with a search that is sent straight to it. For networks that do not pass the multicast or the broadcast of a search (a VPN, a network with its lights on another subnet): a light answers a search that is sent to it, wherever it is, as long as the address can be reached.
public Task<YeelightDevice?> ProbeAsync(IPAddress address, CancellationToken cancellationToken = default)
Parameters
addressIPAddressThe IP address of the light, on the local network (a private, link-local or loopback address).
cancellationTokenCancellationTokenTo stop waiting.
Returns
- Task<YeelightDevice>
The light (it is in Devices from now on), or
nullwhen nothing answered within three seconds.
Exceptions
- ArgumentNullException
addressisnull.- ArgumentException
The address is not an address of the local network.
- ObjectDisposedException
The client is disposed.
- OperationCanceledException
The wait was cancelled, or the client was disposed while it waited.
ProbeAsync(IPAddress, int, CancellationToken)
Asks one address whether a Yeelight light is there, on a UDP port other than the usual one (DiscoveryPort). For a simulator, or a light behind a forwarded port. See ProbeAsync(IPAddress, CancellationToken).
public Task<YeelightDevice?> ProbeAsync(IPAddress address, int port, CancellationToken cancellationToken = default)
Parameters
addressIPAddressThe IP address of the light, on the local network (a private, link-local or loopback address).
portintThe UDP port that the light answers searches on, from 1 to 65535.
cancellationTokenCancellationTokenTo stop waiting.
Returns
- Task<YeelightDevice>
The light (it is in Devices from now on), or
nullwhen nothing answered within three seconds.
Exceptions
- ArgumentNullException
addressisnull.- ArgumentException
The address is not an address of the local network.
- ArgumentOutOfRangeException
portis not a port.- ObjectDisposedException
The client is disposed.
- OperationCanceledException
The wait was cancelled, or the client was disposed while it waited.
ProbeAsync(string, CancellationToken)
Asks one address whether a Yeelight light is there. See ProbeAsync(IPAddress, CancellationToken).
public Task<YeelightDevice?> ProbeAsync(string address, CancellationToken cancellationToken = default)
Parameters
addressstringThe IP address of the light, for example
192.168.1.50.cancellationTokenCancellationTokenTo stop waiting.
Returns
- Task<YeelightDevice>
The light, or
nullwhen nothing answered within three seconds.
Exceptions
- ArgumentNullException
addressisnull.- ArgumentException
The text is not an IP address, or not one of the local network.
- ObjectDisposedException
The client is disposed.
- OperationCanceledException
The wait was cancelled, or the client was disposed while it waited.