Welcome to mirror list, hosted at ThFree Co, Russian Federation.

sync.py - github.com/ClusterM/google-assistant-smart-home.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 597823ec97522ac1eb5f73d0418890e977677003 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/python3

import requests
import json
import os
import config

users = os.listdir(config.USERS_DIRECTORY)
for user_file in users:
    user = user_file.replace(".json", "")
    print("User:", user, "... ", end="", flush=True)
    payload = {"agentUserId": user}
    url = "https://homegraph.googleapis.com/v1/devices:requestSync?key=" + config.API_KEY
    r = requests.post(url, data=json.dumps(payload))
    if r.text.strip() == "{}":
        print("OK")
    else:
        print("ERROR")
        print(r.text)