mirror of
https://github.com/python-kasa/python-kasa.git
synced 2025-12-01 05:38:33 +00:00
Add support for HS300 power strip (#137)
* discover runs, prints on since of device 0 * added preliminary support for HS300 * forgot to add smartdevice to commit * added index to CLI * clean up dirty code * added fake sysinfo_hs300 * changed device alias to match MAC * #131 Move _id_to_index into smartstrip so everyone can pass index * Update pyHS100/discover.py Co-Authored-By: jimboca <jimboca3@gmail.com> * refactoring to deduplicate code between smarplug and smartstrip * fixing CI failures for devices without children * incorporating feedback from pull request. * fixing hound violation * changed internal store from list of dicts to dict * changed other methods to dictionary store as well * removed unused optional type from imports * changed plugs to Dict, remove redundant sys_info calls * added more functionality for smart strip, added smart strip tests * updated FakeTransportProtocol for devices with children * corrected hound violations * add click-datetime
This commit is contained in:
8
pyHS100/discover.py
Normal file → Executable file
8
pyHS100/discover.py
Normal file → Executable file
@@ -3,7 +3,8 @@ import logging
|
||||
import json
|
||||
from typing import Dict, Type
|
||||
|
||||
from pyHS100 import TPLinkSmartHomeProtocol, SmartDevice, SmartPlug, SmartBulb
|
||||
from pyHS100 import (TPLinkSmartHomeProtocol, SmartDevice, SmartPlug,
|
||||
SmartBulb, SmartStrip)
|
||||
|
||||
_LOGGER = logging.getLogger(__name__)
|
||||
|
||||
@@ -98,7 +99,10 @@ class Discover:
|
||||
type = "UNKNOWN"
|
||||
else:
|
||||
_LOGGER.error("No 'system' nor 'get_sysinfo' in response")
|
||||
if "smartplug" in type.lower():
|
||||
|
||||
if "smartplug" in type.lower() and "children" in sysinfo:
|
||||
return SmartStrip
|
||||
elif "smartplug" in type.lower():
|
||||
return SmartPlug
|
||||
elif "smartbulb" in type.lower():
|
||||
return SmartBulb
|
||||
|
||||
Reference in New Issue
Block a user