
Security News
NVD Quietly Sweeps 100K+ CVEs Into a “Deferred” Black Hole
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
This is a fork of original work of @K4CZP3R
The purpose of this fork is to provide the library as PyPi package.
pip install plugp100
The library was rewritten by taking inspiration from Component Gaming Design Pattern to achieve better decoupling from device and its capabilities.
Each Tapo Device, now, is something like a container of Device Component. A Device Component represent a specific feature, so a Tapo Device can be composed by multiple device component.
e.g. EnergyComponent
, OverheatComponent
, OnOffComponent
and so on.
There 3 main Tapo Device class family, which simplify access to underlying components:
This library supports a wide range of Tapo devices, including:
Every device class has more than one component which enrich the basic capability of Tapo Device.
You can see the supported components inside plugp100/new/components
package.
Replace <tapo_username>
, <tapo_password>
, and <tapo_device_ip>
with your Tapo account credentials and device IP address.
Before using the library, make sure to have your Tapo credentials ready:
from plugp100.common.credentials import AuthCredential
credentials = AuthCredential("<tapo_username>", "<tapo_password>")
Use the library to discover Tapo devices on the network:
import asyncio
import logging
from plugp100.common.credentials import AuthCredential
from plugp100.discovery.tapo_discovery import TapoDiscovery
async def example_discovery(credentials: AuthCredential):
discovered = await TapoDiscovery.scan(timeout=5)
for discovered_device in discovered:
try:
device = await discovered_device.get_tapo_device(credentials)
await device.update()
print({
'type': type(device),
'protocol': device.protocol_version,
'raw_state': device.raw_state
})
await device.client.close()
except Exception as e:
logging.error(f"Failed to update {discovered_device.ip} {discovered_device.device_type}", exc_info=e)
async def main():
credentials = AuthCredential("<tapo_username>", "<tapo_password>")
await example_discovery(credentials)
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()
Connect to a Tapo device without knowing its device type and protocol. The library will try to guess:
import asyncio
from plugp100.common.credentials import AuthCredential
from plugp100.new.device_factory import connect, DeviceConnectConfiguration
async def example_connect_by_guessing(credentials: AuthCredential, host: str):
device_configuration = DeviceConnectConfiguration(
host=host,
credentials=credentials
)
device = await connect(device_configuration)
await device.update()
print({
'type': type(device),
'protocol': device.protocol_version,
'raw_state': device.raw_state,
'components': device.get_device_components
})
async def main():
credentials = AuthCredential("<tapo_username>", "<tapo_password>")
await example_connect_by_guessing(credentials, "<tapo_device_ip>")
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()
Connect to a Tapo device with known device type and protocol details:
import asyncio
from plugp100.common.credentials import AuthCredential
from plugp100.new.device_factory import connect, DeviceConnectConfiguration
async def example_connect_knowing_device_and_protocol(credentials: AuthCredential, host: str):
device_configuration = DeviceConnectConfiguration(
host=host,
credentials=credentials,
device_type="SMART.TAPOPLUG",
encryption_type="klap",
encryption_version=2
)
device = await connect(device_configuration)
await device.update()
print({
'type': type(device),
'protocol': device.protocol_version,
'raw_state': device.raw_state,
'components': device.get_device_components
})
async def main():
credentials = AuthCredential("<tapo_username>", "<tapo_password>")
await example_connect_knowing_device_and_protocol(credentials, "<tapo_device_ip>")
if __name__ == "__main__":
loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.run_until_complete(asyncio.sleep(0.1))
loop.close()
FAQs
Controller for TP-Link Tapo P100 and other devices
We found that plugp100 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
NVD now marks all pre-2018 CVEs as "Deferred," signaling it will no longer enrich older vulnerabilities, further eroding trust in its data.
Research
Security News
Lazarus-linked threat actors expand their npm malware campaign with new RAT loaders, hex obfuscation, and over 5,600 downloads across 11 packages.
Security News
Safari 18.4 adds support for Iterator Helpers and two other TC39 JavaScript features, bringing full cross-browser coverage to key parts of the ECMAScript spec.