File: simulator_events.py

package info (click to toggle)
python-homeconnect 0.8.0-1.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 120 kB
  • sloc: python: 556; sh: 6; makefile: 5
file content (28 lines) | stat: -rw-r--r-- 706 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from homeconnect import HomeConnect
import webbrowser
import time

def print_status(app):
    print(app.name, app.status)



if __name__ == '__main__':
    client_id = input("Please enter the client ID: ")
    client_secret = input("Please enter the client secret: ")
    redirect_uri = input("Please enter the redirect URI: ")

    hc = HomeConnect(client_id, client_secret, redirect_uri, simulate=True)

    webbrowser.open(hc.get_authurl())

    auth_result = input("Please enter the URL redirected to: ")

    hc.get_token(auth_result)

    appliances = hc.get_appliances()

    for app in appliances:
        app.get_status()
        print_status(app)
        app.listen_events(callback=print_status)