mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-08-04 01:34:12 +00:00
Move connect_single to SmartDevice.connect (#538)
This refactors `Discover.connect_single` by moving device instance construction into a separate device factory module. New `SmartDevice.connect(host, *, port, timeout, credentials, device_type)` class method replaces the functionality of `connect_single`, and also now allows constructing device instances without relying on UDP discovery for type discovery if `device_type` parameter is set. --------- Co-authored-by: Teemu R. <tpr@iki.fi>
This commit is contained in:
@@ -12,6 +12,21 @@ or if you are just looking to access some information that is not currently expo
|
||||
.. contents:: Contents
|
||||
:local:
|
||||
|
||||
.. _initialization:
|
||||
|
||||
Initialization
|
||||
**************
|
||||
|
||||
Use :func:`~kasa.Discover.discover` to perform udp-based broadcast discovery on the network.
|
||||
This will return you a list of device instances based on the discovery replies.
|
||||
|
||||
If the device's host is already known, you can use to construct a device instance with
|
||||
:meth:`~kasa.SmartDevice.connect()`.
|
||||
|
||||
When connecting a device with the :meth:`~kasa.SmartDevice.connect()` method, it is recommended to
|
||||
pass the device type as well as this allows the library to use the correct device class for the
|
||||
device without having to query the device.
|
||||
|
||||
.. _update_cycle:
|
||||
|
||||
Update Cycle
|
||||
|
Reference in New Issue
Block a user