1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 20:32:21 +01:00

Add 'at' time trigger (#493)

## Description:


**Related issue (if applicable):** fixes <link to issue>

**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs#<esphome-docs PR number goes here>
**Pull request in [esphome-core](https://github.com/esphome/esphome-core) with C++ framework changes (if applicable):** esphome/esphome-core#<esphome-core PR number goes here>

## Checklist:
  - [ ] The code change is tested and works locally.
  - [ ] Tests have been added to verify that the new code works (under `tests/` folder).

If user exposed functionality or configuration variables are added/changed:
  - [ ] Documentation added/updated in [esphomedocs](https://github.com/OttoWinter/esphomedocs).
This commit is contained in:
Otto Winter
2019-04-08 21:57:25 +02:00
committed by GitHub
parent 526a414743
commit a14d12b0c1
5 changed files with 60 additions and 6 deletions

View File

@@ -7,13 +7,11 @@ import os
import random
import sys
from esphome import const, core_config, mqtt, platformio_api, wizard, writer, yaml_util
from esphome.api.client import run_logs
from esphome import const, core_config, platformio_api, wizard, writer, yaml_util
from esphome.config import get_component, iter_components, read_config, strip_default_ids
from esphome.const import CONF_BAUD_RATE, CONF_BROKER, CONF_ESPHOME, CONF_LOGGER, \
CONF_USE_CUSTOM_CODE
from esphome.core import CORE, EsphomeError
from esphome.cpp_generator import Expression, RawStatement, add, statement
from esphome.helpers import color, indent
from esphome.py_compat import IS_PY2, safe_input, text_type
from esphome.storage_json import StorageJSON, storage_path
@@ -124,6 +122,8 @@ def run_miniterm(config, port):
def write_cpp(config):
from esphome.cpp_generator import Expression, RawStatement, add, statement
_LOGGER.info("Generating C++ source...")
CORE.add_job(core_config.to_code, config[CONF_ESPHOME], domain='esphome')
@@ -223,14 +223,20 @@ def show_logs(config, args, port):
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 ValueError
def clean_mqtt(config, args):
from esphome import mqtt
return mqtt.clear_topic(config, args.topic, args.username, args.password, args.client_id)
@@ -329,6 +335,8 @@ def command_clean_mqtt(args, config):
def command_mqtt_fingerprint(args, config):
from esphome import mqtt
return mqtt.get_fingerprint(config)