Example #1
0
 def __init__(self):
     GPIO.setwarnings(False)
     GPIO.setmode(GPIO.BOARD)
     GPIO.setup(Relay1, GPIO.OUT)
     GPIO.setup(Relay2, GPIO.OUT)
     GPIO.setup(Relay3, GPIO.OUT)
     GPIO.setup(Relay4, GPIO.OUT)
     self.logger = get_logger('Relay')
Example #2
0
 def __init__(self):
     '''Set up logging and main variables
        Args:
            self:
        Returns:
            None:
        Raises:
            None
     '''               
     
     self._logger = get_logger('LogSensorExtra')
     self._activity_type = "Environment_Observation"
Example #3
0
File: Fan.py Project: 18heim/MVP
 def __init__(self):
     self.logger = get_logger("Fan")
     self.logger.debug("initialize Fan object")
     self.relay = Relay()
     self.fan_relay = fanPin
Example #4
0
 def __init__(self):
     '''Get distances for determining reservoir levels'''
     self.res = {'full': full_ec, 'empty': empty_ec, 'timeout': timeout}
     self._activity_type = 'Agronomic_Activity'
     self._logger = get_logger('LogReservoir')
Example #5
0
 def __init__(self):
     self.r = Relay()
     self.logger = get_logger('Light')
from transitions import Machine
from time import time
from LogUtil import get_logger
import random
import json

logger = get_logger(__name__)

with open("./Config/application.conf", "r") as confFile:
    conf = json.load(confFile)
with open("./Config/Images.conf", "r") as imgFile:
    imgs = json.load(imgFile)
'''
with open("./Config/Sequence.conf", "r") as seqFile:
    seq = json.load(seqFile)
'''

# TODO: must use declaration variables to avoid initial internal declaration
class Smile(object):
    def __init__(self):
        self.heat = False
        self.time_elapsed = False
        self.long_time_elapsed = False
        self.attempts = 0
        self.people = 0.0
        self.smiles = 0.0
        self.max_wait = 3.0
        self.message = False
        self.language = 0 # 0: cast, 1: port, 2: galego
        self.initial_time = time()
        self.initial_long_wait_time = time()
Example #7
0
UNITS = 8
PARTICIPANT = 9
STATUS = 10
COMMENT = 11

url = 'http://*****:*****@localhost:5984'
db_name = 'mvp_data'

usr = '******'
pwd = 'admin'
server = Server()
#db = server.create(db_name)
#server.resource.credentials = (usr, pwd)
db = server[db_name]

logger = get_logger('CouchUtil')



def processEnv(row):
    '''
    Environment specific processing
    Args:
        doc: list of attributes, should be of format:
             [timestamp, field, activity_name, trial, plot, subject, attribute, value, units, participant, status_qualifier, comment]
             participant may be a device string, or a list: ['person':'hmw']
    Returns:
        rec: json formatted record ready for the database
    Throws:
        None
Example #8
0
sudo pip install couchdb
sudo pip install pygal
sudo pip install json

# Temperature chart with data from CouchDB
# Author: Howard Webb
# Date: 3/5/2018
'''
import pygal
from couchdb import Server
import json
from datetime import datetime
from MVP_Util import UTCStrToLDT
from LogUtil import get_logger

logger = get_logger('TempChart')
#Use a view in CouchDB to get the data
#use the first key for attribute type
#order descending so when limit the results will get the latest at the top


def getResults(test=False):
    '''Run a Mango query to get the data'''
    ts = datetime.utcnow().isoformat()[:19]
    payload = {
        "selector": {
            "start_date.timestamp": {
                "$lt": ts
            },
            "status.status_qualifier": "Success",
            "activity_type": "Environment_Observation",
Example #9
0
 def __init__(self):
     """Standard constructor
     Get and hold a Python logger
     """
     self.logger = get_logger('CouchHeartbeat')
Example #10
0
 def __init__(self):
     '''Initialize the object'''
     self.solenoidPin = Relay4
     self.Relay=Relay()
     self._logger = get_logger('Solenoid')
     self.activity_type = 'State_Change'
Example #11
0
# Temperature chart with data from CouchDB
# Author: Howard Webb
# Date: 3/5/2018

import pygal
from couchdb import Server
import json
from datetime import datetime
from MVP_Util import UTCStrToLDT
<<<<<<< Updated upstream
=======
from LogUtil import get_logger

logger = get_logger('HumidityChart')
>>>>>>> Stashed changes

#Use a view in CouchDB to get the data
#use the first key for attribute type
#order descending so when limit the results will get the latest at the top

def getResults(test=False):
    '''Run a Mango query to get the data'''
    ts = datetime.utcnow().isoformat()[:19]
    payload={"selector":{"start_date.timestamp":{"$lt":ts}, "status.status_qualifier":"Success", "activity_type":"Environment_Observation", "subject.name":"Air","subject.attribute.name": "Humidity"}, "fields":["start_date.timestamp", "subject.attribute.value"], "sort":[{"start_date.timestamp":"desc"}], "limit":250}        
    db_name = 'mvp_data'
    if test:
        print payload
    server = Server()
    db = server[db_name]
    return db.find(payload)
    
Example #12
0
"""
# Check status on boot
# Check lights correctly set
# Make sure Solenoid is closed
"""

from Light import *
from env import env
from datetime import datetime
from datetime import timedelta
from LogUtil import get_logger

logger = get_logger()

m = "{} {}".format("StartUp time: ", datetime.now())
logger.info(m)


def check(test=False):
    """Main function to run what needs to be done at restart
    Args:
        test: flag for testing system
    Returns:
        None
    Raises:
        None
    """
    checkLight(test)


def checkLight(test=False):