Esempio n. 1
0
def show_logs(config, args, port):
    if 'logger' not in config:
        raise EsphomeError("Logger is not configured!")
    if get_port_type(port) == 'SERIAL':
        run_miniterm(config, port)
        return 0
    if get_port_type(port) == 'NETWORK' and 'api' in config:
        return run_logs(config, port)
    if get_port_type(port) == 'MQTT' and 'mqtt' in config:
        return mqtt.show_logs(config, args.topic, args.username, args.password,
                              args.client_id)

    raise ValueError
Esempio n. 2
0
def show_logs(config, args, port):
    if 'logger' not in config:
        raise EsphomeError("Logger is not configured!")
    if get_port_type(port) == 'SERIAL':
        run_miniterm(config, port)
        return 0
    if get_port_type(port) == 'NETWORK' and 'api' in config:
        from esphome.api.client import run_logs

        return run_logs(config, port)
    if get_port_type(port) == 'MQTT' and 'mqtt' in config:
        from esphome import mqtt

        return mqtt.show_logs(config, args.topic, args.username, args.password, args.client_id)

    raise EsphomeError("No remote or local logging method configured (api/mqtt/logger)")
Esempio n. 3
0
def show_logs(config, args, port):
    if "logger" not in config:
        raise EsphomeError("Logger is not configured!")
    if get_port_type(port) == "SERIAL":
        run_miniterm(config, port)
        return 0
    if get_port_type(port) == "NETWORK" and "api" in config:
        from esphome.api.client import run_logs

        return run_logs(config, port)
    if get_port_type(port) == "MQTT" and "mqtt" in config:
        from esphome import mqtt

        return mqtt.show_logs(config, args.topic, args.username, args.password,
                              args.client_id)

    raise EsphomeError(
        "No remote or local logging method configured (api/mqtt/logger)")