add more pipelines
This commit is contained in:
parent
8492d0c1e5
commit
6d19b99a34
136
powerProfile.py
136
powerProfile.py
@ -15,20 +15,20 @@ import datetime
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
DBHOST = '172.16.2.17'
|
DBHOST = '172.16.2.18'
|
||||||
DBNAME = 'iot'
|
DBNAME = 'iot'
|
||||||
DBCOLL = 'iot'
|
DBCOLL = 'iot'
|
||||||
FILENAME = 'powerProfile.xls'
|
FILENAME = 'powerProfile.xls'
|
||||||
|
|
||||||
|
|
||||||
PIPELINE = [
|
PIPELINE_DISHWASHER = [
|
||||||
{'$match':
|
{'$match':
|
||||||
{
|
{
|
||||||
'metadata.device':'MeterbusHub',
|
'metadata.device':'MeterbusHub',
|
||||||
'metadata.timestamp':
|
'metadata.timestamp':
|
||||||
{
|
{
|
||||||
'$gt': datetime.datetime(2016, 6, 11, 12, 5, 0),
|
'$gt': datetime.datetime(2016, 6, 11, 19, 20, 0),
|
||||||
'$lt': datetime.datetime(2016, 6, 11, 15, 45, 0)
|
'$lt': datetime.datetime(2016, 6, 11, 21, 15, 0)
|
||||||
},
|
},
|
||||||
'data.decodedTelegram.frame.comment':'Dishwasher'}
|
'data.decodedTelegram.frame.comment':'Dishwasher'}
|
||||||
},
|
},
|
||||||
@ -45,6 +45,132 @@ PIPELINE = [
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
|
PIPELINE_LAUNDRY = [
|
||||||
|
{'$match':
|
||||||
|
{
|
||||||
|
'metadata.device':'MeterbusHub',
|
||||||
|
'metadata.timestamp':
|
||||||
|
{
|
||||||
|
'$gt': datetime.datetime(2016, 6, 12, 15, 0, 0),
|
||||||
|
'$lt': datetime.datetime(2016, 6, 12, 18, 0, 0)
|
||||||
|
},
|
||||||
|
'data.decodedTelegram.frame.comment':'Laundry'}
|
||||||
|
},
|
||||||
|
{'$project':
|
||||||
|
{
|
||||||
|
'_id':0,
|
||||||
|
'timestamp': '$metadata.timestamp',
|
||||||
|
'energy': '$data.energy',
|
||||||
|
'power': '$data.power'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$sort':
|
||||||
|
{'metadata.timestamp':1}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
PIPELINE_FREEZER_POWER = [
|
||||||
|
{'$match':
|
||||||
|
{
|
||||||
|
'metadata.device':'MeterbusHub',
|
||||||
|
'metadata.timestamp':
|
||||||
|
{
|
||||||
|
'$gt': datetime.datetime(2016, 6, 12, 0, 0, 0),
|
||||||
|
'$lt': datetime.datetime(2016, 6, 12, 23, 59, 59)
|
||||||
|
},
|
||||||
|
'data.decodedTelegram.frame.comment':'Freezer'}
|
||||||
|
},
|
||||||
|
{'$project':
|
||||||
|
{
|
||||||
|
'_id':0,
|
||||||
|
'timestamp': '$metadata.timestamp',
|
||||||
|
'energy': '$data.energy',
|
||||||
|
'power': '$data.power'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$sort':
|
||||||
|
{'metadata.timestamp':1}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
PIPELINE_LIGHT = [
|
||||||
|
{'$match':
|
||||||
|
{
|
||||||
|
'metadata.device':'MeterbusHub',
|
||||||
|
'metadata.timestamp':
|
||||||
|
{
|
||||||
|
'$gt': datetime.datetime(2016, 6, 23, 0, 0, 0),
|
||||||
|
'$lt': datetime.datetime(2016, 6, 23, 23, 59, 59)
|
||||||
|
},
|
||||||
|
'data.decodedTelegram.frame.comment':'Light'}
|
||||||
|
},
|
||||||
|
{'$project':
|
||||||
|
{
|
||||||
|
'_id':0,
|
||||||
|
'timestamp': '$metadata.timestamp',
|
||||||
|
'energy': '$data.energy',
|
||||||
|
'power': '$data.power'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$sort':
|
||||||
|
{'metadata.timestamp':1}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
PIPELINE_FREEZER_TEMPERATURE = [
|
||||||
|
{'$match':
|
||||||
|
{
|
||||||
|
'metadata.device':'ModbusHub',
|
||||||
|
'metadata.Slave':'Thermometer',
|
||||||
|
'metadata.timestamp':
|
||||||
|
{
|
||||||
|
'$gt': datetime.datetime(2016, 6, 18, 0, 0, 0),
|
||||||
|
'$lt': datetime.datetime(2016, 6, 18, 23, 59, 59)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$project':
|
||||||
|
{
|
||||||
|
'_id':0,
|
||||||
|
'timestamp':'$metadata.timestamp',
|
||||||
|
'temperature': '$data.t2'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$sort':
|
||||||
|
{'metadata.timestamp':1}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
PIPELINE_OUTDOOR_TEMPERATURE = [
|
||||||
|
{'$match':
|
||||||
|
{
|
||||||
|
'metadata.device':'MeterbusHub',
|
||||||
|
'metadata.consumer': 'Thermometer',
|
||||||
|
'metadata.timestamp':
|
||||||
|
{
|
||||||
|
'$gt': datetime.datetime(2016, 6, 23, 0, 0, 0),
|
||||||
|
'$lt': datetime.datetime(2016, 6, 24, 23, 59, 59)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$project':
|
||||||
|
{
|
||||||
|
'_id':0,
|
||||||
|
'timestamp': '$metadata.timestamp',
|
||||||
|
'temperature1': '$data.temperature1',
|
||||||
|
'temperature2': '$data.temperature2',
|
||||||
|
'temperature3': '$data.temperature3',
|
||||||
|
'temperature4': '$data.temperature4'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{'$sort':
|
||||||
|
{'metadata.timestamp':1}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
PIPELINE = PIPELINE_OUTDOOR_TEMPERATURE
|
||||||
|
|
||||||
class Stopwatch():
|
class Stopwatch():
|
||||||
def millis(self):
|
def millis(self):
|
||||||
@ -108,4 +234,4 @@ class DataAdder(object):
|
|||||||
|
|
||||||
|
|
||||||
dataAdder = DataAdder(DBHOST, DBNAME, DBCOLL, FILENAME, PIPELINE)
|
dataAdder = DataAdder(DBHOST, DBNAME, DBCOLL, FILENAME, PIPELINE)
|
||||||
dataAdder.run()
|
dataAdder.run()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user