Ejemplo n.º 1
0
def main():
    gate = Ubigate('marmitek-gw',
                   default_file='resources/conf.json.default')

    logger.info("Starting application")
    logger.debug('Timezone: %s' % gate.timezone)

    for data in mochad_reader.run(gate.timezone):
        if data['type'] != 'error':
            try:
                data['house'] = gate.find_house(data['sensor'])
            except KeyError:
                logger.warning("Unknown sensor: %s" % data['sensor'])
            else:
                # Appending house prefix if dealing with door sensor
                if data['sensorKind'] == 'door':
                    for house in gate.config['houses']:
                        if house['id'] == data['house']:
                            prefix = house['prefix']
                            break
                    else:
                        prefix = ''
                    data['sensor'] = prefix.lower() + data['sensor']

                topic = "/marmitek/sensor/%s" % data['sensor']
                gate.push(data['house'], topic, data)
Ejemplo n.º 2
0
def main():
    gate = Ubigate('zigbee-gw', default_file='resources/conf.json.default')

    logger.info("Starting application")
    logger.debug('Timezone: %s' % gate.timezone)

    for data in zigbee_IO.run(gate):
        if data['type'] != 'error':
            try:
                data['house'] = gate.find_house(data['sensor'])
            except KeyError:
                logger.warning("Unknown sensor: %s" % data['sensor'])
            else:
                topic = "/zigbee/sensor/%s/%s" % (data['sensor'], data['type'])
                gate.push(data['house'], topic, data)
Ejemplo n.º 3
0
def main():
    gate = Ubigate('resources/conf.ini')
    log.add_logger_file('data.log', logging.WARN)
    logger.setLevel(logging.INFO)

    logger.info("Starting application")
    logger.info('Server: %s\n'
                'Port: %s\n'
                'Password: %s\n'
                'House: %s\n'
                'Username: %s\n'
                'Timezone: %s' % (gate.config.server,
                                  gate.config.port,
                                  gate.config.password,
                                  gate.config.house,
                                  gate.config.username,
                                  gate.timezone))

    for sensor, data in mochad_reader.run(gate.timezone):
        topic = "/marmitek/sensor/%s" % sensor
        data['house'] = gate.config.house
        gate.push(topic, data)
Ejemplo n.º 4
0
def main():
    gate = Ubigate('resources/conf.ini')
    log.add_logger_file('data.log', logging.DEBUG)
    logger.setLevel(logging.INFO)

    logger.info("Starting application")
    logger.info('Server: %s\n'
                'Port: %s\n'
                'Password: %s\n'
                'House: %s\n'
                'Username: %s\n'
                'Timezone: %s' % (gate.config.server,
                                  gate.config.port,
                                  gate.config.password,
                                  gate.config.house,
                                  gate.config.username,
                                  gate.timezone))

    for meta_data, data in zigbee_reader.run(gate.timezone):
        if meta_data['type'] == 'error':
            break
        topic = "/zigbee/sensor/%s/%s" % (meta_data['sensor'], meta_data['type'])
        data['house'] = gate.config.house
        gate.push(topic, data)