コード例 #1
0
 def __init__(self, argv):
     self.appClass = "control"
     self.state = "stopped"
     self.devices = []
     self.idToName = {} 
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #2
0
    def __init__(self, argv):
        self.appClass           = "control"
        self.state              = "stopped"
        self.id2addr            = {}          # Node id to node address mapping
        self.id2addr[0]         = 0           # For including
        self.addr2id            = {}          # Node address to node if mapping
        self.addr2id[0]         = 0
        self.maxAddr            = 0
        self.radioOn            = True
        self.messageQueue       = []
        self.sentTo             = []
        self.includeGrants      = []
        self.nodeConfig         = {} 
        self.wakeups            = {}
        self.wakeupCount        = {}
        self.beaconCalled       = 0
        self.including          = []
        self.sendingConfig      = []
        self.buttonState        = {}
        self.requestBatteries   = []
        self.nextWakeupTime     = {}
        self.beaconInterval     = 6
        self.beaconRunning      = False
        #self.ackCount          = 0           # Used purely for test of nack

        # Super-class init must be called
        CbApp.__init__(self, argv)
コード例 #3
0
 def __init__(self, argv):
     logging.basicConfig(filename=CB_LOGFILE,level=CB_LOGGING_LEVEL,format='%(asctime)s %(message)s')
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     configFile = CB_CONFIG_DIR + "csv_writer.config"
     global config
     try:
         with open(configFile, 'r') as configFile:
             newConfig = json.load(configFile)
             logging.info('%s Read eew_app.config', ModuleName)
             config.update(newConfig)
     except:
         logging.warning('%s eew_app.config does not exist or file is corrupt', ModuleName)
     for c in config:
         if c.lower in ("true", "t", "1"):
             config[c] = True
         elif c.lower in ("false", "f", "0"):
             config[c] = False
     logging.debug('%s Config: %s', ModuleName, config)
     self.accel = []
     self.gyro = []
     self.magnet = []
     self.temp = []
     self.irTemp = []
     self.buttons = []
     self.humidity = []
     self.binary = []
     self.luminance = []
     self.power = []
     self.devices = []
     self.devServices = [] 
     self.idToName = {} 
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #4
0
 def __init__(self, argv):
     logging.basicConfig(filename=CB_LOGFILE,level=CB_LOGGING_LEVEL,format='%(asctime)s %(message)s')
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     configFile = CB_CONFIG_DIR + "csv_writer.config"
     global config
     try:
         with open(configFile, 'r') as configFile:
             newConfig = json.load(configFile)
             logging.info('%s Read eew_app.config', ModuleName)
             config.update(newConfig)
     except:
         logging.warning('%s eew_app.config does not exist or file is corrupt', ModuleName)
     for c in config:
         if c.lower in ("true", "t", "1"):
             config[c] = True
         elif c.lower in ("false", "f", "0"):
             config[c] = False
     logging.debug('%s Config: %s', ModuleName, config)
     self.accel = []
     self.gyro = []
     self.magnet = []
     self.temp = []
     self.irTemp = []
     self.buttons = []
     self.humidity = []
     self.binary = []
     self.luminance = []
     self.power = []
     self.devices = []
     self.devServices = [] 
     self.idToName = {} 
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #5
0
    def __init__(self, argv):
        self.appClass = "control"
        self.state = "stopped"
        self.id2addr = {}  # Node id to node address mapping
        self.id2addr[0] = 0  # For including
        self.addr2id = {}  # Node address to node if mapping
        self.addr2id[0] = 0
        self.maxAddr = 0
        self.radioOn = True
        self.messageQueue = []
        self.sentTo = []
        self.includeGrants = []
        self.nodeConfig = {}
        self.wakeups = {}
        self.wakeupCount = {}
        self.beaconCalled = 0
        self.including = []
        self.sendingConfig = []
        self.buttonState = {}
        self.requestBatteries = []
        self.nextWakeupTime = {}
        self.beaconInterval = 6
        self.beaconRunning = False
        #self.ackCount          = 0           # Used purely for test of nack

        # Super-class init must be called
        CbApp.__init__(self, argv)
コード例 #6
0
 def __init__(self, argv):
     self.state = "stopped"
     self.devices = []
     self.idToName = {} 
     self.buttonStates = {}
     self.beaconAdaptor = None
     self.lastSent = 0  # When a message was last sent to the client
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #7
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     self.devices = []
     self.idToName = {} 
     self.entryExit = EntryExit()
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #8
0
ファイル: km_app.py プロジェクト: ContinuumBridge/km_app
 def __init__(self, argv):
     self.smokeId = None
     self.switchId = None
     self.gpioId = None
     self.smokeConnected = True
     self.switchConnected = True
     self.km = None
     self.dm = None
     CbApp.__init__(self, argv)
コード例 #9
0
 def __init__(self, argv):
     self.appClass = "control"
     self.state = "stopped"
     self.switchState = "off"
     self.gotSwitch = False
     self.sensorsID = [] 
     self.switchID = ""
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #10
0
 def __init__(self, argv):
     self.appClass = "control"
     self.state = "stopped"
     self.switchState = "off"
     self.gotSwitch = False
     self.sensorsID = []
     self.switchID = ""
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #11
0
 def __init__(self, argv):
     logging.basicConfig(filename=CB_LOGFILE,level=CB_LOGGING_LEVEL,format='%(asctime)s %(message)s')
     self.appClass = "control"
     self.state = "stopped"
     self.gotSwitch = False
     self.buttonsID = [] 
     self.switchID = ""
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #12
0
 def __init__(self, argv):
     self.smokeId = None
     self.switchId = None
     self.gpioId = None
     self.smokeConnected = True
     self.switchConnected = True
     self.km = None
     self.dm = None
     CbApp.__init__(self, argv)
コード例 #13
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.devices = []
     self.status = "ok"
     self.idToName = {} 
     self.sensorsID = []
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #14
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     self.devices = []
     self.idToName = {}
     self.medicine = {}
     self.gotSensor = []
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #15
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     self.devices = []
     self.devServices = [] 
     self.idToName = {} 
     self.hotDrinks = HotDrinks()
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #16
0
 def __init__(self, argv):
     self.appClass = "control"
     self.state = "stopped"
     self.sensorsID = [] 
     self.onSensors = []
     self.devices = []
     self.idToName = {} 
     self.lastTrigger = 0
     reactor.callLater(10, self.resetSensors)
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #17
0
 def __init__(self, argv):
     self.appClass = "control"
     self.state = "stopped"
     self.devices = []
     self.idToName = {}
     self.knownBeacons = []
     self.beaconState = {}
     self.lastSeen = {}
     self.lastReportTime = time.time()
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #18
0
ファイル: main.py プロジェクト: ContinuumBridge/uwe_app
    def __init__(self, argv):

        self.store = DataStore()
        self.store.register(TemperatureData)

        logging.basicConfig(filename=CB_LOGFILE,level=CB_LOGGING_LEVEL,format='%(asctime)s %(message)s')
        self.appClass = "control"
        self.state = "stopped"
        self.sensorID = ""
        self.switchID = ""
        #CbApp.__init__ MUST be called
        CbApp.__init__(self, argv)
コード例 #19
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     self.devices = []
     self.devTypes = {} 
     self.idToName = {} 
     self.entryExitIDs = []
     self.hotDrinkIDs = []
     self.nightWander = NightWander()
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #20
0
 def __init__(self, argv):
     self.appClass = "control"
     self.state = "stopped"
     self.colourIndex = 1
     self.brightnesses = {"soft_white": "0",
         "cold_white": "255",
         "red": "0",
         "green": "0",
         "blue": "0"
     }
     self.brightness = 255
     self.gotSwitch = False
     self.sensorsID = [] 
     self.switchID = ""
     # Super-class init must be called
     CbApp.__init__(self, argv)
コード例 #21
0
    def __init__(self, argv):
        self.appClass       = "control"
        self.state          = "stopped"
        self.id2addr        = {}          # Node id to node address mapping
        self.addr2id        = {}          # Node address to node if mapping
        self.maxAddr        = 0
        self.radioOn        = True
        self.messageQueue   = []
        self.sentTo         = []
        self.nodeConfig     = {} 
        self.beaconCalled   = 0
        self.including      = []
        self.sendingConfig  = []
        self.buttonState    = {}

        # Super-class init must be called
        CbApp.__init__(self, argv)
コード例 #22
0
 def __init__(self, argv):
     self.state = "stopped"
     self.concConnected = False
     self.bridgeConnected = False
     self.temp = []
     self.humidity = []
     self.binary = []
     self.buttons = []
     self.luminance = []
     self.battery = []
     self.connected = []
     self.devices = []
     self.idToName = {} 
     self.switchTimes = []
     self.boilerID = "unknown"
     reactor.callLater(30, self.switchBoiler)
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #23
0
 def __init__(self, argv):
     logging.basicConfig(filename=CB_LOGFILE,level=CB_LOGGING_LEVEL,format='%(asctime)s %(message)s')
     self.appClass = "control"
     self.state = "stopped"
     self.gotSwitch = False
     self.sensorID = ""
     self.switchID = ""
     # Temporary botch - set temperature from a file
     try:
         tempFile = CB_CONFIG_DIR + 'set-temp'
         with open(tempFile, 'r') as f:
             s = f.read()
         if s.endswith('\n'):
             s = s[:-1]
         SET_TEMP = s
         logging.debug("%s Set temperature: %s", ModuleName, SET_TEMP)
     except:
         logging.debug("%s Could not read set-temp file", ModuleName)
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #24
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     self.accel = []
     self.gyro = []
     self.magnet = []
     self.temp = []
     self.irTemp = []
     self.buttons = []
     self.humidity = []
     self.binary = []
     self.luminance = []
     self.power = []
     self.battery = []
     self.connected = []
     self.devices = []
     self.idToName = {} 
     self.dm = DataManager()
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #25
0
 def __init__(self, argv):
     self.appClass = "monitor"
     self.state = "stopped"
     self.status = "ok"
     self.accel = []
     self.gyro = []
     self.magnet = []
     self.temp = []
     self.irTemp = []
     self.buttons = []
     self.humidity = []
     self.binary = []
     self.luminance = []
     self.power = []
     self.battery = []
     self.connected = []
     self.devices = []
     self.devServices = []
     self.idToName = {}
     self.entryExitIDs = []
     #CbApp.__init__ MUST be called
     CbApp.__init__(self, argv)
コード例 #26
0
 def __init__(self, argv):
     logging.basicConfig(filename=CB_LOGFILE,level=CB_LOGGING_LEVEL,format='%(asctime)s %(message)s')
     self.appClass = "control"
     self.state = "stopped"
     self.gotSwitch = False
     self.switchState = "off" 
     self.sensorsID = [] 
     self.switchID = ""
     configFile = CB_CONFIG_DIR + "toasty.json"
     global ontimes, offtimes
     try:
         with open(configFile, 'r') as configFile:
             config = json.load(configFile)
             ontimes = config["ontimes"]
             logging.debug("%s ontimes: %s", ModuleName, ontimes)
             offtimes = config["offtimes"]
             logging.debug("%s offtimes: %s", ModuleName, offtimes)
             logging.info('%s Read toasty.json', ModuleName)
     except Exception as ex:
         logging.warning('%s toasty.json does not exist or file is corrupt', ModuleName)
         logging.warning("%s Exception: %s %s", ModuleName, type(ex), str(ex.args))
     # Super-class init must be called
     CbApp.__init__(self, argv)