-
Notifications
You must be signed in to change notification settings - Fork 1
/
test.py
32 lines (26 loc) · 1.02 KB
/
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
import logging
logging.basicConfig( filename='app.log', level=logging.DEBUG )
logger = logging.getLogger(__name__)
logger.debug("processor.py loaded")
from pymongo import MongoClient
db = MongoClient().monitor
from smartthings import SmartThings, ACCOUNTS, THINGS, STATES, CALLS
token = "6a2eb151-8247-4ff3-adda-342a9c0f2b20"
st = SmartThings( token )
#db.things.delete_many({})
print "Things collection has {0} documents.".format(db.things.count())
#db.states.delete_many({})
print "States collection has {0} documents.".format(db.states.count())
#things = st.things("thermostat")
#things = st.things("humidity")
things = st.things("temperature")
#things = st.things("all")
#print things.count()
for thing in things[:]:
#states = st.states(thing["id"], "temperature")
print st.states_range(thing["id"], "temperature")
#if states:
#for state in states:
#print state
print "Things collection has {0} documents.".format(db.things.count())
print "States collection has {0} documents.".format(db.states.count())