mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-11-15 14:48:43 +00:00
Add plumbing for passing credentials to devices (#507)
* Add plumbing for passing credentials as far as discovery * Pass credentials to Smart devices * Rename authentication exception * Fix tests failure due to test_json_output leaving echo as nop * Fix test_credentials test * Do not print credentials, fix echo function bug and improve get type parameter * Add device class constructor test * Add comment for echo handling and move assignment
This commit is contained in:
@@ -14,6 +14,7 @@ from kasa.smartdevice import (
|
||||
)
|
||||
from kasa.smartplug import SmartPlug
|
||||
|
||||
from .credentials import Credentials
|
||||
from .modules import Antitheft, Countdown, Emeter, Schedule, Time, Usage
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
@@ -79,8 +80,14 @@ class SmartStrip(SmartDevice):
|
||||
For more examples, see the :class:`SmartDevice` class.
|
||||
"""
|
||||
|
||||
def __init__(self, host: str, *, port: Optional[int] = None) -> None:
|
||||
super().__init__(host=host, port=port)
|
||||
def __init__(
|
||||
self,
|
||||
host: str,
|
||||
*,
|
||||
port: Optional[int] = None,
|
||||
credentials: Optional[Credentials] = None,
|
||||
) -> None:
|
||||
super().__init__(host=host, port=port, credentials=credentials)
|
||||
self.emeter_type = "emeter"
|
||||
self._device_type = DeviceType.Strip
|
||||
self.add_module("antitheft", Antitheft(self, "anti_theft"))
|
||||
|
||||
Reference in New Issue
Block a user