- Rename USERNAME/PASSWORD to UNIFI_USERNAME/UNIFI_PASSWORD to avoid conflict with the Windows USERNAME system environment variable - Set both speakerSettings.volume and speakerSettings.speakerVolume in the PATCH request - Log volume before and after the change to verify it took effect
30 lines
803 B
Python
30 lines
803 B
Python
import json
|
|
import os
|
|
|
|
import httpx
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
BASE = f"https://{os.environ['HOST']}/proxy/protect/integration/v1"
|
|
HEADERS = {"X-API-Key": os.environ["API_KEY"]}
|
|
CAMERA_NAME = "G6 Pro 360"
|
|
|
|
|
|
def main():
|
|
with httpx.Client(headers=HEADERS, verify=False) as client:
|
|
cameras = client.get(f"{BASE}/cameras").raise_for_status().json()
|
|
camera = next(c for c in cameras if CAMERA_NAME in c["name"])
|
|
|
|
print("=== Camera ===")
|
|
data = client.get(f"{BASE}/cameras/{camera['id']}").raise_for_status().json()
|
|
print(json.dumps(data, indent=2))
|
|
|
|
print("\n=== Sensors ===")
|
|
sensors = client.get(f"{BASE}/sensors").raise_for_status().json()
|
|
print(json.dumps(sensors, indent=2))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|