forked from rcastberg/sure_petcare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hass_test.py
executable file
·36 lines (28 loc) · 1006 Bytes
/
hass_test.py
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
29
30
31
32
33
34
35
36
#!/usr/bin/env python3
# "Unit test" for Home Assistent component. Doesn't actually test anything,
# just instantiates the component and then prints what will be passed along
# to Home Assistant.
#
# ** IMPORTANT **
#
# If the following parameters are not changed, it will use the default cache
# file which *MUST* be initialised with credentials. If this has not been
# created by other means, either modify `user` and `pw` as appropriate OR
# create a cache file using the CLI tool:
#
# sp-cli.py -e [email protected] -p SECRET --update
#
# If using a non-default cache file:
#
# sp-cli.py -c /path/to/cache-file -e [email protected] -p SECRET --update
user = None
pw = None
cache_file = None
import home_assistant.sure_petflap as Dut
from pprint import pprint
import json
dut = Dut.SurePetConnect( user, pw, debug = True, cache_file = cache_file )
print( '--- state (decoded JSON):' )
pprint( json.loads( dut.state ) )
print( '\n--- state attributes:' )
pprint( dut.state_attributes )