From 971b15ac67196a4f67bba08914c444156780ff60 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 26 Feb 2019 16:39:20 +0100 Subject: [PATCH 1/4] Allow non-pullup pins for dallas (#456) --- esphome/components/dallas.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/esphome/components/dallas.py b/esphome/components/dallas.py index 7bfc8144fe..74eb1cebf3 100644 --- a/esphome/components/dallas.py +++ b/esphome/components/dallas.py @@ -13,7 +13,7 @@ MULTI_CONF = True CONFIG_SCHEMA = vol.Schema({ cv.GenerateID(): cv.declare_variable_id(DallasComponent), - vol.Required(CONF_PIN): pins.input_pullup_pin, + vol.Required(CONF_PIN): pins.input_pin, vol.Optional(CONF_UPDATE_INTERVAL): cv.update_interval, }).extend(cv.COMPONENT_SCHEMA.schema) From 88625c656d764dee5ef200ede00ff55429d65203 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 26 Feb 2019 18:31:40 +0100 Subject: [PATCH 2/4] Remove automatic update check (#457) * Remove automatic update check * Lint --- esphome/__main__.py | 8 +---- esphome/storage_json.py | 72 +---------------------------------------- 2 files changed, 2 insertions(+), 78 deletions(-) diff --git a/esphome/__main__.py b/esphome/__main__.py index 1ba779d11d..21572fc115 100644 --- a/esphome/__main__.py +++ b/esphome/__main__.py @@ -17,8 +17,7 @@ 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, esphome_storage_path, \ - start_update_check_thread, storage_path +from esphome.storage_json import StorageJSON, storage_path from esphome.util import run_external_command, run_external_process, safe_print _LOGGER = logging.getLogger(__name__) @@ -157,12 +156,7 @@ def write_cpp(config): def compile_program(args, config): _LOGGER.info("Compiling app...") - update_check = not os.getenv('ESPHOME_NO_UPDATE_CHECK', '') - if update_check: - thread = start_update_check_thread(esphome_storage_path(CORE.config_dir)) rc = platformio_api.run_compile(config, args.verbose) - if update_check: - thread.join() return rc diff --git a/esphome/storage_json.py b/esphome/storage_json.py index ad34b20c58..28ae7344f2 100644 --- a/esphome/storage_json.py +++ b/esphome/storage_json.py @@ -1,10 +1,9 @@ import binascii import codecs -from datetime import datetime, timedelta +from datetime import datetime import json import logging import os -import threading from esphome import const from esphome.core import CORE @@ -226,72 +225,3 @@ class EsphomeStorageJSON(object): def __eq__(self, o): # type: (Any) -> bool return isinstance(o, EsphomeStorageJSON) and self.as_dict() == o.as_dict() - - @property - def should_do_esphome_update_check(self): # type: () -> bool - if self.last_update_check is None: - return True - return self.last_update_check + timedelta(days=3) < datetime.utcnow() - - -class CheckForUpdateThread(threading.Thread): - def __init__(self, path): - threading.Thread.__init__(self) - self._path = path - - @property - def docs_base(self): - return 'https://beta.esphome.io' if 'b' in const.__version__ else \ - 'https://esphome.io' - - def fetch_remote_version(self): - import requests - - storage = EsphomeStorageJSON.load(self._path) or \ - EsphomeStorageJSON.get_default() - if not storage.should_do_esphome_update_check: - return storage - - req = requests.get('{}/_static/version'.format(self.docs_base)) - req.raise_for_status() - storage.remote_version = req.text.strip() - storage.last_update_check = datetime.utcnow() - storage.save(self._path) - return storage - - @staticmethod - def format_version(ver): - vstr = '.'.join(map(str, ver.version)) - if ver.prerelease: - vstr += ver.prerelease[0] + str(ver.prerelease[1]) - return vstr - - def cmp_versions(self, storage): - # pylint: disable=no-name-in-module, import-error - from distutils.version import StrictVersion - - remote_version = StrictVersion(storage.remote_version) - self_version = StrictVersion(const.__version__) - if remote_version > self_version: - _LOGGER.warning("*" * 80) - _LOGGER.warning("A new version of ESPHome is available: %s (this is %s)", - self.format_version(remote_version), self.format_version(self_version)) - _LOGGER.warning("Changelog: %s/changelog/index.html", self.docs_base) - _LOGGER.warning("Update Instructions: %s/guides/faq.html" - "#how-do-i-update-to-the-latest-version", self.docs_base) - _LOGGER.warning("*" * 80) - - def run(self): - try: - storage = self.fetch_remote_version() - self.cmp_versions(storage) - except Exception: # pylint: disable=broad-except - pass - - -def start_update_check_thread(path): - # dummy call to strptime as python 2.7 has a bug with strptime when importing from threads - datetime.strptime('20180101', '%Y%m%d') - thread = CheckForUpdateThread(os.path.abspath(path)) - thread.start() - return thread From 71cbc9cfb0cb5f88f12618b9fcc371d7d332d5b5 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 26 Feb 2019 18:34:47 +0100 Subject: [PATCH 3/4] Fix mDNS library added only with OTA (#451) --- esphome/components/ota.py | 4 ++-- esphome/writer.py | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/esphome/components/ota.py b/esphome/components/ota.py index 61cb870c46..d1e522741d 100644 --- a/esphome/components/ota.py +++ b/esphome/components/ota.py @@ -51,7 +51,7 @@ REQUIRED_BUILD_FLAGS = '-DUSE_NEW_OTA' def lib_deps(config): if CORE.is_esp32: - return ['Update', 'ESPmDNS'] + return ['Update'] if CORE.is_esp8266: - return ['Hash', 'ESP8266mDNS'] + return ['Hash'] raise NotImplementedError diff --git a/esphome/writer.py b/esphome/writer.py index 319669f72a..381746dbc0 100644 --- a/esphome/writer.py +++ b/esphome/writer.py @@ -288,8 +288,10 @@ def gather_lib_deps(): if CORE.arduino_version in (ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP32_1_0_1): lib_deps.add('AsyncTCP@1.0.3') lib_deps.discard('AsyncTCP@1.0.1') + lib_deps.add('ESPmDNS') elif CORE.is_esp8266: lib_deps.add('ESPAsyncTCP@1.1.3') + lib_deps.add('ESP8266mDNS') # avoid changing build flags order lib_deps_l = list(lib_deps) lib_deps_l.sort() @@ -393,7 +395,6 @@ def get_ini_content(): data['lib_ldf_mode'] = 'chain' REMOVABLE_LIBRARIES = [ 'ArduinoOTA', - 'ESPmDNS', 'Update', 'Wire', 'FastLED', From a5d0ecdb1308b81670ec31cf73320d75b2829bb4 Mon Sep 17 00:00:00 2001 From: Otto Winter Date: Tue, 26 Feb 2019 23:04:22 +0100 Subject: [PATCH 4/4] Bump version to v1.11.2 --- esphome/const.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/esphome/const.py b/esphome/const.py index 1e9571b858..fc79f913b6 100644 --- a/esphome/const.py +++ b/esphome/const.py @@ -2,10 +2,10 @@ MAJOR_VERSION = 1 MINOR_VERSION = 11 -PATCH_VERSION = '1' +PATCH_VERSION = '2' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) -ESPHOME_CORE_VERSION = '1.11.1' +ESPHOME_CORE_VERSION = '1.11.2' ESP_PLATFORM_ESP32 = 'ESP32' ESP_PLATFORM_ESP8266 = 'ESP8266'