示例#1
0
文件: aiosHap.py 项目: HJvA/fshome
                          minNr=2,
                          maxNr=8,
                          minDevPerc=0.2)
    #sampler.minqid=None  # do not auto create
    bridge.add_sampler(sampler, conf.itstore)


if __name__ == "__main__":
    """ run this 
	"""
    logger = tls.get_logger(__file__)

    try:
        driver = AccessoryDriver(port=51826)
        signal.signal(signal.SIGTERM, driver.signal_handler)

        bridge = fsBridge(driver, 'aiosBridge')
        add_AIOS_to_bridge(bridge, config="aios.json")
        driver.add_accessory(accessory=bridge)

        signal.signal(signal.SIGTERM, driver.signal_handler)

        driver.start()
    except Exception:
        logger.exception('ending aiosHap')
    finally:
        logger.info('bye')

else:  # this is running as a module
    logger = logging.getLogger(__name__)  # get logger from main program
示例#2
0
                          maxNr=140,
                          minNr=20,
                          minDevPerc=2.0)
    bridge.add_sampler(sampler, conf.itstore)


if __name__ == "__main__":
    logger = logging.getLogger()
    hand = logging.StreamHandler()
    hand.setLevel(logging.INFO)
    logger.addHandler(hand)  # use console
    logger.addHandler(
        logging.FileHandler(filename='p1DSMR_Hap.log',
                            mode='w',
                            encoding='utf-8'))
    logger.setLevel(logging.DEBUG)
    logger.critical("### running %s dd %s ###" %
                    (__file__, time.strftime("%y%m%d %H:%M:%S")))

    driver = AccessoryDriver(port=51826)
    bridge = fsBridge(driver, 'fsBridge')

    add_p1DSMR_to_bridge(bridge, config="p1DSMR.json")
    driver.add_accessory(accessory=bridge)

    signal.signal(signal.SIGTERM, driver.signal_handler)

    driver.start()

    logger.info('bye')
示例#3
0
                         maxNr=2,
                         minDevPerc=0)
    #sampler.minqid=None  # do not auto create
    bridge.add_sampler(sampler, conf.itstore)


if __name__ == "__main__":
    """ run this for testing
	"""
    from lib.tls import get_logger
    logger = get_logger(__file__)

    try:
        driver = AccessoryDriver(port=51826)
        signal.signal(signal.SIGTERM, driver.signal_handler)

        bridge = fsBridge(driver, 'hueBridge')
        add_HUE_to_bridge(bridge, config="hue.json")
        driver.add_accessory(accessory=bridge)

        signal.signal(signal.SIGTERM, driver.signal_handler)

        driver.start()
    except Exception:
        logger.exception('ending hueHap')
    finally:
        logger.info('bye')

else:  # this is running as a module
    logger = logging.getLogger(__name__)  # get logger from main program