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:
sdb9696
2023-09-13 14:46:38 +01:00
committed by GitHub
parent f7c22f0a0c
commit 7bb4a456a2
13 changed files with 258 additions and 41 deletions

View File

@@ -1,6 +1,7 @@
"""Module for light strips (KL430)."""
from typing import Any, Dict, List, Optional
from .credentials import Credentials
from .effects import EFFECT_MAPPING_V1, EFFECT_NAMES_V1
from .smartbulb import SmartBulb
from .smartdevice import DeviceType, SmartDeviceException, requires_update
@@ -41,8 +42,14 @@ class SmartLightStrip(SmartBulb):
LIGHT_SERVICE = "smartlife.iot.lightStrip"
SET_LIGHT_METHOD = "set_light_state"
def __init__(self, host: str, *, port: Optional[int] = None) -> None:
super().__init__(host, port=port)
def __init__(
self,
host: str,
*,
port: Optional[int] = None,
credentials: Optional[Credentials] = None,
) -> None:
super().__init__(host, port=port, credentials=credentials)
self._device_type = DeviceType.LightStrip
@property # type: ignore