How to use the fauxmo.fauxmo.main function in fauxmo

To help you get started, we’ve selected a few fauxmo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github n8henrie / fauxmo / tests / test_fauxmo.py View on Github external
def test_old_config_fails() -> None:
    """Ensure the config for fauxmo < v0.4.0 fails with SystemExit."""
    with pytest.raises(SystemExit):
        fauxmo.main(config_path_str="tests/old-config-sample.json")
github n8henrie / fauxmo / src / fauxmo / cli.py View on Github external
help="increase verbosity (may repeat up to -vvv)",
        action="count",
        default=0,
    )
    parser.add_argument("-c", "--config", help="specify alternate config file")
    parser.add_argument(
        "-V", "--version", action="version", version=__version__
    )
    args = parser.parse_args(arguments)

    # args.verbose defaults to 0
    # 40 - 10 * 0 = 40 == logging.ERROR
    verbosity = max(40 - 10 * args.verbose, 10)
    logger.setLevel(verbosity)

    main(config_path_str=args.config, verbosity=verbosity)