fix speaker volume control and auth
- 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
This commit is contained in:
29
dump_camera.py
Normal file
29
dump_camera.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user