feat(tapo-agent): add schedule/countdown timer API support

- Fork tapo crate to add missing schedule/timer APIs
- Add get_countdown_rules, get_schedule_rules, get_next_event methods
- New readings: countdown_active, countdown_remain, schedule_count,
  schedule_active_count, next_event_time
- Add local compilation to build script alongside cross-compilation
- Implement offline polling - device collection continues when server disconnects
- Add more device readings: on_time, signal_level, rssi, runtime_today/month, energy_month

Vendored tapo fork in tapo-fork/ with minimal changes to add schedule APIs.
This commit is contained in:
seb
2025-12-23 00:46:42 +01:00
parent f3cca149f9
commit 028763bdb2
274 changed files with 20784 additions and 48 deletions

View File

@@ -0,0 +1,45 @@
"""P300 and P306 Example"""
import asyncio
import os
from tapo import ApiClient
async def main():
tapo_username = os.getenv("TAPO_USERNAME")
tapo_password = os.getenv("TAPO_PASSWORD")
ip_address = os.getenv("IP_ADDRESS")
client = ApiClient(tapo_username, tapo_password)
power_strip = await client.p300(ip_address)
device_info = await power_strip.get_device_info()
print(f"Device info: {device_info.to_dict()}")
print("Getting child devices...")
child_device_list = await power_strip.get_child_device_list()
print(f"Found {len(child_device_list)} plugs")
for index, child in enumerate(child_device_list):
print(f"=== ({index + 1}) {child.nickname} ===")
print(f"Device ID: {child.device_id}")
print(f"State: {child.device_on}")
plug = await power_strip.plug(device_id=child.device_id)
print("Turning device on...")
await plug.on()
print("Waiting 2 seconds...")
await asyncio.sleep(2)
print("Turning device off...")
await plug.off()
print("Waiting 2 seconds...")
await asyncio.sleep(2)
if __name__ == "__main__":
asyncio.run(main())