tolpo 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/README.md +256 -27
  2. package/package.json +7 -1
  3. package/pyproject.toml +4 -1
  4. package/src/tolpo/__init__.py +1 -1
  5. package/src/tolpo/api.py +111 -3
  6. package/src/tolpo/areas/__init__.py +187 -0
  7. package/src/tolpo/areas/automation.py +227 -0
  8. package/src/tolpo/areas/camera_detection.py +893 -0
  9. package/src/tolpo/areas/camera_media.py +745 -0
  10. package/src/tolpo/areas/camera_system.py +866 -0
  11. package/src/tolpo/areas/common.py +25 -0
  12. package/src/tolpo/areas/device_admin.py +650 -0
  13. package/src/tolpo/areas/doorbell.py +674 -0
  14. package/src/tolpo/areas/home_plan.py +229 -0
  15. package/src/tolpo/areas/hub.py +995 -0
  16. package/src/tolpo/areas/lights.py +798 -0
  17. package/src/tolpo/areas/lock.py +367 -0
  18. package/src/tolpo/areas/network.py +114 -0
  19. package/src/tolpo/areas/overview.py +21 -0
  20. package/src/tolpo/areas/pairing.py +127 -0
  21. package/src/tolpo/areas/plugs.py +660 -0
  22. package/src/tolpo/areas/vacuum.py +649 -0
  23. package/src/tolpo/automation/__init__.py +8 -0
  24. package/src/tolpo/automation/engine.py +456 -0
  25. package/src/tolpo/automation/events.py +81 -0
  26. package/src/tolpo/automation/graph.py +26 -0
  27. package/src/tolpo/automation/models.py +194 -0
  28. package/src/tolpo/automation/store.py +194 -0
  29. package/src/tolpo/automation/sun.py +28 -0
  30. package/src/tolpo/automation/tools.py +61 -0
  31. package/src/tolpo/calls.py +92 -0
  32. package/src/tolpo/cli.py +162 -3
  33. package/src/tolpo/config.py +48 -3
  34. package/src/tolpo/home.py +147 -0
  35. package/src/tolpo/mcp_server.py +37 -6
  36. package/src/tolpo/media.py +630 -0
  37. package/src/tolpo/network/__init__.py +5 -0
  38. package/src/tolpo/network/catalog.py +80 -0
  39. package/src/tolpo/network/config.py +123 -0
  40. package/src/tolpo/network/enforcement.py +184 -0
  41. package/src/tolpo/network/models.py +223 -0
  42. package/src/tolpo/network/providers.py +452 -0
  43. package/src/tolpo/network/service.py +422 -0
  44. package/src/tolpo/network/storage.py +132 -0
  45. package/src/tolpo/policy.py +88 -6
  46. package/src/tolpo/provision.py +729 -0
  47. package/src/tolpo/registry.py +362 -20
  48. package/src/tolpo/snapshot.py +441 -0
  49. package/src/tolpo/tsvideo.py +93 -0
  50. package/src/tolpo/views.py +4 -4
  51. package/src/tolpo/web/home.css +253 -0
  52. package/src/tolpo/web/home.html +56 -0
  53. package/src/tolpo/web/home.js +1413 -0
@@ -0,0 +1,25 @@
1
+ """Device methods that many areas need. Declared once here, so no two areas can disagree about their level.
2
+
3
+ Rule for every area: a method that only reads (`get_*`) is level 0. `set_device_info` carries many different actions
4
+ in its parameters (power, brightness, default state, name), so the method as a whole is level 2; reversible power and
5
+ brightness control does not go through the caller at all (it uses python-kasa's features in registry.py).
6
+ """
7
+
8
+ from .. import policy
9
+ from ..policy import Tier
10
+
11
+ SMART_KINDS = ["light", "plug", "switch", "sensor", "hub", "vacuum", "thermostat", "valve", "chime"] # not "lock": a lock has no declared methods on purpose
12
+ CAMERA_KINDS = ["camera", "doorbell"]
13
+
14
+ METHODS = [
15
+ policy.method("get_device_info", Tier.READ, SMART_KINDS, "Read the device's basic information."),
16
+ policy.method("get_device_usage", Tier.READ, SMART_KINDS, "Read how long the device has been on and its usage counters."),
17
+ policy.method("component_nego", Tier.READ, SMART_KINDS, "Read which features this device model supports."),
18
+ policy.method("get_connect_cloud_state", Tier.READ, SMART_KINDS, "Read whether the device is connected to the TP-Link cloud."),
19
+ policy.method("get_child_device_list", Tier.READ, ["hub"], "List the devices paired to a hub (SMART hubs such as the H100)."),
20
+ policy.method("getChildDeviceList", Tier.READ, ["hub"], "List the devices paired to a hub (camera-style hubs such as the H200)."),
21
+ policy.method("getChildDeviceComponentList", Tier.READ, ["hub"], "Read which features the devices paired to a hub support."),
22
+ policy.method("set_device_info", Tier.SETTING, SMART_KINDS, "Change a device setting such as its name or its power-on default."),
23
+ policy.method("getDeviceInfo", Tier.READ, CAMERA_KINDS, "Read the camera's basic information."),
24
+ policy.method("getAppComponentList", Tier.READ, CAMERA_KINDS, "Read which features this camera model supports."),
25
+ ]