diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 52ee89e4f..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -name: Bug report -about: Create a report to help esphomelib improve - ---- - - - -**Operating environment (Hass.io/Docker/pip/etc.):** - - -**ESP (ESP32/ESP8266/Board/Sonoff):** - - -**Affected component:** - - - -**Description of problem:** - - -**Problem-relevant YAML-configuration entries:** -```yaml -PASTE YAML FILE HERE -``` - -**Traceback (if applicable):** - -``` - -``` - -**Additional information:** diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 2a033e374..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project - ---- - - - -**Is your feature request related to a problem/use-case? Please describe.** - - -**Describe the solution you'd like:** - - -**Additional context:** - diff --git a/.github/ISSUE_TEMPLATE/new-integration.md b/.github/ISSUE_TEMPLATE/new-integration.md deleted file mode 100644 index 34fdb086a..000000000 --- a/.github/ISSUE_TEMPLATE/new-integration.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: New integration -about: Suggest a new integration for esphomelib - ---- - -DO NOT POST NEW INTEGRATION REQUESTS HERE! - -Please post all new integration requests in the esphomelib repository: - -https://github.com/OttoWinter/esphomelib/issues - -Thank you! diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index f0fdd660a..64780a340 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,8 +3,8 @@ **Related issue (if applicable):** fixes -**Pull request in [esphomedocs](https://github.com/OttoWinter/esphomedocs) with documentation (if applicable):** OttoWinter/esphomedocs# -**Pull request in [esphomelib](https://github.com/OttoWinter/esphomelib) with C++ framework changes (if applicable):** OttoWinter/esphomelib# +**Pull request in [esphome-docs](https://github.com/esphome/esphome-docs) with documentation (if applicable):** esphome/esphome-docs# +**Pull request in [esphome-core](https://github.com/esphome/esphome-core) with C++ framework changes (if applicable):** esphome/esphome-core# ## Checklist: - [ ] The code change is tested and works locally. diff --git a/.gitignore b/.gitignore index d871a420e..c8a36dfd3 100644 --- a/.gitignore +++ b/.gitignore @@ -105,4 +105,4 @@ venv.bak/ config/ tests/build/ -tests/.esphomeyaml/ +tests/.esphome/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8caa870ce..c76058ed2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -15,7 +15,7 @@ stages: - pip install -e . tags: - python2.7 - - esphomeyaml-lint + - esphome-lint .test: &test stage: test @@ -23,7 +23,7 @@ stages: - pip install -e . tags: - python2.7 - - esphomeyaml-test + - esphome-test variables: TZ: UTC @@ -39,253 +39,34 @@ stages: flake8: <<: *lint script: - - flake8 esphomeyaml + - flake8 esphome pylint: <<: *lint script: - - pylint esphomeyaml + - pylint esphome test1: <<: *test script: - - esphomeyaml tests/test1.yaml compile + - esphome tests/test1.yaml compile test2: <<: *test script: - - esphomeyaml tests/test2.yaml compile + - esphome tests/test2.yaml compile -.build-hassio: &build-hassio - <<: *docker-builder - stage: build +test3: + <<: *test script: - - docker run --rm --privileged hassioaddons/qemu-user-static:latest - - BUILD_FROM=hassioaddons/ubuntu-base-${ADDON_ARCH}:2.2.1 - - ADDON_VERSION="${CI_COMMIT_TAG#v}" - - ADDON_VERSION="${ADDON_VERSION:-${CI_COMMIT_SHA:0:7}}" - - echo "Build from ${BUILD_FROM}" - - echo "Add-on version ${ADDON_VERSION}" - - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:dev" - - echo "Tag ${CI_REGISTRY}/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" - - | - docker build \ - --build-arg "BUILD_FROM=${BUILD_FROM}" \ - --build-arg "BUILD_DATE=$(date +"%Y-%m-%dT%H:%M:%SZ")" \ - --build-arg "BUILD_ARCH=${ADDON_ARCH}" \ - --build-arg "BUILD_REF=${CI_COMMIT_SHA}" \ - --build-arg "BUILD_VERSION=${ADDON_VERSION}" \ - --tag "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:dev" \ - --tag "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - --file "docker/Dockerfile.hassio" \ - . - - | - if [ "${DO_PUSH:-true}" = true ]; then - echo "Pushing to CI registry" - docker push ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA} - docker push ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:dev - fi - -# Generic deploy template -.deploy-release: &deploy-release - <<: *docker-builder - stage: deploy - script: - - version="${CI_COMMIT_TAG#v}" - - echo "Publishing release version ${version}" - - docker pull "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" - - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - - - echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - - echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - - docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - - - echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - - | - docker tag \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:latest" - - - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - | - docker tag \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - only: - - /^v\d+\.\d+\.\d+$/ - except: - - /^(?!master).+@/ - -.deploy-beta: &deploy-beta - <<: *docker-builder - stage: deploy - script: - - version="${CI_COMMIT_TAG#v}" - - echo "Publishing beta version ${version}" - - docker pull "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" - - docker login -u "$DOCKER_USER" -p "$DOCKER_PASSWORD" - - - echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - - echo "Tag ${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - docker push "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - | - docker tag \ - "${CI_REGISTRY}/ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${CI_COMMIT_SHA}" \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" - - - echo "Tag ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - | - docker tag \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:${version}" \ - "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - - docker push "ottowinter/esphomeyaml-hassio-${ADDON_ARCH}:rc" - only: - - /^v\d+\.\d+\.\d+b\d+$/ - except: - - /^(?!rc).+@/ + - esphome tests/test3.yaml compile # Build jobs build:normal: <<: *docker-builder stage: build script: - - docker build -t "${CI_REGISTRY}/ottowinter/esphomeyaml:dev" . - -.build-hassio-edge: &build-hassio-edge - <<: *build-hassio - except: - - /^v\d+\.\d+\.\d+$/ - - /^v\d+\.\d+\.\d+b\d+$/ - -.build-hassio-release: &build-hassio-release - <<: *build-hassio - only: - - /^v\d+\.\d+\.\d+$/ - - /^v\d+\.\d+\.\d+b\d+$/ - -build:hassio-armhf-edge: - <<: *build-hassio-edge - variables: - ADDON_ARCH: armhf - DO_PUSH: "false" - -build:hassio-armhf: - <<: *build-hassio-release - variables: - ADDON_ARCH: armhf - -#build:hassio-aarch64-edge: -# <<: *build-hassio-edge -# variables: -# ADDON_ARCH: aarch64 -# DO_PUSH: "false" - -#build:hassio-aarch64: -# <<: *build-hassio-release -# variables: -# ADDON_ARCH: aarch64 - -build:hassio-i386-edge: - <<: *build-hassio-edge - variables: - ADDON_ARCH: i386 - DO_PUSH: "false" - -build:hassio-i386: - <<: *build-hassio-release - variables: - ADDON_ARCH: i386 - -build:hassio-amd64-edge: - <<: *build-hassio-edge - variables: - ADDON_ARCH: amd64 - DO_PUSH: "false" - -build:hassio-amd64: - <<: *build-hassio-release - variables: - ADDON_ARCH: amd64 - -# Deploy jobs -deploy-release:armhf: - <<: *deploy-release - variables: - ADDON_ARCH: armhf - -deploy-beta:armhf: - <<: *deploy-beta - variables: - ADDON_ARCH: armhf - -#deploy-release:aarch64: -# <<: *deploy-release -# variables: -# ADDON_ARCH: aarch64 - -#deploy-beta:aarch64: -# <<: *deploy-beta -# variables: -# ADDON_ARCH: aarch64 - -deploy-release:i386: - <<: *deploy-release - variables: - ADDON_ARCH: i386 - -deploy-beta:i386: - <<: *deploy-beta - variables: - ADDON_ARCH: i386 - -deploy-release:amd64: - <<: *deploy-release - variables: - ADDON_ARCH: amd64 - -deploy-beta:amd64: - <<: *deploy-beta - variables: - ADDON_ARCH: amd64 + - docker build -t "${CI_REGISTRY}/esphome/esphome:dev" . .deploy-pypi: &deploy-pypi stage: deploy @@ -297,7 +78,7 @@ deploy-beta:amd64: - twine upload dist/* tags: - python2.7 - - esphomeyaml-test + - esphome-test deploy-release:pypi: <<: *deploy-pypi diff --git a/.travis.yml b/.travis.yml index 6eb2f480f..f2895cd95 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,24 +8,24 @@ matrix: env: TARGET=Lint2.7 install: pip install -e . && pip install flake8==3.6.0 pylint==1.9.4 pillow script: - - flake8 esphomeyaml - - pylint esphomeyaml + - flake8 esphome + - pylint esphome - python: "3.5.3" env: TARGET=Lint3.5 install: pip install -U https://github.com/platformio/platformio-core/archive/develop.zip && pip install -e . && pip install flake8==3.6.0 pylint==2.2.2 pillow script: - - flake8 esphomeyaml - - pylint esphomeyaml + - flake8 esphome + - pylint esphome - python: "2.7" env: TARGET=Test2.7 install: pip install -e . && pip install flake8==3.6.0 pylint==1.9.4 pillow script: - - esphomeyaml tests/test1.yaml compile - - esphomeyaml tests/test2.yaml compile - - esphomeyaml tests/test3.yaml compile + - esphome tests/test1.yaml compile + - esphome tests/test2.yaml compile + - esphome tests/test3.yaml compile #- python: "3.5.3" # env: TARGET=Test3.5 # install: pip install -U https://github.com/platformio/platformio-core/archive/develop.zip && pip install -e . && pip install flake8==3.6.0 pylint==2.2.2 pillow # script: - # - esphomeyaml tests/test1.yaml compile - # - esphomeyaml tests/test2.yaml compile + # - esphome tests/test1.yaml compile + # - esphome tests/test2.yaml compile diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b085ab82f..43d5e7907 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,16 @@ -# Contributing to esphomeyaml +# Contributing to ESPHome -esphomeyaml is a part of esphomelib and is responsible for reading in YAML configuration files, +This python project is responsible for reading in YAML configuration files, converting them to C++ code. This code is then converted to a platformio project and compiled -with [esphomelib](https://github.com/OttoWinter/esphomelib), the C++ framework behind the project. +with [esphome-core](https://github.com/esphome/esphome-core), the C++ framework behind the project. -For a detailed guide, please see https://esphomelib.com/esphomeyaml/guides/contributing.html#contributing-to-esphomeyaml +For a detailed guide, please see https://esphome.io/guides/contributing.html#contributing-to-esphomeyaml Things to note when contributing: - Please test your changes :) - If a new feature is added or an existing user-facing feature is changed, you should also - update the [docs](https://github.com/OttoWinter/esphomedocs). See [contributing to esphomedocs](https://esphomelib.com/esphomeyaml/guides/contributing.html#contributing-to-esphomedocs) + update the [docs](https://github.com/esphome/esphome-docs). See [contributing to esphome-docs](https://esphome.io/guides/contributing.html#contributing-to-esphomedocs) for more information. - Please also update the tests in the `tests/` folder. You can do so by just adding a line in one of the YAML files which checks if your new feature compiles correctly. diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index be6a19ca7..000000000 --- a/Dockerfile +++ /dev/null @@ -1,28 +0,0 @@ -ARG BUILD_FROM=python:2.7 -FROM ${BUILD_FROM} -MAINTAINER Otto Winter - -RUN apt-get update && apt-get install -y \ - git \ - && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* && \ - pip install --no-cache-dir --no-binary :all: platformio && \ - platformio settings set enable_telemetry No && \ - platformio settings set check_libraries_interval 1000000 && \ - platformio settings set check_platformio_interval 1000000 && \ - platformio settings set check_platforms_interval 1000000 - -ENV ESPHOMEYAML_OTA_HOST_PORT=6123 -EXPOSE 6123 -VOLUME /config -WORKDIR /usr/src/app - -COPY docker/platformio.ini /pio/platformio.ini -RUN platformio run -d /pio; rm -rf /pio - -COPY . . -RUN pip install --no-cache-dir --no-binary :all: -e . && \ - pip install --no-cache-dir pillow - -WORKDIR /config -ENTRYPOINT ["esphomeyaml"] -CMD ["/config", "dashboard"] diff --git a/MANIFEST.in b/MANIFEST.in index 83308b2be..48ab2418e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,17 +1,17 @@ include README.md -include esphomeyaml/dashboard/templates/index.html -include esphomeyaml/dashboard/templates/login.html -include esphomeyaml/dashboard/static/ace.js -include esphomeyaml/dashboard/static/esphomeyaml.css -include esphomeyaml/dashboard/static/esphomeyaml.js -include esphomeyaml/dashboard/static/favicon.ico -include esphomeyaml/dashboard/static/jquery.min.js -include esphomeyaml/dashboard/static/jquery.validate.min.js -include esphomeyaml/dashboard/static/jquery-ui.min.js -include esphomeyaml/dashboard/static/materialize.min.css -include esphomeyaml/dashboard/static/materialize.min.js -include esphomeyaml/dashboard/static/materialize-stepper.min.css -include esphomeyaml/dashboard/static/materialize-stepper.min.js -include esphomeyaml/dashboard/static/mode-yaml.js -include esphomeyaml/dashboard/static/theme-dreamweaver.js -include esphomeyaml/dashboard/static/ext-searchbox.js +include esphome/dashboard/templates/index.html +include esphome/dashboard/templates/login.html +include esphome/dashboard/static/ace.js +include esphome/dashboard/static/esphome.css +include esphome/dashboard/static/esphome.js +include esphome/dashboard/static/favicon.ico +include esphome/dashboard/static/jquery.min.js +include esphome/dashboard/static/jquery.validate.min.js +include esphome/dashboard/static/jquery-ui.min.js +include esphome/dashboard/static/materialize.min.css +include esphome/dashboard/static/materialize.min.js +include esphome/dashboard/static/materialize-stepper.min.css +include esphome/dashboard/static/materialize-stepper.min.js +include esphome/dashboard/static/mode-yaml.js +include esphome/dashboard/static/theme-dreamweaver.js +include esphome/dashboard/static/ext-searchbox.js diff --git a/README.md b/README.md index 61b7e67c4..f3b990a2b 100644 --- a/README.md +++ b/README.md @@ -1,38 +1,3 @@ -# esphomeyaml for [esphomelib](https://github.com/OttoWinter/esphomelib) +# ESPHome -### Getting Started Guide: https://esphomelib.com/esphomeyaml/guides/getting_started_command_line.html - -### Available Components: https://esphomelib.com/esphomeyaml/index.html - -esphomeyaml is the solution for your ESP8266/ESP32 projects with Home Assistant. It allows you to create **custom firmwares** for your microcontrollers with no programming experience required. All you need to know is the YAML configuration format which is also used by [Home Assistant](https://www.home-assistant.io). - -esphomeyaml will: - - * Read your configuration file and warn you about potential errors (like using the invalid pins.) - * Create a custom C++ sketch file for you using esphomeyaml's powerful C++ generation engine. - * Compile the sketch file for you using [platformio](http://platformio.org/). - * Upload the binary to your ESP via Over the Air updates. - * Automatically start remote logs via MQTT. - -And all of that with a single command 🎉: - -```bash -esphomeyaml configuration.yaml run -``` - -## Features - - * **No programming experience required:** just edit YAML configuration - files like you're used to with Home Assistant. - * **Flexible:** Use [esphomelib](https://github.com/OttoWinter/esphomelib)'s powerful core to create custom sensors/outputs. - * **Fast and efficient:** Written in C++ and keeps memory consumption to a minimum. - * **Made for [Home Assistant](https://www.home-assistant.io):** Almost all [Home Assistant](https://www.home-assistant.io) features are supported out of the box. Including RGB lights and many more. - * **Easy reproducible configuration:** No need to go through a long setup process for every single node. Just copy a configuration file and run a single command. - * **Smart Over The Air Updates:** esphomeyaml has OTA updates deeply integrated into the system. It even automatically enters a recovery mode if a boot loop is detected. - * **Powerful logging engine:** View colorful logs and debug issues remotely. - * **Open Source** - * For me: Makes documenting esphomelib's features a lot easier. - -## Special Thanks - -Special Thanks to the Home Assistant project. Lots of the code base of esphomeyaml is based off of Home Assistant, for example the loading and config validation code. +# TODO \ No newline at end of file diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 000000000..18a923278 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,11 @@ +ARG BUILD_FROM=esphome/esphome-base-amd64:1.0.0 +FROM ${BUILD_FROM} + +COPY . . +RUN \ + pip install --no-cache-dir --no-binary :all: -e . && \ + pip install --no-cache-dir pillow + +WORKDIR /config +ENTRYPOINT ["esphome"] +CMD ["/config", "dashboard"] diff --git a/docker/Dockerfile.builder b/docker/Dockerfile.builder deleted file mode 100644 index 2077b7bde..000000000 --- a/docker/Dockerfile.builder +++ /dev/null @@ -1,30 +0,0 @@ -FROM multiarch/ubuntu-core:amd64-xenial - -# setup locals -RUN apt-get update && apt-get install -y \ - jq \ - git \ - python3-setuptools \ - && rm -rf /var/lib/apt/lists/* \ -ENV LANG C.UTF-8 - -# Install docker -# https://docs.docker.com/engine/installation/linux/docker-ce/ubuntu/ -RUN apt-get update && apt-get install -y \ - apt-transport-https \ - ca-certificates \ - curl \ - software-properties-common \ - && rm -rf /var/lib/apt/lists/* \ - && curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add - \ - && add-apt-repository "deb https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" \ - && apt-get update && apt-get install -y docker-ce \ - && rm -rf /var/lib/apt/lists/* - -# setup arm binary support -RUN apt-get update && apt-get install -y \ - qemu-user-static \ - binfmt-support \ - && rm -rf /var/lib/apt/lists/* - -WORKDIR /data diff --git a/docker/Dockerfile.hassio b/docker/Dockerfile.hassio index 114af92ae..4f90b1424 100644 --- a/docker/Dockerfile.hassio +++ b/docker/Dockerfile.hassio @@ -1,73 +1,29 @@ -ARG BUILD_FROM=hassioaddons/ubuntu-base:2.2.1 -# hadolint ignore=DL3006 +ARG BUILD_FROM=esphome/esphome-hassio-base-amd64:1.0.0 FROM ${BUILD_FROM} -# Set shell -SHELL ["/bin/bash", "-o", "pipefail", "-c"] - -# Copy root filesystem -COPY esphomeyaml-edge/rootfs / -COPY setup.py setup.cfg MANIFEST.in /opt/esphomeyaml/ -COPY esphomeyaml /opt/esphomeyaml/esphomeyaml - RUN \ - # Temporarily move nginx.conf (otherwise dpkg fails) - mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bkp \ - # Install add-on dependencies - && apt-get update \ + apt-get update \ && apt-get install -y --no-install-recommends \ - # Python for esphomeyaml - python \ - python-pip \ - python-setuptools \ - # Python Pillow for display component python-pil \ - # Git for esphomelib downloads - git \ - # NGINX proxy - nginx \ - \ - && mv /etc/nginx/nginx.conf.bkp /etc/nginx/nginx.conf \ - \ - && pip2 install --no-cache-dir --no-binary :all: -e /opt/esphomeyaml \ - \ - # Change some platformio settings - && platformio settings set enable_telemetry No \ - && platformio settings set check_libraries_interval 1000000 \ - && platformio settings set check_platformio_interval 1000000 \ - && platformio settings set check_platforms_interval 1000000 \ - \ - # Build an empty platformio project to force platformio to install all fw build dependencies - # The return-code will be non-zero since there's nothing to build. - && (platformio run -d /opt/pio; echo "Done") \ - \ - # Cleanup - && rm -fr \ + && rm -rf \ /tmp/* \ /var/{cache,log}/* \ - /var/lib/apt/lists/* \ - /opt/pio/ + /var/lib/apt/lists/* -# Build arugments -ARG BUILD_ARCH=amd64 -ARG BUILD_DATE -ARG BUILD_REF -ARG BUILD_VERSION +# Copy root filesystem +COPY docker/rootfs/ / +COPY setup.py setup.cfg MANIFEST.in /opt/esphome/ +COPY esphome /opt/esphome/esphome + +RUN \ + pip2 install --no-cache-dir --no-binary :all: -e /opt/esphome + +# Build arguments +ARG BUILD_VERSION=dev # Labels LABEL \ - io.hass.name="esphomeyaml" \ + io.hass.name="ESPHome" \ io.hass.description="Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" \ - io.hass.arch="${BUILD_ARCH}" \ io.hass.type="addon" \ - io.hass.version=${BUILD_VERSION} \ - maintainer="Otto Winter " \ - org.label-schema.description="Manage and program ESP8266/ESP32 microcontrollers through YAML configuration files" \ - org.label-schema.build-date=${BUILD_DATE} \ - org.label-schema.name="esphomeyaml" \ - org.label-schema.schema-version="1.0" \ - org.label-schema.url="https://esphomelib.com" \ - org.label-schema.usage="https://github.com/OttoWinter/esphomeyaml/tree/dev/esphomeyaml/README.md" \ - org.label-schema.vcs-ref=${BUILD_REF} \ - org.label-schema.vcs-url="https://github.com/OttoWinter/esphomeyaml" \ - org.label-schema.vendor="esphomelib" + io.hass.version=${BUILD_VERSION} diff --git a/docker/hooks/build b/docker/hooks/build new file mode 100755 index 000000000..b9b61e800 --- /dev/null +++ b/docker/hooks/build @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# the Docker repository tag being built. +declare CACHE_TAG +echo "CACHE_TAG: ${CACHE_TAG}" +# the name and tag of the Docker repository being built. (This variable is a combination of DOCKER_REPO:CACHE_TAG.) +declare IMAGE_NAME +echo "IMAGE_NAME: ${IMAGE_NAME}" +# the architecture to build +declare BUILD_ARCH +echo "BUILD_ARCH: ${BUILD_ARCH}" +# whether this is a hassio build +declare IS_HASSIO +echo "IS_HASSIO: ${IS_HASSIO}" + +if [[ ${IS_HASSIO} = "YES" ]]; then + docker build \ + --build-arg "BUILD_FROM=esphome/esphome-hassio-base-${BUILD_ARCH}:1.0.0" \ + --build-arg "BUILD_VERSION=${CACHE_TAG}" \ + -t "${IMAGE_NAME}" -f docker/Dockerfile.hassio . +else + docker build \ + --build-arg "BUILD_FROM=esphome/esphome-base-${BUILD_ARCH}:1.0.0" \ + -t "${IMAGE_NAME}" -f docker/Dockerfile . +fi diff --git a/docker/hooks/pre_build b/docker/hooks/pre_build new file mode 100755 index 000000000..aff12dd3f --- /dev/null +++ b/docker/hooks/pre_build @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +# the architecture to build +declare BUILD_ARCH + +echo "BUILD_ARCH: ${BUILD_ARCH}" + +if [[ ${BUILD_ARCH} = "amd64" ]]; then + echo "No qemu required..." + exit 0 +fi +if [[ ${BUILD_ARCH} = "i386" ]]; then + echo "No qemu required..." + exit 0 +fi + +echo "Installing qemu..." +docker run --rm --privileged multiarch/qemu-user-static:register --reset diff --git a/docker/rootfs/etc/cont-init.d/10-requirements.sh b/docker/rootfs/etc/cont-init.d/10-requirements.sh new file mode 100755 index 000000000..898e811d3 --- /dev/null +++ b/docker/rootfs/etc/cont-init.d/10-requirements.sh @@ -0,0 +1,35 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: ESPHome +# This files check if all user configuration requirements are met +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +# Check SSL requirements, if enabled +if hass.config.true 'ssl'; then + if ! hass.config.has_value 'certfile'; then + hass.die 'SSL is enabled, but no certfile was specified.' + fi + + if ! hass.config.has_value 'keyfile'; then + hass.die 'SSL is enabled, but no keyfile was specified' + fi + + if ! hass.file_exists "/ssl/$(hass.config.get 'certfile')"; then + if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then + # Both files are missing, let's print a friendlier error message + text="You enabled encrypted connections using the \"ssl\": true option. + However, the SSL files \"$(hass.config.get 'certfile')\" and \"$(hass.config.get 'keyfile')\" + were not found. If you're using Hass.io on your local network and don't want + to encrypt connections to the ESPHome dashboard, you can manually disable + SSL by setting \"ssl\" to false." + hass.die "${text}" + fi + hass.die 'The configured certfile is not found' + fi + + if ! hass.file_exists "/ssl/$(hass.config.get 'keyfile')"; then + hass.die 'The configured keyfile is not found' + fi +fi diff --git a/docker/rootfs/etc/cont-init.d/20-nginx.sh b/docker/rootfs/etc/cont-init.d/20-nginx.sh new file mode 100755 index 000000000..42fcd1ef3 --- /dev/null +++ b/docker/rootfs/etc/cont-init.d/20-nginx.sh @@ -0,0 +1,28 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: ESPHome +# Configures NGINX for use with ESPHome +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +declare certfile +declare keyfile +declare port + +mkdir -p /var/log/nginx + +# Enable SSL +if hass.config.true 'ssl'; then + rm /etc/nginx/nginx.conf + mv /etc/nginx/nginx-ssl.conf /etc/nginx/nginx.conf + + certfile=$(hass.config.get 'certfile') + keyfile=$(hass.config.get 'keyfile') + + sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/nginx.conf + sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/nginx.conf +fi + +port=$(hass.config.get 'port') +sed -i "s/%%port%%/${port}/g" /etc/nginx/nginx.conf diff --git a/esphomeyaml-edge/rootfs/etc/cont-init.d/30-esphomeyaml.sh b/docker/rootfs/etc/cont-init.d/30-esphome.sh similarity index 50% rename from esphomeyaml-edge/rootfs/etc/cont-init.d/30-esphomeyaml.sh rename to docker/rootfs/etc/cont-init.d/30-esphome.sh index 0131b09b7..e4f6b506c 100644 --- a/esphomeyaml-edge/rootfs/etc/cont-init.d/30-esphomeyaml.sh +++ b/docker/rootfs/etc/cont-init.d/30-esphome.sh @@ -1,14 +1,14 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: esphomeyaml -# This files installs the user esphomeyaml version if specified +# Community Hass.io Add-ons: ESPHome +# This files installs the user ESPHome version if specified # ============================================================================== # shellcheck disable=SC1091 source /usr/lib/hassio-addons/base.sh -declare esphomeyaml_version +declare esphome_version -if hass.config.has_value 'esphomeyaml_version'; then - esphomeyaml_version=$(hass.config.get 'esphomeyaml_version') - pip2 install --no-cache-dir --no-binary :all: "https://github.com/OttoWinter/esphomeyaml/archive/${esphomeyaml_version}.zip" +if hass.config.has_value 'esphome_version'; then + esphome_version=$(hass.config.get 'esphome_version') + pip2 install --no-cache-dir --no-binary :all: "https://github.com/esphome/esphome/archive/${esphome_version}.zip" fi diff --git a/docker/rootfs/etc/cont-init.d/40-migrate.sh b/docker/rootfs/etc/cont-init.d/40-migrate.sh new file mode 100644 index 000000000..600440ff1 --- /dev/null +++ b/docker/rootfs/etc/cont-init.d/40-migrate.sh @@ -0,0 +1,13 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: ESPHome +# This files migrates the esphome config directory from the old path +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +if [[ ! -d /config/esphome && -d /config/esphomeyaml ]]; then + echo "Moving config directory from /config/esphomeyaml to /config/esphome" + mv /config/esphomeyaml /config/esphome + mv /config/esphome/.esphomeyaml /config/esphome/.esphome +fi diff --git a/docker/rootfs/etc/nginx/nginx-ssl.conf b/docker/rootfs/etc/nginx/nginx-ssl.conf new file mode 100755 index 000000000..cd76036fd --- /dev/null +++ b/docker/rootfs/etc/nginx/nginx-ssl.conf @@ -0,0 +1,62 @@ +worker_processes 1; +pid /var/run/nginx.pid; +error_log stderr; + +events { + worker_connections 1024; +} + +http { + access_log stdout; + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + upstream esphome { + ip_hash; + server unix:/var/run/esphome.sock; + } + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + server { + server_name hassio.local; + listen %%port%% default_server ssl; + root /dev/null; + + ssl_certificate /ssl/%%certfile%%; + ssl_certificate_key /ssl/%%keyfile%%; + ssl_protocols TLSv1.2; + ssl_prefer_server_ciphers on; + ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:DHE-RSA-AES256-SHA; + ssl_ecdh_curve secp384r1; + ssl_session_timeout 10m; + ssl_session_cache shared:SSL:10m; + ssl_session_tickets off; + ssl_stapling on; + ssl_stapling_verify on; + + # Redirect http requests to https on the same port. + # https://rageagainstshell.com/2016/11/redirect-http-to-https-on-the-same-port-in-nginx/ + error_page 497 https://$http_host$request_uri; + + location / { + proxy_redirect off; + proxy_pass http://esphome; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Authorization ""; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy true; + } + } +} diff --git a/docker/rootfs/etc/nginx/nginx.conf b/docker/rootfs/etc/nginx/nginx.conf new file mode 100755 index 000000000..4a0067c12 --- /dev/null +++ b/docker/rootfs/etc/nginx/nginx.conf @@ -0,0 +1,46 @@ +worker_processes 1; +pid /var/run/nginx.pid; +error_log stderr; + +events { + worker_connections 1024; +} + +http { + access_log stdout; + include mime.types; + default_type application/octet-stream; + sendfile on; + keepalive_timeout 65; + + upstream esphome { + ip_hash; + server unix:/var/run/esphome.sock; + } + map $http_upgrade $connection_upgrade { + default upgrade; + '' close; + } + + server { + server_name hassio.local; + listen %%port%% default_server; + root /dev/null; + + location / { + proxy_redirect off; + proxy_pass http://esphome; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_set_header Authorization ""; + + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; + proxy_set_header X-NginX-Proxy true; + } + } +} diff --git a/esphomeyaml-edge/rootfs/etc/services.d/esphomeyaml/finish b/docker/rootfs/etc/services.d/esphome/finish similarity index 73% rename from esphomeyaml-edge/rootfs/etc/services.d/esphomeyaml/finish rename to docker/rootfs/etc/services.d/esphome/finish index 4d0e9a35f..789a65e90 100755 --- a/esphomeyaml-edge/rootfs/etc/services.d/esphomeyaml/finish +++ b/docker/rootfs/etc/services.d/esphome/finish @@ -1,7 +1,7 @@ #!/usr/bin/execlineb -S0 # ============================================================================== -# Community Hass.io Add-ons: esphomeyaml -# Take down the S6 supervision tree when esphomeyaml fails +# Community Hass.io Add-ons: ESPHome +# Take down the S6 supervision tree when ESPHome fails # ============================================================================== if -n { s6-test $# -ne 0 } if -n { s6-test ${1} -eq 256 } diff --git a/esphomeyaml-edge/rootfs/etc/services.d/esphomeyaml/run b/docker/rootfs/etc/services.d/esphome/run similarity index 62% rename from esphomeyaml-edge/rootfs/etc/services.d/esphomeyaml/run rename to docker/rootfs/etc/services.d/esphome/run index 8f71cd809..8dea41abf 100755 --- a/esphomeyaml-edge/rootfs/etc/services.d/esphomeyaml/run +++ b/docker/rootfs/etc/services.d/esphome/run @@ -1,7 +1,7 @@ #!/usr/bin/with-contenv bash # ============================================================================== -# Community Hass.io Add-ons: esphomeyaml -# Runs the esphomeyaml dashboard +# Community Hass.io Add-ons: ESPHome +# Runs the ESPHome dashboard # ============================================================================== # shellcheck disable=SC1091 source /usr/lib/hassio-addons/base.sh @@ -10,5 +10,5 @@ if hass.config.true 'leave_front_door_open'; then export DISABLE_HA_AUTHENTICATION=true fi -hass.log.info "Starting esphomeyaml dashboard..." -exec esphomeyaml /config/esphomeyaml dashboard --socket /var/run/esphomeyaml.sock --hassio +hass.log.info "Starting ESPHome dashboard..." +exec esphome /config/esphome dashboard --socket /var/run/esphome.sock --hassio diff --git a/docker/rootfs/etc/services.d/nginx/finish b/docker/rootfs/etc/services.d/nginx/finish new file mode 100755 index 000000000..953f3771e --- /dev/null +++ b/docker/rootfs/etc/services.d/nginx/finish @@ -0,0 +1,9 @@ +#!/usr/bin/execlineb -S0 +# ============================================================================== +# Community Hass.io Add-ons: ESPHome +# Take down the S6 supervision tree when NGINX fails +# ============================================================================== +if -n { s6-test $# -ne 0 } +if -n { s6-test ${1} -eq 256 } + +s6-svscanctl -t /var/run/s6/services diff --git a/docker/rootfs/etc/services.d/nginx/run b/docker/rootfs/etc/services.d/nginx/run new file mode 100755 index 000000000..ab7e5db54 --- /dev/null +++ b/docker/rootfs/etc/services.d/nginx/run @@ -0,0 +1,10 @@ +#!/usr/bin/with-contenv bash +# ============================================================================== +# Community Hass.io Add-ons: ESPHome +# Runs the NGINX proxy +# ============================================================================== +# shellcheck disable=SC1091 +source /usr/lib/hassio-addons/base.sh + +hass.log.info "Starting NGINX..." +exec nginx -g "daemon off;" diff --git a/esphomeyaml/__init__.py b/esphome/__init__.py similarity index 100% rename from esphomeyaml/__init__.py rename to esphome/__init__.py diff --git a/esphomeyaml/__main__.py b/esphome/__main__.py similarity index 89% rename from esphomeyaml/__main__.py rename to esphome/__main__.py index 06dbd2761..1ba779d11 100644 --- a/esphomeyaml/__main__.py +++ b/esphome/__main__.py @@ -8,22 +8,22 @@ import os import random import sys -from esphomeyaml import const, core_config, mqtt, platformio_api, wizard, writer, yaml_util -from esphomeyaml.api.client import run_logs -from esphomeyaml.config import get_component, iter_components, read_config, strip_default_ids -from esphomeyaml.const import CONF_BAUD_RATE, CONF_ESPHOMEYAML, CONF_LOGGER, CONF_USE_CUSTOM_CODE, \ - CONF_BROKER -from esphomeyaml.core import CORE, EsphomeyamlError -from esphomeyaml.cpp_generator import Expression, RawStatement, add, statement -from esphomeyaml.helpers import color, indent -from esphomeyaml.py_compat import safe_input, text_type, IS_PY2 -from esphomeyaml.storage_json import StorageJSON, esphomeyaml_storage_path, \ +from esphome import const, core_config, mqtt, platformio_api, wizard, writer, yaml_util +from esphome.api.client import run_logs +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, esphome_storage_path, \ start_update_check_thread, storage_path -from esphomeyaml.util import run_external_command, run_external_process, safe_print +from esphome.util import run_external_command, run_external_process, safe_print _LOGGER = logging.getLogger(__name__) -PRE_INITIALIZE = ['esphomeyaml', 'logger', 'wifi', 'ethernet', 'ota', 'mqtt', 'web_server', 'api', +PRE_INITIALIZE = ['esphome', 'logger', 'wifi', 'ethernet', 'ota', 'mqtt', 'web_server', 'api', 'i2c'] @@ -127,9 +127,9 @@ def run_miniterm(config, port): def write_cpp(config): _LOGGER.info("Generating C++ source...") - CORE.add_job(core_config.to_code, config[CONF_ESPHOMEYAML], domain='esphomeyaml') + CORE.add_job(core_config.to_code, config[CONF_ESPHOME], domain='esphome') for domain in PRE_INITIALIZE: - if domain == CONF_ESPHOMEYAML or domain not in config: + if domain == CONF_ESPHOME or domain not in config: continue CORE.add_job(get_component(domain).to_code, config[domain], domain=domain) @@ -143,7 +143,7 @@ def write_cpp(config): add(RawStatement('')) all_code = [] for exp in CORE.expressions: - if not config[CONF_ESPHOMEYAML][CONF_USE_CUSTOM_CODE]: + if not config[CONF_ESPHOME][CONF_USE_CUSTOM_CODE]: if isinstance(exp, Expression) and not exp.required: continue all_code.append(text_type(statement(exp))) @@ -157,9 +157,9 @@ def write_cpp(config): def compile_program(args, config): _LOGGER.info("Compiling app...") - update_check = not os.getenv('ESPHOMEYAML_NO_UPDATE_CHECK', '') + update_check = not os.getenv('ESPHOME_NO_UPDATE_CHECK', '') if update_check: - thread = start_update_check_thread(esphomeyaml_storage_path(CORE.config_dir)) + thread = start_update_check_thread(esphome_storage_path(CORE.config_dir)) rc = platformio_api.run_compile(config, args.verbose) if update_check: thread.join() @@ -186,13 +186,13 @@ def upload_program(config, args, host): return upload_using_esptool(config, host) return platformio_api.run_upload(config, args.verbose, host) - from esphomeyaml.components import ota - from esphomeyaml import espota2 + from esphome.components import ota + from esphome import espota2 if args.host_port is not None: host_port = args.host_port else: - host_port = int(os.getenv('ESPHOMEYAML_OTA_HOST_PORT', random.randint(10000, 60000))) + host_port = int(os.getenv('ESPHOME_OTA_HOST_PORT', random.randint(10000, 60000))) verbose = args.verbose remote_port = ota.get_port(config) @@ -215,7 +215,7 @@ def upload_program(config, args, host): def show_logs(config, args, port): if 'logger' not in config: - raise EsphomeyamlError("Logger is not configured!") + raise EsphomeError("Logger is not configured!") if get_port_type(port) == 'SERIAL': run_miniterm(config, port) return 0 @@ -345,7 +345,7 @@ def command_clean(args, config): def command_hass_config(args, config): - from esphomeyaml.components import mqtt as mqtt_component + from esphome.components import mqtt as mqtt_component _LOGGER.info("This is what you should put in your Home Assistant YAML configuration.") _LOGGER.info("Please note this is only necessary if you're not using MQTT discovery.") @@ -367,7 +367,7 @@ def command_hass_config(args, config): def command_dashboard(args): - from esphomeyaml.dashboard import dashboard + from esphome.dashboard import dashboard return dashboard.start_web_server(args) @@ -392,8 +392,8 @@ POST_CONFIG_ACTIONS = { def parse_args(argv): - parser = argparse.ArgumentParser(prog='esphomeyaml') - parser.add_argument('-v', '--verbose', help="Enable verbose esphomeyaml logs.", + parser = argparse.ArgumentParser(prog='esphome') + parser.add_argument('-v', '--verbose', help="Enable verbose esphome logs.", action='store_true') parser.add_argument('--dashboard', help="Internal flag to set if the command is run from the " "dashboard.", action='store_true') @@ -444,11 +444,11 @@ def parse_args(argv): parser_clean.add_argument('--client-id', help='Manually set the client id.') subparsers.add_parser('wizard', help="A helpful setup wizard that will guide " - "you through setting up esphomeyaml.") + "you through setting up esphome.") subparsers.add_parser('mqtt-fingerprint', help="Get the SSL fingerprint from a MQTT broker.") - subparsers.add_parser('version', help="Print the esphomeyaml version and exit.") + subparsers.add_parser('version', help="Print the esphome version and exit.") subparsers.add_parser('clean', help="Delete all temporary build files.") @@ -461,7 +461,7 @@ def parse_args(argv): dashboard.add_argument("--open-ui", help="Open the dashboard UI in a browser.", action='store_true') dashboard.add_argument("--hassio", - help="Internal flag used to tell esphomeyaml is started as a Hass.io " + help="Internal flag used to tell esphome is started as a Hass.io " "add-on.", action="store_true") dashboard.add_argument("--socket", @@ -474,7 +474,7 @@ def parse_args(argv): return parser.parse_args(argv[1:]) -def run_esphomeyaml(argv): +def run_esphome(argv): args = parse_args(argv) CORE.dashboard = args.dashboard @@ -482,7 +482,7 @@ def run_esphomeyaml(argv): if args.command in PRE_CONFIG_ACTIONS: try: return PRE_CONFIG_ACTIONS[args.command](args) - except EsphomeyamlError as e: + except EsphomeError as e: _LOGGER.error(e) return 1 @@ -496,7 +496,7 @@ def run_esphomeyaml(argv): if args.command in POST_CONFIG_ACTIONS: try: return POST_CONFIG_ACTIONS[args.command](args, config) - except EsphomeyamlError as e: + except EsphomeError as e: _LOGGER.error(e) return 1 safe_print(u"Unknown command {}".format(args.command)) @@ -505,8 +505,8 @@ def run_esphomeyaml(argv): def main(): try: - return run_esphomeyaml(sys.argv) - except EsphomeyamlError as e: + return run_esphome(sys.argv) + except EsphomeError as e: _LOGGER.error(e) return 1 except KeyboardInterrupt: diff --git a/esphomeyaml/api/__init__.py b/esphome/api/__init__.py similarity index 100% rename from esphomeyaml/api/__init__.py rename to esphome/api/__init__.py diff --git a/esphomeyaml/api/api.proto b/esphome/api/api.proto similarity index 99% rename from esphomeyaml/api/api.proto rename to esphome/api/api.proto index bde079be1..37cb79295 100644 --- a/esphomeyaml/api/api.proto +++ b/esphome/api/api.proto @@ -92,7 +92,7 @@ message DeviceInfoResponse { // A string describing the date of compilation, this is generated by the compiler // and therefore may not be in the same format all the time. - // If the user isn't using esphomeyaml, this will also not be set. + // If the user isn't using esphome, this will also not be set. string compilation_time = 5; // The model of the board. For example NodeMCU diff --git a/esphomeyaml/api/api_pb2.py b/esphome/api/api_pb2.py similarity index 100% rename from esphomeyaml/api/api_pb2.py rename to esphome/api/api_pb2.py diff --git a/esphomeyaml/api/client.py b/esphome/api/client.py similarity index 95% rename from esphomeyaml/api/client.py rename to esphome/api/client.py index 08ded6b2b..148dadc47 100644 --- a/esphomeyaml/api/client.py +++ b/esphome/api/client.py @@ -9,18 +9,18 @@ import time from typing import Optional # noqa from google.protobuf import message # noqa -from esphomeyaml import const -import esphomeyaml.api.api_pb2 as pb -from esphomeyaml.const import CONF_PASSWORD, CONF_PORT -from esphomeyaml.core import EsphomeyamlError -from esphomeyaml.helpers import resolve_ip_address, indent, color -from esphomeyaml.py_compat import text_type, IS_PY2, byte_to_bytes, char_to_byte, format_bytes -from esphomeyaml.util import safe_print +from esphome import const +import esphome.api.api_pb2 as pb +from esphome.const import CONF_PASSWORD, CONF_PORT +from esphome.core import EsphomeError +from esphome.helpers import resolve_ip_address, indent, color +from esphome.py_compat import text_type, IS_PY2, byte_to_bytes, char_to_byte, format_bytes +from esphome.util import safe_print _LOGGER = logging.getLogger(__name__) -class APIConnectionError(EsphomeyamlError): +class APIConnectionError(EsphomeError): pass @@ -179,11 +179,11 @@ class APIClient(threading.Thread): try: ip = resolve_ip_address(self._address) - except EsphomeyamlError as err: + except EsphomeError as err: _LOGGER.warning("Error resolving IP address of %s. Is it connected to WiFi?", self._address) _LOGGER.warning("(If this error persists, please set a static IP address: " - "https://esphomelib.com/esphomeyaml/components/wifi.html#manual-ips)") + "https://esphome.io/components/wifi.html#manual-ips)") raise APIConnectionError(err) _LOGGER.info("Connecting to %s:%s (%s)", self._address, self._port, ip) @@ -200,7 +200,7 @@ class APIClient(threading.Thread): self._socket_open_event.set() hello = pb.HelloRequest() - hello.client_info = 'esphomeyaml v{}'.format(const.__version__) + hello.client_info = 'ESPHome v{}'.format(const.__version__) try: resp = self._send_message_await_response(hello, pb.HelloResponse) except APIConnectionError as err: @@ -423,7 +423,7 @@ def run_logs(config, address): conf = config['api'] port = conf[CONF_PORT] password = conf[CONF_PASSWORD] - _LOGGER.info("Starting log output from %s using esphomelib API", address) + _LOGGER.info("Starting log output from %s using esphome API", address) cli = APIClient(address, port, password) stopping = False diff --git a/esphomeyaml/automation.py b/esphome/automation.py similarity index 91% rename from esphomeyaml/automation.py rename to esphome/automation.py index d094b9f59..c5ad537b9 100644 --- a/esphomeyaml/automation.py +++ b/esphome/automation.py @@ -2,16 +2,16 @@ import copy import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ABOVE, CONF_ACTION_ID, CONF_AND, CONF_AUTOMATION_ID, \ +import esphome.config_validation as cv +from esphome.const import CONF_ABOVE, CONF_ACTION_ID, CONF_AND, CONF_AUTOMATION_ID, \ CONF_BELOW, CONF_CONDITION, CONF_CONDITION_ID, CONF_DELAY, CONF_ELSE, CONF_ID, CONF_IF, \ CONF_LAMBDA, CONF_OR, CONF_RANGE, CONF_THEN, CONF_TRIGGER_ID, CONF_WHILE -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, TemplateArguments, add, get_variable, \ +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, TemplateArguments, add, get_variable, \ process_lambda, templatable -from esphomeyaml.cpp_types import Action, App, Component, PollingComponent, Trigger, bool_, \ - esphomelib_ns, float_, uint32, void -from esphomeyaml.util import ServiceRegistry +from esphome.cpp_types import Action, App, Component, PollingComponent, Trigger, bool_, \ + esphome_ns, float_, uint32, void +from esphome.util import ServiceRegistry def maybe_simple_id(*validators): @@ -98,18 +98,18 @@ ACTION_REGISTRY = ServiceRegistry() CONDITION_REGISTRY = ServiceRegistry() # pylint: disable=invalid-name -DelayAction = esphomelib_ns.class_('DelayAction', Action, Component) -LambdaAction = esphomelib_ns.class_('LambdaAction', Action) -IfAction = esphomelib_ns.class_('IfAction', Action) -WhileAction = esphomelib_ns.class_('WhileAction', Action) -UpdateComponentAction = esphomelib_ns.class_('UpdateComponentAction', Action) -Automation = esphomelib_ns.class_('Automation') +DelayAction = esphome_ns.class_('DelayAction', Action, Component) +LambdaAction = esphome_ns.class_('LambdaAction', Action) +IfAction = esphome_ns.class_('IfAction', Action) +WhileAction = esphome_ns.class_('WhileAction', Action) +UpdateComponentAction = esphome_ns.class_('UpdateComponentAction', Action) +Automation = esphome_ns.class_('Automation') -Condition = esphomelib_ns.class_('Condition') -AndCondition = esphomelib_ns.class_('AndCondition', Condition) -OrCondition = esphomelib_ns.class_('OrCondition', Condition) -RangeCondition = esphomelib_ns.class_('RangeCondition', Condition) -LambdaCondition = esphomelib_ns.class_('LambdaCondition', Condition) +Condition = esphome_ns.class_('Condition') +AndCondition = esphome_ns.class_('AndCondition', Condition) +OrCondition = esphome_ns.class_('OrCondition', Condition) +RangeCondition = esphome_ns.class_('RangeCondition', Condition) +LambdaCondition = esphome_ns.class_('LambdaCondition', Condition) def validate_automation(extra_schema=None, extra_validators=None, single=False): diff --git a/esphomeyaml/components/__init__.py b/esphome/components/__init__.py similarity index 100% rename from esphomeyaml/components/__init__.py rename to esphome/components/__init__.py diff --git a/esphomeyaml/components/ads1115.py b/esphome/components/ads1115.py similarity index 64% rename from esphomeyaml/components/ads1115.py rename to esphome/components/ads1115.py index 70be84ae7..0bf25125b 100644 --- a/esphomeyaml/components/ads1115.py +++ b/esphome/components/ads1115.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['i2c'] MULTI_CONF = True diff --git a/esphomeyaml/components/apds9960.py b/esphome/components/apds9960.py similarity index 67% rename from esphomeyaml/components/apds9960.py rename to esphome/components/apds9960.py index e9f7782b4..bebe71e3f 100644 --- a/esphomeyaml/components/apds9960.py +++ b/esphome/components/apds9960.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] MULTI_CONF = True diff --git a/esphomeyaml/components/api.py b/esphome/components/api.py similarity index 83% rename from esphomeyaml/components/api.py rename to esphome/components/api.py index 4775ef626..3acf0b914 100644 --- a/esphomeyaml/components/api.py +++ b/esphome/components/api.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DATA, CONF_DATA_TEMPLATE, CONF_ID, CONF_PASSWORD, CONF_PORT, \ - CONF_SERVICE, CONF_VARIABLES, CONF_REBOOT_TIMEOUT -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import Action, App, Component, StoringController, esphomelib_ns +from esphome.automation import ACTION_REGISTRY +import esphome.config_validation as cv +from esphome.const import CONF_DATA, CONF_DATA_TEMPLATE, CONF_ID, CONF_PASSWORD, CONF_PORT, \ + CONF_REBOOT_TIMEOUT, CONF_SERVICE, CONF_VARIABLES +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import Action, App, Component, StoringController, esphome_ns -api_ns = esphomelib_ns.namespace('api') +api_ns = esphome_ns.namespace('api') APIServer = api_ns.class_('APIServer', Component, StoringController) HomeAssistantServiceCallAction = api_ns.class_('HomeAssistantServiceCallAction', Action) KeyValuePair = api_ns.class_('KeyValuePair') diff --git a/esphomeyaml/components/binary_sensor/__init__.py b/esphome/components/binary_sensor/__init__.py similarity index 94% rename from esphomeyaml/components/binary_sensor/__init__.py rename to esphome/components/binary_sensor/__init__.py index 7ee847b78..2cb2b2ef1 100644 --- a/esphomeyaml/components/binary_sensor/__init__.py +++ b/esphome/components/binary_sensor/__init__.py @@ -1,21 +1,19 @@ import voluptuous as vol -from esphomeyaml import automation, core -from esphomeyaml.automation import CONDITION_REGISTRY, Condition, maybe_simple_id -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DELAYED_OFF, CONF_DELAYED_ON, CONF_DEVICE_CLASS, CONF_FILTERS, \ +from esphome import automation, core +from esphome.automation import CONDITION_REGISTRY, Condition, maybe_simple_id +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_DELAYED_OFF, CONF_DELAYED_ON, CONF_DEVICE_CLASS, CONF_FILTERS, \ CONF_HEARTBEAT, CONF_ID, CONF_INTERNAL, CONF_INVALID_COOLDOWN, CONF_INVERT, CONF_INVERTED, \ CONF_LAMBDA, CONF_MAX_LENGTH, CONF_MIN_LENGTH, CONF_MQTT_ID, CONF_ON_CLICK, \ CONF_ON_DOUBLE_CLICK, CONF_ON_MULTI_CLICK, CONF_ON_PRESS, CONF_ON_RELEASE, CONF_ON_STATE, \ CONF_STATE, CONF_TIMING, CONF_TRIGGER_ID -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, StructInitializer, add, get_variable, \ - process_lambda -from esphomeyaml.cpp_types import App, Component, Nameable, NoArg, Trigger, bool_, esphomelib_ns, \ - optional -from esphomeyaml.py_compat import string_types +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, StructInitializer, add, get_variable, process_lambda +from esphome.cpp_types import App, Component, Nameable, NoArg, Trigger, bool_, esphome_ns, optional +from esphome.py_compat import string_types DEVICE_CLASSES = [ '', 'battery', 'cold', 'connectivity', 'door', 'garage_door', 'gas', @@ -28,7 +26,7 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) -binary_sensor_ns = esphomelib_ns.namespace('binary_sensor') +binary_sensor_ns = esphome_ns.namespace('binary_sensor') BinarySensor = binary_sensor_ns.class_('BinarySensor', Nameable) BinarySensorPtr = BinarySensor.operator('ptr') MQTTBinarySensorComponent = binary_sensor_ns.class_('MQTTBinarySensorComponent', mqtt.MQTTComponent) @@ -191,7 +189,7 @@ BINARY_SENSOR_SCHEMA = cv.MQTT_COMPONENT_SCHEMA.extend({ vol.Optional(CONF_INVERTED): cv.invalid( "The inverted binary_sensor property has been replaced by the " "new 'invert' binary sensor filter. Please see " - "https://esphomelib.com/esphomeyaml/components/binary_sensor/index.html." + "https://esphome.io/components/binary_sensor/index.html." ), }) diff --git a/esphomeyaml/components/binary_sensor/apds9960.py b/esphome/components/binary_sensor/apds9960.py similarity index 78% rename from esphomeyaml/components/binary_sensor/apds9960.py rename to esphome/components/binary_sensor/apds9960.py index 11444bce8..ba394f954 100644 --- a/esphomeyaml/components/binary_sensor/apds9960.py +++ b/esphome/components/binary_sensor/apds9960.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor, sensor -from esphomeyaml.components.apds9960 import APDS9960, CONF_APDS9960_ID -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DIRECTION, CONF_NAME -from esphomeyaml.cpp_generator import get_variable +from esphome.components import binary_sensor, sensor +from esphome.components.apds9960 import APDS9960, CONF_APDS9960_ID +import esphome.config_validation as cv +from esphome.const import CONF_DIRECTION, CONF_NAME +from esphome.cpp_generator import get_variable DEPENDENCIES = ['apds9960'] APDS9960GestureDirectionBinarySensor = sensor.sensor_ns.class_( diff --git a/esphomeyaml/components/binary_sensor/custom.py b/esphome/components/binary_sensor/custom.py similarity index 80% rename from esphomeyaml/components/binary_sensor/custom.py rename to esphome/components/binary_sensor/custom.py index b9162bf64..497aa7fc7 100644 --- a/esphomeyaml/components/binary_sensor/custom.py +++ b/esphome/components/binary_sensor/custom.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BINARY_SENSORS, CONF_ID, CONF_LAMBDA, CONF_NAME -from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable, add -from esphomeyaml.cpp_types import std_vector +from esphome.components import binary_sensor +import esphome.config_validation as cv +from esphome.const import CONF_BINARY_SENSORS, CONF_ID, CONF_LAMBDA, CONF_NAME +from esphome.cpp_generator import Pvariable, add, process_lambda, variable +from esphome.cpp_types import std_vector CustomBinarySensorConstructor = binary_sensor.binary_sensor_ns.class_( 'CustomBinarySensorConstructor') diff --git a/esphomeyaml/components/binary_sensor/esp32_ble_tracker.py b/esphome/components/binary_sensor/esp32_ble_tracker.py similarity index 61% rename from esphomeyaml/components/binary_sensor/esp32_ble_tracker.py rename to esphome/components/binary_sensor/esp32_ble_tracker.py index 717c1355c..6a66184b4 100644 --- a/esphomeyaml/components/binary_sensor/esp32_ble_tracker.py +++ b/esphome/components/binary_sensor/esp32_ble_tracker.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor -from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ +from esphome.components import binary_sensor +from esphome.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ make_address_array -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_MAC_ADDRESS, CONF_NAME -from esphomeyaml.cpp_generator import get_variable -from esphomeyaml.cpp_types import esphomelib_ns +import esphome.config_validation as cv +from esphome.const import CONF_MAC_ADDRESS, CONF_NAME +from esphome.cpp_generator import get_variable +from esphome.cpp_types import esphome_ns DEPENDENCIES = ['esp32_ble_tracker'] -ESP32BLEPresenceDevice = esphomelib_ns.class_('ESP32BLEPresenceDevice', binary_sensor.BinarySensor) +ESP32BLEPresenceDevice = esphome_ns.class_('ESP32BLEPresenceDevice', binary_sensor.BinarySensor) PLATFORM_SCHEMA = cv.nameable(binary_sensor.BINARY_SENSOR_PLATFORM_SCHEMA.extend({ cv.GenerateID(): cv.declare_variable_id(ESP32BLEPresenceDevice), diff --git a/esphomeyaml/components/binary_sensor/esp32_touch.py b/esphome/components/binary_sensor/esp32_touch.py similarity index 80% rename from esphomeyaml/components/binary_sensor/esp32_touch.py rename to esphome/components/binary_sensor/esp32_touch.py index 6c9084627..ecaa30605 100644 --- a/esphomeyaml/components/binary_sensor/esp32_touch.py +++ b/esphome/components/binary_sensor/esp32_touch.py @@ -1,12 +1,12 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.components import binary_sensor -from esphomeyaml.components.esp32_touch import ESP32TouchComponent -from esphomeyaml.const import CONF_NAME, CONF_PIN, CONF_THRESHOLD, ESP_PLATFORM_ESP32 -from esphomeyaml.cpp_generator import get_variable -from esphomeyaml.cpp_types import global_ns -from esphomeyaml.pins import validate_gpio_pin +from esphome.components import binary_sensor +from esphome.components.esp32_touch import ESP32TouchComponent +import esphome.config_validation as cv +from esphome.const import CONF_NAME, CONF_PIN, CONF_THRESHOLD, ESP_PLATFORM_ESP32 +from esphome.cpp_generator import get_variable +from esphome.cpp_types import global_ns +from esphome.pins import validate_gpio_pin ESP_PLATFORMS = [ESP_PLATFORM_ESP32] diff --git a/esphomeyaml/components/binary_sensor/gpio.py b/esphome/components/binary_sensor/gpio.py similarity index 73% rename from esphomeyaml/components/binary_sensor/gpio.py rename to esphome/components/binary_sensor/gpio.py index a1a5e6980..361796fa7 100644 --- a/esphomeyaml/components/binary_sensor/gpio.py +++ b/esphome/components/binary_sensor/gpio.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import binary_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_PIN -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome import pins +from esphome.components import binary_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_PIN +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import App, Component GPIOBinarySensorComponent = binary_sensor.binary_sensor_ns.class_('GPIOBinarySensorComponent', binary_sensor.BinarySensor, diff --git a/esphomeyaml/components/binary_sensor/homeassistant.py b/esphome/components/binary_sensor/homeassistant.py similarity index 76% rename from esphomeyaml/components/binary_sensor/homeassistant.py rename to esphome/components/binary_sensor/homeassistant.py index e3f46a9dc..4b5f78335 100644 --- a/esphomeyaml/components/binary_sensor/homeassistant.py +++ b/esphome/components/binary_sensor/homeassistant.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_types import App +from esphome.components import binary_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_types import App DEPENDENCIES = ['api'] diff --git a/esphomeyaml/components/binary_sensor/nextion.py b/esphome/components/binary_sensor/nextion.py similarity index 76% rename from esphomeyaml/components/binary_sensor/nextion.py rename to esphome/components/binary_sensor/nextion.py index ff4e9d34d..fde96b76c 100644 --- a/esphomeyaml/components/binary_sensor/nextion.py +++ b/esphome/components/binary_sensor/nextion.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor, display -from esphomeyaml.components.display.nextion import Nextion -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_COMPONENT_ID, CONF_NAME, CONF_PAGE_ID -from esphomeyaml.cpp_generator import get_variable +from esphome.components import binary_sensor, display +from esphome.components.display.nextion import Nextion +import esphome.config_validation as cv +from esphome.const import CONF_COMPONENT_ID, CONF_NAME, CONF_PAGE_ID +from esphome.cpp_generator import get_variable DEPENDENCIES = ['display'] diff --git a/esphomeyaml/components/binary_sensor/pn532.py b/esphome/components/binary_sensor/pn532.py similarity index 83% rename from esphomeyaml/components/binary_sensor/pn532.py rename to esphome/components/binary_sensor/pn532.py index 3ee45ce3f..4f4e159e8 100644 --- a/esphomeyaml/components/binary_sensor/pn532.py +++ b/esphome/components/binary_sensor/pn532.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor -from esphomeyaml.components.pn532 import PN532Component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_NAME, CONF_UID -from esphomeyaml.core import HexInt -from esphomeyaml.cpp_generator import get_variable +from esphome.components import binary_sensor +from esphome.components.pn532 import PN532Component +import esphome.config_validation as cv +from esphome.const import CONF_NAME, CONF_UID +from esphome.core import HexInt +from esphome.cpp_generator import get_variable DEPENDENCIES = ['pn532'] diff --git a/esphomeyaml/components/binary_sensor/rdm6300.py b/esphome/components/binary_sensor/rdm6300.py similarity index 80% rename from esphomeyaml/components/binary_sensor/rdm6300.py rename to esphome/components/binary_sensor/rdm6300.py index 24aa69f0f..0041ea6d0 100644 --- a/esphomeyaml/components/binary_sensor/rdm6300.py +++ b/esphome/components/binary_sensor/rdm6300.py @@ -1,9 +1,9 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.components import binary_sensor, rdm6300 -from esphomeyaml.const import CONF_NAME, CONF_UID -from esphomeyaml.cpp_generator import get_variable +from esphome.components import binary_sensor, rdm6300 +import esphome.config_validation as cv +from esphome.const import CONF_NAME, CONF_UID +from esphome.cpp_generator import get_variable DEPENDENCIES = ['rdm6300'] diff --git a/esphomeyaml/components/binary_sensor/remote_receiver.py b/esphome/components/binary_sensor/remote_receiver.py similarity index 90% rename from esphomeyaml/components/binary_sensor/remote_receiver.py rename to esphome/components/binary_sensor/remote_receiver.py index b262aef07..d8a0e9cc9 100644 --- a/esphomeyaml/components/binary_sensor/remote_receiver.py +++ b/esphome/components/binary_sensor/remote_receiver.py @@ -1,18 +1,18 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor -from esphomeyaml.components.remote_receiver import RemoteReceiverComponent, remote_ns -from esphomeyaml.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ +from esphome.components import binary_sensor +from esphome.components.remote_receiver import RemoteReceiverComponent, remote_ns +from esphome.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ RC_SWITCH_TYPE_A_SCHEMA, RC_SWITCH_TYPE_B_SCHEMA, RC_SWITCH_TYPE_C_SCHEMA, \ RC_SWITCH_TYPE_D_SCHEMA, binary_code, build_rc_switch_protocol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_CHANNEL, CONF_CODE, CONF_COMMAND, CONF_DATA, \ - CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_JVC, CONF_LG, CONF_NAME, CONF_NBITS, CONF_NEC, \ - CONF_PANASONIC, CONF_PROTOCOL, CONF_RAW, CONF_RC_SWITCH_RAW, CONF_RC_SWITCH_TYPE_A, \ +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_CHANNEL, CONF_CODE, CONF_COMMAND, CONF_DATA, \ + CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_ID, CONF_JVC, CONF_LG, CONF_NAME, CONF_NBITS, \ + CONF_NEC, CONF_PANASONIC, CONF_PROTOCOL, CONF_RAW, CONF_RC_SWITCH_RAW, CONF_RC_SWITCH_TYPE_A, \ CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, CONF_RC_SWITCH_TYPE_D, CONF_SAMSUNG, CONF_SONY, \ - CONF_STATE, CONF_ID -from esphomeyaml.cpp_generator import Pvariable, get_variable, progmem_array -from esphomeyaml.cpp_types import int32 + CONF_STATE +from esphome.cpp_generator import Pvariable, get_variable, progmem_array +from esphome.cpp_types import int32 DEPENDENCIES = ['remote_receiver'] diff --git a/esphomeyaml/components/binary_sensor/status.py b/esphome/components/binary_sensor/status.py similarity index 72% rename from esphomeyaml/components/binary_sensor/status.py rename to esphome/components/binary_sensor/status.py index f4f45b65d..f879d9c34 100644 --- a/esphomeyaml/components/binary_sensor/status.py +++ b/esphome/components/binary_sensor/status.py @@ -1,9 +1,9 @@ -from esphomeyaml.components import binary_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import binary_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component StatusBinarySensor = binary_sensor.binary_sensor_ns.class_('StatusBinarySensor', binary_sensor.BinarySensor, diff --git a/esphomeyaml/components/binary_sensor/template.py b/esphome/components/binary_sensor/template.py similarity index 82% rename from esphomeyaml/components/binary_sensor/template.py rename to esphome/components/binary_sensor/template.py index e025eea1e..e0952a406 100644 --- a/esphomeyaml/components/binary_sensor/template.py +++ b/esphome/components/binary_sensor/template.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY -from esphomeyaml.components import binary_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_STATE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import Action, App, Component, bool_, optional +from esphome.automation import ACTION_REGISTRY +from esphome.components import binary_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_STATE +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import Action, App, Component, bool_, optional TemplateBinarySensor = binary_sensor.binary_sensor_ns.class_('TemplateBinarySensor', binary_sensor.BinarySensor, diff --git a/esphomeyaml/components/cover/__init__.py b/esphome/components/cover/__init__.py similarity index 85% rename from esphomeyaml/components/cover/__init__.py rename to esphome/components/cover/__init__.py index bfa9d4fbc..48c9dc90f 100644 --- a/esphomeyaml/components/cover/__init__.py +++ b/esphome/components/cover/__init__.py @@ -1,19 +1,19 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY, maybe_simple_id -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_INTERNAL, CONF_MQTT_ID -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable -from esphomeyaml.cpp_types import Action, Nameable, esphomelib_ns +from esphome.automation import ACTION_REGISTRY, maybe_simple_id +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INTERNAL, CONF_MQTT_ID +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable +from esphome.cpp_types import Action, Nameable, esphome_ns PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) -cover_ns = esphomelib_ns.namespace('cover') +cover_ns = esphome_ns.namespace('cover') Cover = cover_ns.class_('Cover', Nameable) MQTTCoverComponent = cover_ns.class_('MQTTCoverComponent', mqtt.MQTTComponent) diff --git a/esphomeyaml/components/cover/template.py b/esphome/components/cover/template.py similarity index 83% rename from esphomeyaml/components/cover/template.py rename to esphome/components/cover/template.py index 83829746d..5f278da7b 100644 --- a/esphomeyaml/components/cover/template.py +++ b/esphome/components/cover/template.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.automation import ACTION_REGISTRY -from esphomeyaml.components import cover -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ASSUMED_STATE, CONF_CLOSE_ACTION, CONF_ID, CONF_LAMBDA, \ - CONF_NAME, CONF_OPEN_ACTION, CONF_OPTIMISTIC, CONF_STATE, CONF_STOP_ACTION -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import Action, App, NoArg, optional -from esphomeyaml.py_compat import string_types +from esphome import automation +from esphome.automation import ACTION_REGISTRY +from esphome.components import cover +import esphome.config_validation as cv +from esphome.const import CONF_ASSUMED_STATE, CONF_CLOSE_ACTION, CONF_ID, CONF_LAMBDA, CONF_NAME, \ + CONF_OPEN_ACTION, CONF_OPTIMISTIC, CONF_STATE, CONF_STOP_ACTION +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import Action, App, NoArg, optional +from esphome.py_compat import string_types TemplateCover = cover.cover_ns.class_('TemplateCover', cover.Cover) CoverPublishAction = cover.cover_ns.class_('CoverPublishAction', Action) diff --git a/esphomeyaml/components/custom_component.py b/esphome/components/custom_component.py similarity index 68% rename from esphomeyaml/components/custom_component.py rename to esphome/components/custom_component.py index 81a837198..2af824f50 100644 --- a/esphomeyaml/components/custom_component.py +++ b/esphome/components/custom_component.py @@ -1,12 +1,12 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_COMPONENTS -from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import Component, ComponentPtr, esphomelib_ns, std_vector +import esphome.config_validation as cv +from esphome.const import CONF_COMPONENTS, CONF_ID, CONF_LAMBDA +from esphome.cpp_generator import Pvariable, process_lambda, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import Component, ComponentPtr, esphome_ns, std_vector -CustomComponentConstructor = esphomelib_ns.class_('CustomComponentConstructor') +CustomComponentConstructor = esphome_ns.class_('CustomComponentConstructor') MULTI_CONF = True CONFIG_SCHEMA = vol.Schema({ diff --git a/esphomeyaml/components/dallas.py b/esphome/components/dallas.py similarity index 63% rename from esphomeyaml/components/dallas.py rename to esphome/components/dallas.py index 5fc99f828..7bfc8144f 100644 --- a/esphomeyaml/components/dallas.py +++ b/esphome/components/dallas.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_PIN, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_PIN, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DallasComponent = sensor.sensor_ns.class_('DallasComponent', PollingComponent) MULTI_CONF = True diff --git a/esphomeyaml/components/debug.py b/esphome/components/debug.py similarity index 69% rename from esphomeyaml/components/debug.py rename to esphome/components/debug.py index 5751f1517..110510591 100644 --- a/esphomeyaml/components/debug.py +++ b/esphome/components/debug.py @@ -1,7 +1,7 @@ import voluptuous as vol -from esphomeyaml.cpp_generator import add -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import add +from esphome.cpp_types import App DEPENDENCIES = ['logger'] diff --git a/esphomeyaml/components/deep_sleep.py b/esphome/components/deep_sleep.py similarity index 84% rename from esphomeyaml/components/deep_sleep.py rename to esphome/components/deep_sleep.py index d76a14fd6..9313130b7 100644 --- a/esphomeyaml/components/deep_sleep.py +++ b/esphome/components/deep_sleep.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import config_validation as cv, pins -from esphomeyaml.automation import ACTION_REGISTRY, maybe_simple_id -from esphomeyaml.const import CONF_ID, CONF_MODE, CONF_NUMBER, CONF_PINS, CONF_RUN_CYCLES, \ +from esphome import config_validation as cv, pins +from esphome.automation import ACTION_REGISTRY, maybe_simple_id +from esphome.const import CONF_ID, CONF_MODE, CONF_NUMBER, CONF_PINS, CONF_RUN_CYCLES, \ CONF_RUN_DURATION, CONF_SLEEP_DURATION, CONF_WAKEUP_PIN -from esphomeyaml.cpp_generator import Pvariable, StructInitializer, add, get_variable -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import Action, App, Component, esphomelib_ns, global_ns +from esphome.cpp_generator import Pvariable, StructInitializer, add, get_variable +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import Action, App, Component, esphome_ns, global_ns def validate_pin_number(value): @@ -17,11 +17,11 @@ def validate_pin_number(value): return value -DeepSleepComponent = esphomelib_ns.class_('DeepSleepComponent', Component) -EnterDeepSleepAction = esphomelib_ns.class_('EnterDeepSleepAction', Action) -PreventDeepSleepAction = esphomelib_ns.class_('PreventDeepSleepAction', Action) +DeepSleepComponent = esphome_ns.class_('DeepSleepComponent', Component) +EnterDeepSleepAction = esphome_ns.class_('EnterDeepSleepAction', Action) +PreventDeepSleepAction = esphome_ns.class_('PreventDeepSleepAction', Action) -WakeupPinMode = esphomelib_ns.enum('WakeupPinMode') +WakeupPinMode = esphome_ns.enum('WakeupPinMode') WAKEUP_PIN_MODES = { 'IGNORE': WakeupPinMode.WAKEUP_PIN_MODE_IGNORE, 'KEEP_AWAKE': WakeupPinMode.WAKEUP_PIN_MODE_KEEP_AWAKE, @@ -29,7 +29,7 @@ WAKEUP_PIN_MODES = { } esp_sleep_ext1_wakeup_mode_t = global_ns.enum('esp_sleep_ext1_wakeup_mode_t') -Ext1Wakeup = esphomelib_ns.struct('Ext1Wakeup') +Ext1Wakeup = esphome_ns.struct('Ext1Wakeup') EXT1_WAKEUP_MODES = { 'ALL_LOW': esp_sleep_ext1_wakeup_mode_t.ESP_EXT1_WAKEUP_ALL_LOW, 'ANY_HIGH': esp_sleep_ext1_wakeup_mode_t.ESP_EXT1_WAKEUP_ANY_HIGH, diff --git a/esphomeyaml/components/display/__init__.py b/esphome/components/display/__init__.py similarity index 82% rename from esphomeyaml/components/display/__init__.py rename to esphome/components/display/__init__.py index db232551a..dac4984a6 100644 --- a/esphomeyaml/components/display/__init__.py +++ b/esphome/components/display/__init__.py @@ -1,17 +1,17 @@ # coding=utf-8 import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_LAMBDA, CONF_ROTATION, CONF_UPDATE_INTERVAL -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import add -from esphomeyaml.cpp_types import esphomelib_ns +import esphome.config_validation as cv +from esphome.const import CONF_LAMBDA, CONF_ROTATION, CONF_UPDATE_INTERVAL +from esphome.core import CORE +from esphome.cpp_generator import add +from esphome.cpp_types import esphome_ns PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) -display_ns = esphomelib_ns.namespace('display') +display_ns = esphome_ns.namespace('display') DisplayBuffer = display_ns.class_('DisplayBuffer') DisplayBufferRef = DisplayBuffer.operator('ref') diff --git a/esphomeyaml/components/display/lcd_gpio.py b/esphome/components/display/lcd_gpio.py similarity index 84% rename from esphomeyaml/components/display/lcd_gpio.py rename to esphome/components/display/lcd_gpio.py index c796ed3f2..ac2a781e5 100644 --- a/esphomeyaml/components/display/lcd_gpio.py +++ b/esphome/components/display/lcd_gpio.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import display -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DATA_PINS, CONF_DIMENSIONS, CONF_ENABLE_PIN, CONF_ID, \ +from esphome import pins +from esphome.components import display +import esphome.config_validation as cv +from esphome.const import CONF_DATA_PINS, CONF_DIMENSIONS, CONF_ENABLE_PIN, CONF_ID, \ CONF_LAMBDA, CONF_RS_PIN, CONF_RW_PIN -from esphomeyaml.cpp_generator import Pvariable, add, process_lambda -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, PollingComponent, void +from esphome.cpp_generator import Pvariable, add, process_lambda +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, PollingComponent, void LCDDisplay = display.display_ns.class_('LCDDisplay', PollingComponent) LCDDisplayRef = LCDDisplay.operator('ref') diff --git a/esphomeyaml/components/display/lcd_pcf8574.py b/esphome/components/display/lcd_pcf8574.py similarity index 71% rename from esphomeyaml/components/display/lcd_pcf8574.py rename to esphome/components/display/lcd_pcf8574.py index cc3792f99..0a96c65bf 100644 --- a/esphomeyaml/components/display/lcd_pcf8574.py +++ b/esphome/components/display/lcd_pcf8574.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import display, i2c -from esphomeyaml.components.display.lcd_gpio import LCDDisplay, LCDDisplayRef, \ +from esphome.components import display, i2c +from esphome.components.display.lcd_gpio import LCDDisplay, LCDDisplayRef, \ validate_lcd_dimensions -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_DIMENSIONS, CONF_ID, CONF_LAMBDA -from esphomeyaml.cpp_generator import Pvariable, add, process_lambda -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, void +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_DIMENSIONS, CONF_ID, CONF_LAMBDA +from esphome.cpp_generator import Pvariable, add, process_lambda +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, void DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/display/max7219.py b/esphome/components/display/max7219.py similarity index 74% rename from esphomeyaml/components/display/max7219.py rename to esphome/components/display/max7219.py index fcca07154..28f592461 100644 --- a/esphomeyaml/components/display/max7219.py +++ b/esphome/components/display/max7219.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import display, spi -from esphomeyaml.components.spi import SPIComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CS_PIN, CONF_ID, CONF_INTENSITY, CONF_LAMBDA, CONF_NUM_CHIPS, \ +from esphome import pins +from esphome.components import display, spi +from esphome.components.spi import SPIComponent +import esphome.config_validation as cv +from esphome.const import CONF_CS_PIN, CONF_ID, CONF_INTENSITY, CONF_LAMBDA, CONF_NUM_CHIPS, \ CONF_SPI_ID -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, PollingComponent, void +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, PollingComponent, void DEPENDENCIES = ['spi'] diff --git a/esphomeyaml/components/display/nextion.py b/esphome/components/display/nextion.py similarity index 68% rename from esphomeyaml/components/display/nextion.py rename to esphome/components/display/nextion.py index 4d051c39b..9e921d68c 100644 --- a/esphomeyaml/components/display/nextion.py +++ b/esphome/components/display/nextion.py @@ -1,10 +1,10 @@ -from esphomeyaml.components import display, uart -from esphomeyaml.components.uart import UARTComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_UART_ID -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent, void +from esphome.components import display, uart +from esphome.components.uart import UARTComponent +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_UART_ID +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent, void DEPENDENCIES = ['uart'] diff --git a/esphomeyaml/components/display/ssd1306_i2c.py b/esphome/components/display/ssd1306_i2c.py similarity index 74% rename from esphomeyaml/components/display/ssd1306_i2c.py rename to esphome/components/display/ssd1306_i2c.py index 966ecdc84..1d2cddb54 100644 --- a/esphomeyaml/components/display/ssd1306_i2c.py +++ b/esphome/components/display/ssd1306_i2c.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import display -from esphomeyaml.components.display import ssd1306_spi -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_EXTERNAL_VCC, CONF_ID, CONF_LAMBDA, CONF_MODEL, \ +from esphome import pins +from esphome.components import display +from esphome.components.display import ssd1306_spi +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_EXTERNAL_VCC, CONF_ID, CONF_LAMBDA, CONF_MODEL, \ CONF_RESET_PIN -from esphomeyaml.cpp_generator import Pvariable, add, process_lambda -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, void +from esphome.cpp_generator import Pvariable, add, process_lambda +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, void DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/display/ssd1306_spi.py b/esphome/components/display/ssd1306_spi.py similarity index 82% rename from esphomeyaml/components/display/ssd1306_spi.py rename to esphome/components/display/ssd1306_spi.py index 635ccde04..a6b6a6727 100644 --- a/esphomeyaml/components/display/ssd1306_spi.py +++ b/esphome/components/display/ssd1306_spi.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import display, spi -from esphomeyaml.components.spi import SPIComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CS_PIN, CONF_DC_PIN, CONF_EXTERNAL_VCC, CONF_ID, CONF_LAMBDA, \ +from esphome import pins +from esphome.components import display, spi +from esphome.components.spi import SPIComponent +import esphome.config_validation as cv +from esphome.const import CONF_CS_PIN, CONF_DC_PIN, CONF_EXTERNAL_VCC, CONF_ID, CONF_LAMBDA, \ CONF_MODEL, CONF_RESET_PIN, CONF_SPI_ID -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, PollingComponent, void +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, PollingComponent, void DEPENDENCIES = ['spi'] diff --git a/esphomeyaml/components/display/waveshare_epaper.py b/esphome/components/display/waveshare_epaper.py similarity index 87% rename from esphomeyaml/components/display/waveshare_epaper.py rename to esphome/components/display/waveshare_epaper.py index bfca5bb3f..4c1bc0e0e 100644 --- a/esphomeyaml/components/display/waveshare_epaper.py +++ b/esphome/components/display/waveshare_epaper.py @@ -1,15 +1,15 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml import pins -from esphomeyaml.components import display, spi -from esphomeyaml.components.spi import SPIComponent -from esphomeyaml.const import CONF_BUSY_PIN, CONF_CS_PIN, CONF_DC_PIN, CONF_FULL_UPDATE_EVERY, \ +from esphome import pins +from esphome.components import display, spi +from esphome.components.spi import SPIComponent +import esphome.config_validation as cv +from esphome.const import CONF_BUSY_PIN, CONF_CS_PIN, CONF_DC_PIN, CONF_FULL_UPDATE_EVERY, \ CONF_ID, CONF_LAMBDA, CONF_MODEL, CONF_RESET_PIN, CONF_SPI_ID -from esphomeyaml.cpp_generator import get_variable, Pvariable, process_lambda, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, gpio_input_pin_expression, \ +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda +from esphome.cpp_helpers import gpio_input_pin_expression, gpio_output_pin_expression, \ setup_component -from esphomeyaml.cpp_types import PollingComponent, App, void +from esphome.cpp_types import App, PollingComponent, void DEPENDENCIES = ['spi'] @@ -17,7 +17,6 @@ WaveshareEPaperTypeA = display.display_ns.WaveshareEPaperTypeA WaveshareEPaper = display.display_ns.class_('WaveshareEPaper', PollingComponent, spi.SPIDevice, display.DisplayBuffer) - WaveshareEPaperTypeAModel = display.display_ns.enum('WaveshareEPaperTypeAModel') WaveshareEPaperTypeBModel = display.display_ns.enum('WaveshareEPaperTypeBModel') diff --git a/esphomeyaml/components/esp32_ble_beacon.py b/esphome/components/esp32_ble_beacon.py similarity index 70% rename from esphomeyaml/components/esp32_ble_beacon.py rename to esphome/components/esp32_ble_beacon.py index 6db321168..3996f298d 100644 --- a/esphomeyaml/components/esp32_ble_beacon.py +++ b/esphome/components/esp32_ble_beacon.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_SCAN_INTERVAL, CONF_TYPE, CONF_UUID, ESP_PLATFORM_ESP32 -from esphomeyaml.cpp_generator import Pvariable, RawExpression, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome import config_validation as cv +from esphome.const import CONF_ID, CONF_SCAN_INTERVAL, CONF_TYPE, CONF_UUID, ESP_PLATFORM_ESP32 +from esphome.cpp_generator import Pvariable, RawExpression, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, esphome_ns ESP_PLATFORMS = [ESP_PLATFORM_ESP32] -ESP32BLEBeacon = esphomelib_ns.class_('ESP32BLEBeacon', Component) +ESP32BLEBeacon = esphome_ns.class_('ESP32BLEBeacon', Component) CONF_MAJOR = 'major' CONF_MINOR = 'minor' diff --git a/esphomeyaml/components/esp32_ble_tracker.py b/esphome/components/esp32_ble_tracker.py similarity index 58% rename from esphomeyaml/components/esp32_ble_tracker.py rename to esphome/components/esp32_ble_tracker.py index b75837242..2e1f3c9d5 100644 --- a/esphomeyaml/components/esp32_ble_tracker.py +++ b/esphome/components/esp32_ble_tracker.py @@ -1,19 +1,19 @@ import voluptuous as vol -from esphomeyaml import config_validation as cv -from esphomeyaml.components import sensor -from esphomeyaml.const import CONF_ID, CONF_SCAN_INTERVAL, ESP_PLATFORM_ESP32 -from esphomeyaml.core import HexInt -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome import config_validation as cv +from esphome.components import sensor +from esphome.const import CONF_ID, CONF_SCAN_INTERVAL, ESP_PLATFORM_ESP32 +from esphome.core import HexInt +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, esphome_ns ESP_PLATFORMS = [ESP_PLATFORM_ESP32] CONF_ESP32_BLE_ID = 'esp32_ble_id' -ESP32BLETracker = esphomelib_ns.class_('ESP32BLETracker', Component) -XiaomiSensor = esphomelib_ns.class_('XiaomiSensor', sensor.Sensor) -XiaomiDevice = esphomelib_ns.class_('XiaomiDevice') +ESP32BLETracker = esphome_ns.class_('ESP32BLETracker', Component) +XiaomiSensor = esphome_ns.class_('XiaomiSensor', sensor.Sensor) +XiaomiDevice = esphome_ns.class_('XiaomiDevice') XIAOMI_SENSOR_SCHEMA = sensor.SENSOR_SCHEMA.extend({ cv.GenerateID(): cv.declare_variable_id(XiaomiSensor) }) diff --git a/esphomeyaml/components/esp32_touch.py b/esphome/components/esp32_touch.py similarity index 89% rename from esphomeyaml/components/esp32_touch.py rename to esphome/components/esp32_touch.py index e6eb33e6e..02eedcdc8 100644 --- a/esphomeyaml/components/esp32_touch.py +++ b/esphome/components/esp32_touch.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import config_validation as cv -from esphomeyaml.components import binary_sensor -from esphomeyaml.const import CONF_HIGH_VOLTAGE_REFERENCE, CONF_ID, CONF_IIR_FILTER, \ +from esphome import config_validation as cv +from esphome.components import binary_sensor +from esphome.const import CONF_HIGH_VOLTAGE_REFERENCE, CONF_ID, CONF_IIR_FILTER, \ CONF_LOW_VOLTAGE_REFERENCE, CONF_MEASUREMENT_DURATION, CONF_SETUP_MODE, CONF_SLEEP_DURATION, \ CONF_VOLTAGE_ATTENUATION, ESP_PLATFORM_ESP32 -from esphomeyaml.core import TimePeriod -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component, global_ns +from esphome.core import TimePeriod +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, global_ns ESP_PLATFORMS = [ESP_PLATFORM_ESP32] diff --git a/esphomeyaml/components/ethernet.py b/esphome/components/ethernet.py similarity index 80% rename from esphomeyaml/components/ethernet.py rename to esphome/components/ethernet.py index 1f26327a4..0ce83d358 100644 --- a/esphomeyaml/components/ethernet.py +++ b/esphome/components/ethernet.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import wifi -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DOMAIN, CONF_ID, CONF_MANUAL_IP, CONF_TYPE, ESP_PLATFORM_ESP32, \ - CONF_USE_ADDRESS, CONF_STATIC_IP -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression -from esphomeyaml.cpp_types import App, Component, esphomelib_ns, global_ns +from esphome import pins +from esphome.components import wifi +import esphome.config_validation as cv +from esphome.const import CONF_DOMAIN, CONF_ID, CONF_MANUAL_IP, CONF_STATIC_IP, CONF_TYPE, \ + CONF_USE_ADDRESS, ESP_PLATFORM_ESP32 +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression +from esphome.cpp_types import App, Component, esphome_ns, global_ns CONFLICTS_WITH = ['wifi'] ESP_PLATFORMS = [ESP_PLATFORM_ESP32] @@ -19,7 +19,7 @@ CONF_MDIO_PIN = 'mdio_pin' CONF_CLK_MODE = 'clk_mode' CONF_POWER_PIN = 'power_pin' -EthernetType = esphomelib_ns.enum('EthernetType') +EthernetType = esphome_ns.enum('EthernetType') ETHERNET_TYPES = { 'LAN8720': EthernetType.ETHERNET_TYPE_LAN8720, 'TLK110': EthernetType.ETHERNET_TYPE_TLK110, @@ -33,7 +33,7 @@ CLK_MODES = { 'GPIO17_OUT': eth_clock_mode_t.ETH_CLOCK_GPIO17_OUT, } -EthernetComponent = esphomelib_ns.class_('EthernetComponent', Component) +EthernetComponent = esphome_ns.class_('EthernetComponent', Component) def validate(config): diff --git a/esphomeyaml/components/fan/__init__.py b/esphome/components/fan/__init__.py similarity index 89% rename from esphomeyaml/components/fan/__init__.py rename to esphome/components/fan/__init__.py index c4a2d60e3..35ad3f389 100644 --- a/esphomeyaml/components/fan/__init__.py +++ b/esphome/components/fan/__init__.py @@ -1,22 +1,22 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY, maybe_simple_id -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_INTERNAL, CONF_MQTT_ID, CONF_NAME, CONF_OSCILLATING, \ +from esphome.automation import ACTION_REGISTRY, maybe_simple_id +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INTERNAL, CONF_MQTT_ID, CONF_NAME, CONF_OSCILLATING, \ CONF_OSCILLATION_COMMAND_TOPIC, CONF_OSCILLATION_OUTPUT, CONF_OSCILLATION_STATE_TOPIC, \ CONF_SPEED, CONF_SPEED_COMMAND_TOPIC, CONF_SPEED_STATE_TOPIC -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, templatable -from esphomeyaml.cpp_types import Action, Application, Component, Nameable, bool_, esphomelib_ns -from esphomeyaml.py_compat import string_types +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable, templatable +from esphome.cpp_types import Action, Application, Component, Nameable, bool_, esphome_ns +from esphome.py_compat import string_types PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) -fan_ns = esphomelib_ns.namespace('fan') +fan_ns = esphome_ns.namespace('fan') FanState = fan_ns.class_('FanState', Nameable, Component) MQTTFanComponent = fan_ns.class_('MQTTFanComponent', mqtt.MQTTComponent) MakeFan = Application.struct('MakeFan') diff --git a/esphomeyaml/components/fan/binary.py b/esphome/components/fan/binary.py similarity index 74% rename from esphomeyaml/components/fan/binary.py rename to esphome/components/fan/binary.py index e11b13da6..eb880d5df 100644 --- a/esphomeyaml/components/fan/binary.py +++ b/esphome/components/fan/binary.py @@ -1,11 +1,11 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.components import fan, output -from esphomeyaml.const import CONF_MAKE_ID, CONF_NAME, CONF_OSCILLATION_OUTPUT, CONF_OUTPUT -from esphomeyaml.cpp_generator import get_variable, variable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.components import fan, output +import esphome.config_validation as cv +from esphome.const import CONF_MAKE_ID, CONF_NAME, CONF_OSCILLATION_OUTPUT, CONF_OUTPUT +from esphome.cpp_generator import add, get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(fan.FAN_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(fan.MakeFan), diff --git a/esphomeyaml/components/fan/speed.py b/esphome/components/fan/speed.py similarity index 87% rename from esphomeyaml/components/fan/speed.py rename to esphome/components/fan/speed.py index 98bedca81..62a127448 100644 --- a/esphomeyaml/components/fan/speed.py +++ b/esphome/components/fan/speed.py @@ -1,12 +1,12 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.components import fan, mqtt, output -from esphomeyaml.const import CONF_HIGH, CONF_LOW, CONF_MAKE_ID, CONF_MEDIUM, CONF_NAME, \ +from esphome.components import fan, mqtt, output +import esphome.config_validation as cv +from esphome.const import CONF_HIGH, CONF_LOW, CONF_MAKE_ID, CONF_MEDIUM, CONF_NAME, \ CONF_OSCILLATION_OUTPUT, CONF_OUTPUT, CONF_SPEED, CONF_SPEED_COMMAND_TOPIC, \ CONF_SPEED_STATE_TOPIC -from esphomeyaml.cpp_generator import get_variable, variable, add -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import add, get_variable, variable +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(fan.FAN_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(fan.MakeFan), diff --git a/esphomeyaml/components/font.py b/esphome/components/font.py similarity index 87% rename from esphomeyaml/components/font.py rename to esphome/components/font.py index 91e107616..a6907240f 100644 --- a/esphomeyaml/components/font.py +++ b/esphome/components/font.py @@ -1,14 +1,14 @@ # coding=utf-8 import voluptuous as vol -from esphomeyaml import core -from esphomeyaml.components import display -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_FILE, CONF_GLYPHS, CONF_ID, CONF_SIZE -from esphomeyaml.core import CORE, HexInt -from esphomeyaml.cpp_generator import Pvariable, progmem_array, safe_exp -from esphomeyaml.cpp_types import App, uint8 -from esphomeyaml.py_compat import sort_by_cmp +from esphome import core +from esphome.components import display +import esphome.config_validation as cv +from esphome.const import CONF_FILE, CONF_GLYPHS, CONF_ID, CONF_SIZE +from esphome.core import CORE, HexInt +from esphome.cpp_generator import Pvariable, progmem_array, safe_exp +from esphome.cpp_types import App, uint8 +from esphome.py_compat import sort_by_cmp DEPENDENCIES = ['display'] MULTI_CONF = True @@ -87,7 +87,7 @@ def to_code(config): try: font = ImageFont.truetype(path, config[CONF_SIZE]) except Exception as e: - raise core.EsphomeyamlError(u"Could not load truetype file {}: {}".format(path, e)) + raise core.EsphomeError(u"Could not load truetype file {}: {}".format(path, e)) ascent, descent = font.getmetrics() diff --git a/esphomeyaml/components/globals.py b/esphome/components/globals.py similarity index 68% rename from esphomeyaml/components/globals.py rename to esphome/components/globals.py index 03da1a11e..749c63d92 100644 --- a/esphomeyaml/components/globals.py +++ b/esphome/components/globals.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_INITIAL_VALUE, CONF_RESTORE_VALUE, CONF_TYPE -from esphomeyaml.cpp_generator import Pvariable, RawExpression, TemplateArguments, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome import config_validation as cv +from esphome.const import CONF_ID, CONF_INITIAL_VALUE, CONF_RESTORE_VALUE, CONF_TYPE +from esphome.cpp_generator import Pvariable, RawExpression, TemplateArguments, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, esphome_ns -GlobalVariableComponent = esphomelib_ns.class_('GlobalVariableComponent', Component) +GlobalVariableComponent = esphome_ns.class_('GlobalVariableComponent', Component) MULTI_CONF = True diff --git a/esphomeyaml/components/i2c.py b/esphome/components/i2c.py similarity index 72% rename from esphomeyaml/components/i2c.py rename to esphome/components/i2c.py index b5c216745..d4d0fa0e6 100644 --- a/esphomeyaml/components/i2c.py +++ b/esphome/components/i2c.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_FREQUENCY, CONF_ID, CONF_RECEIVE_TIMEOUT, CONF_SCAN, CONF_SCL, \ +from esphome import pins +import esphome.config_validation as cv +from esphome.const import CONF_FREQUENCY, CONF_ID, CONF_RECEIVE_TIMEOUT, CONF_SCAN, CONF_SCL, \ CONF_SDA -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, esphome_ns -I2CComponent = esphomelib_ns.class_('I2CComponent', Component) +I2CComponent = esphome_ns.class_('I2CComponent', Component) I2CDevice = pins.I2CDevice CONFIG_SCHEMA = vol.Schema({ diff --git a/esphomeyaml/components/image.py b/esphome/components/image.py similarity index 77% rename from esphomeyaml/components/image.py rename to esphome/components/image.py index 206f0dedc..01b469b38 100644 --- a/esphomeyaml/components/image.py +++ b/esphome/components/image.py @@ -3,13 +3,13 @@ import logging import voluptuous as vol -from esphomeyaml import core -from esphomeyaml.components import display, font -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_FILE, CONF_ID, CONF_RESIZE -from esphomeyaml.core import CORE, HexInt -from esphomeyaml.cpp_generator import Pvariable, progmem_array, safe_exp -from esphomeyaml.cpp_types import App, uint8 +from esphome import core +from esphome.components import display, font +import esphome.config_validation as cv +from esphome.const import CONF_FILE, CONF_ID, CONF_RESIZE +from esphome.core import CORE, HexInt +from esphome.cpp_generator import Pvariable, progmem_array, safe_exp +from esphome.cpp_types import App, uint8 _LOGGER = logging.getLogger(__name__) @@ -37,7 +37,7 @@ def to_code(config): try: image = Image.open(path) except Exception as e: - raise core.EsphomeyamlError(u"Could not load image file {}: {}".format(path, e)) + raise core.EsphomeError(u"Could not load image file {}: {}".format(path, e)) if CONF_RESIZE in config: image.thumbnail(config[CONF_RESIZE]) diff --git a/esphomeyaml/components/interval.py b/esphome/components/interval.py similarity index 55% rename from esphomeyaml/components/interval.py rename to esphome/components/interval.py index 8429f6aed..f51fd163a 100644 --- a/esphomeyaml/components/interval.py +++ b/esphome/components/interval.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import automation -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, NoArg, PollingComponent, Trigger, esphomelib_ns +from esphome import automation +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INTERVAL +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, NoArg, PollingComponent, Trigger, esphome_ns -IntervalTrigger = esphomelib_ns.class_('IntervalTrigger', Trigger.template(NoArg), PollingComponent) +IntervalTrigger = esphome_ns.class_('IntervalTrigger', Trigger.template(NoArg), PollingComponent) CONFIG_SCHEMA = automation.validate_automation(vol.Schema({ cv.GenerateID(): cv.declare_variable_id(IntervalTrigger), diff --git a/esphomeyaml/components/light/__init__.py b/esphome/components/light/__init__.py similarity index 97% rename from esphomeyaml/components/light/__init__.py rename to esphome/components/light/__init__.py index a2d976e7d..136c66930 100644 --- a/esphomeyaml/components/light/__init__.py +++ b/esphome/components/light/__init__.py @@ -1,18 +1,18 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY, maybe_simple_id -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ALPHA, CONF_BLUE, CONF_BRIGHTNESS, CONF_COLORS, \ +from esphome.automation import ACTION_REGISTRY, maybe_simple_id +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_ALPHA, CONF_BLUE, CONF_BRIGHTNESS, CONF_COLORS, \ CONF_COLOR_TEMPERATURE, CONF_DEFAULT_TRANSITION_LENGTH, CONF_DURATION, CONF_EFFECT, \ CONF_EFFECTS, CONF_EFFECT_ID, CONF_FLASH_LENGTH, CONF_GAMMA_CORRECT, CONF_GREEN, CONF_ID, \ CONF_INTERNAL, CONF_LAMBDA, CONF_MQTT_ID, CONF_NAME, CONF_NUM_LEDS, CONF_RANDOM, CONF_RED, \ CONF_SPEED, CONF_STATE, CONF_TRANSITION_LENGTH, CONF_UPDATE_INTERVAL, CONF_WHITE, CONF_WIDTH -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, StructInitializer, add, get_variable, \ - process_lambda, templatable -from esphomeyaml.cpp_types import Action, Application, Component, Nameable, esphomelib_ns, float_, \ +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, StructInitializer, add, get_variable, process_lambda, \ + templatable +from esphome.cpp_types import Action, Application, Component, Nameable, esphome_ns, float_, \ std_string, uint32, void PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ @@ -20,7 +20,7 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) # Base -light_ns = esphomelib_ns.namespace('light') +light_ns = esphome_ns.namespace('light') LightState = light_ns.class_('LightState', Nameable, Component) MakeLight = Application.struct('MakeLight') LightOutput = light_ns.class_('LightOutput') diff --git a/esphomeyaml/components/light/binary.py b/esphome/components/light/binary.py similarity index 72% rename from esphomeyaml/components/light/binary.py rename to esphome/components/light/binary.py index d15294312..85b56ab20 100644 --- a/esphomeyaml/components/light/binary.py +++ b/esphome/components/light/binary.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import light, output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_EFFECTS, CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT -from esphomeyaml.cpp_generator import get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.components import light, output +import esphome.config_validation as cv +from esphome.const import CONF_EFFECTS, CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT +from esphome.cpp_generator import get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), diff --git a/esphomeyaml/components/light/cwww.py b/esphome/components/light/cwww.py similarity index 80% rename from esphomeyaml/components/light/cwww.py rename to esphome/components/light/cwww.py index 45abc1b1f..9fb4dd056 100644 --- a/esphomeyaml/components/light/cwww.py +++ b/esphome/components/light/cwww.py @@ -1,15 +1,15 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.components import light, output -from esphomeyaml.components.light.rgbww import validate_cold_white_colder, \ +from esphome.components import light, output +from esphome.components.light.rgbww import validate_cold_white_colder, \ validate_color_temperature -from esphomeyaml.const import CONF_COLD_WHITE, CONF_COLD_WHITE_COLOR_TEMPERATURE, \ +import esphome.config_validation as cv +from esphome.const import CONF_COLD_WHITE, CONF_COLD_WHITE_COLOR_TEMPERATURE, \ CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, CONF_MAKE_ID, \ CONF_NAME, CONF_WARM_WHITE, CONF_WARM_WHITE_COLOR_TEMPERATURE -from esphomeyaml.cpp_generator import get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), diff --git a/esphomeyaml/components/light/fastled_clockless.py b/esphome/components/light/fastled_clockless.py similarity index 86% rename from esphomeyaml/components/light/fastled_clockless.py rename to esphome/components/light/fastled_clockless.py index 57f96fed2..3ce85cd33 100644 --- a/esphomeyaml/components/light/fastled_clockless.py +++ b/esphome/components/light/fastled_clockless.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import light -from esphomeyaml.components.power_supply import PowerSupplyComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CHIPSET, CONF_COLOR_CORRECT, CONF_DEFAULT_TRANSITION_LENGTH, \ +from esphome import pins +from esphome.components import light +from esphome.components.power_supply import PowerSupplyComponent +import esphome.config_validation as cv +from esphome.const import CONF_CHIPSET, CONF_COLOR_CORRECT, CONF_DEFAULT_TRANSITION_LENGTH, \ CONF_EFFECTS, CONF_GAMMA_CORRECT, CONF_MAKE_ID, CONF_MAX_REFRESH_RATE, CONF_NAME, \ CONF_NUM_LEDS, CONF_PIN, CONF_POWER_SUPPLY, CONF_RGB_ORDER -from esphomeyaml.cpp_generator import RawExpression, TemplateArguments, add, get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Application +from esphome.cpp_generator import RawExpression, TemplateArguments, add, get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Application TYPES = [ 'NEOPIXEL', diff --git a/esphomeyaml/components/light/fastled_spi.py b/esphome/components/light/fastled_spi.py similarity index 85% rename from esphomeyaml/components/light/fastled_spi.py rename to esphome/components/light/fastled_spi.py index 4a58b5594..0975357ab 100644 --- a/esphomeyaml/components/light/fastled_spi.py +++ b/esphome/components/light/fastled_spi.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import light -from esphomeyaml.components.power_supply import PowerSupplyComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CHIPSET, CONF_CLOCK_PIN, CONF_COLOR_CORRECT, CONF_DATA_PIN, \ +from esphome import pins +from esphome.components import light +from esphome.components.power_supply import PowerSupplyComponent +import esphome.config_validation as cv +from esphome.const import CONF_CHIPSET, CONF_CLOCK_PIN, CONF_COLOR_CORRECT, CONF_DATA_PIN, \ CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, CONF_MAKE_ID, \ CONF_MAX_REFRESH_RATE, CONF_NAME, CONF_NUM_LEDS, CONF_POWER_SUPPLY, CONF_RGB_ORDER -from esphomeyaml.cpp_generator import RawExpression, TemplateArguments, add, get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Application +from esphome.cpp_generator import RawExpression, TemplateArguments, add, get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Application CHIPSETS = [ 'LPD8806', diff --git a/esphomeyaml/components/light/monochromatic.py b/esphome/components/light/monochromatic.py similarity index 75% rename from esphomeyaml/components/light/monochromatic.py rename to esphome/components/light/monochromatic.py index 49edc32c3..0aecc2231 100644 --- a/esphomeyaml/components/light/monochromatic.py +++ b/esphome/components/light/monochromatic.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import light, output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, \ +from esphome.components import light, output +import esphome.config_validation as cv +from esphome.const import CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, \ CONF_MAKE_ID, CONF_NAME, CONF_OUTPUT -from esphomeyaml.cpp_generator import get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), diff --git a/esphomeyaml/components/light/neopixelbus.py b/esphome/components/light/neopixelbus.py similarity index 91% rename from esphomeyaml/components/light/neopixelbus.py rename to esphome/components/light/neopixelbus.py index cbf92128e..a64411080 100644 --- a/esphomeyaml/components/light/neopixelbus.py +++ b/esphome/components/light/neopixelbus.py @@ -1,17 +1,17 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import light -from esphomeyaml.components.light import AddressableLight -from esphomeyaml.components.power_supply import PowerSupplyComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CLOCK_PIN, CONF_COLOR_CORRECT, CONF_DATA_PIN, \ +from esphome import pins +from esphome.components import light +from esphome.components.light import AddressableLight +from esphome.components.power_supply import PowerSupplyComponent +import esphome.config_validation as cv +from esphome.const import CONF_CLOCK_PIN, CONF_COLOR_CORRECT, CONF_DATA_PIN, \ CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, CONF_MAKE_ID, CONF_METHOD, \ CONF_NAME, CONF_NUM_LEDS, CONF_PIN, CONF_POWER_SUPPLY, CONF_TYPE, CONF_VARIANT -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import TemplateArguments, add, get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Application, Component, global_ns +from esphome.core import CORE +from esphome.cpp_generator import TemplateArguments, add, get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Application, Component, global_ns NeoPixelBusLightOutputBase = light.light_ns.class_('NeoPixelBusLightOutputBase', Component, AddressableLight) diff --git a/esphomeyaml/components/light/rgb.py b/esphome/components/light/rgb.py similarity index 79% rename from esphomeyaml/components/light/rgb.py rename to esphome/components/light/rgb.py index bc513a71d..418f4b83c 100644 --- a/esphomeyaml/components/light/rgb.py +++ b/esphome/components/light/rgb.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import light, output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BLUE, CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, \ +from esphome.components import light, output +import esphome.config_validation as cv +from esphome.const import CONF_BLUE, CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, \ CONF_GAMMA_CORRECT, CONF_GREEN, CONF_MAKE_ID, CONF_NAME, CONF_RED -from esphomeyaml.cpp_generator import get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), diff --git a/esphomeyaml/components/light/rgbw.py b/esphome/components/light/rgbw.py similarity index 81% rename from esphomeyaml/components/light/rgbw.py rename to esphome/components/light/rgbw.py index e165c2e56..22166f2a4 100644 --- a/esphomeyaml/components/light/rgbw.py +++ b/esphome/components/light/rgbw.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import light, output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BLUE, CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, \ +from esphome.components import light, output +import esphome.config_validation as cv +from esphome.const import CONF_BLUE, CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, \ CONF_GAMMA_CORRECT, CONF_GREEN, CONF_MAKE_ID, CONF_NAME, CONF_RED, CONF_WHITE -from esphomeyaml.cpp_generator import get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App PLATFORM_SCHEMA = cv.nameable(light.LIGHT_PLATFORM_SCHEMA.extend({ cv.GenerateID(CONF_MAKE_ID): cv.declare_variable_id(light.MakeLight), diff --git a/esphomeyaml/components/light/rgbww.py b/esphome/components/light/rgbww.py similarity index 89% rename from esphomeyaml/components/light/rgbww.py rename to esphome/components/light/rgbww.py index f69f91a1f..6ed5556b5 100644 --- a/esphomeyaml/components/light/rgbww.py +++ b/esphome/components/light/rgbww.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import light, output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BLUE, CONF_COLD_WHITE, CONF_COLD_WHITE_COLOR_TEMPERATURE, \ +from esphome.components import light, output +import esphome.config_validation as cv +from esphome.const import CONF_BLUE, CONF_COLD_WHITE, CONF_COLD_WHITE_COLOR_TEMPERATURE, \ CONF_DEFAULT_TRANSITION_LENGTH, CONF_EFFECTS, CONF_GAMMA_CORRECT, CONF_GREEN, CONF_MAKE_ID, \ CONF_NAME, CONF_RED, CONF_WARM_WHITE, CONF_WARM_WHITE_COLOR_TEMPERATURE -from esphomeyaml.cpp_generator import get_variable, variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import get_variable, variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App def validate_color_temperature(value): diff --git a/esphomeyaml/components/logger.py b/esphome/components/logger.py similarity index 82% rename from esphomeyaml/components/logger.py rename to esphome/components/logger.py index df212cb67..3115930a0 100644 --- a/esphomeyaml/components/logger.py +++ b/esphome/components/logger.py @@ -2,23 +2,23 @@ import re import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY, LambdaAction -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ARGS, CONF_BAUD_RATE, CONF_FORMAT, CONF_ID, CONF_LEVEL, \ - CONF_LOGS, CONF_TAG, CONF_TX_BUFFER_SIZE, CONF_HARDWARE_UART -from esphomeyaml.core import EsphomeyamlError, Lambda, CORE -from esphomeyaml.cpp_generator import Pvariable, RawExpression, add, process_lambda, statement -from esphomeyaml.cpp_types import App, Component, esphomelib_ns, global_ns, void -from esphomeyaml.py_compat import text_type +from esphome.automation import ACTION_REGISTRY, LambdaAction +import esphome.config_validation as cv +from esphome.const import CONF_ARGS, CONF_BAUD_RATE, CONF_FORMAT, CONF_HARDWARE_UART, CONF_ID, \ + CONF_LEVEL, CONF_LOGS, CONF_TAG, CONF_TX_BUFFER_SIZE +from esphome.core import CORE, EsphomeError, Lambda +from esphome.cpp_generator import Pvariable, RawExpression, add, process_lambda, statement +from esphome.cpp_types import App, Component, esphome_ns, global_ns, void +from esphome.py_compat import text_type LOG_LEVELS = { - 'NONE': global_ns.ESPHOMELIB_LOG_LEVEL_NONE, - 'ERROR': global_ns.ESPHOMELIB_LOG_LEVEL_ERROR, - 'WARN': global_ns.ESPHOMELIB_LOG_LEVEL_WARN, - 'INFO': global_ns.ESPHOMELIB_LOG_LEVEL_INFO, - 'DEBUG': global_ns.ESPHOMELIB_LOG_LEVEL_DEBUG, - 'VERBOSE': global_ns.ESPHOMELIB_LOG_LEVEL_VERBOSE, - 'VERY_VERBOSE': global_ns.ESPHOMELIB_LOG_LEVEL_VERY_VERBOSE, + 'NONE': global_ns.ESPHOME_LOG_LEVEL_NONE, + 'ERROR': global_ns.ESPHOME_LOG_LEVEL_ERROR, + 'WARN': global_ns.ESPHOME_LOG_LEVEL_WARN, + 'INFO': global_ns.ESPHOME_LOG_LEVEL_INFO, + 'DEBUG': global_ns.ESPHOME_LOG_LEVEL_DEBUG, + 'VERBOSE': global_ns.ESPHOME_LOG_LEVEL_VERBOSE, + 'VERY_VERBOSE': global_ns.ESPHOME_LOG_LEVEL_VERY_VERBOSE, } LOG_LEVEL_TO_ESP_LOG = { @@ -66,12 +66,12 @@ def validate_local_no_higher_than_global(value): global_level = value.get(CONF_LEVEL, 'DEBUG') for tag, level in value.get(CONF_LOGS, {}).items(): if LOG_LEVEL_SEVERITY.index(level) > LOG_LEVEL_SEVERITY.index(global_level): - raise EsphomeyamlError(u"The local log level {} for {} must be less severe than the " - u"global log level {}.".format(level, tag, global_level)) + raise EsphomeError(u"The local log level {} for {} must be less severe than the " + u"global log level {}.".format(level, tag, global_level)) return value -LogComponent = esphomelib_ns.class_('LogComponent', Component) +LogComponent = esphome_ns.class_('LogComponent', Component) CONFIG_SCHEMA = vol.All(vol.Schema({ cv.GenerateID(): cv.declare_variable_id(LogComponent), @@ -99,7 +99,7 @@ def to_code(config): def required_build_flags(config): flags = [] if CONF_LEVEL in config: - flags.append(u'-DESPHOMELIB_LOG_LEVEL={}'.format(str(LOG_LEVELS[config[CONF_LEVEL]]))) + flags.append(u'-DESPHOME_LOG_LEVEL={}'.format(str(LOG_LEVELS[config[CONF_LEVEL]]))) this_severity = LOG_LEVEL_SEVERITY.index(config[CONF_LEVEL]) verbose_severity = LOG_LEVEL_SEVERITY.index('VERBOSE') is_at_least_verbose = this_severity >= verbose_severity diff --git a/esphomeyaml/components/mqtt.py b/esphome/components/mqtt.py similarity index 93% rename from esphomeyaml/components/mqtt.py rename to esphome/components/mqtt.py index 43f200023..1956109c5 100644 --- a/esphomeyaml/components/mqtt.py +++ b/esphome/components/mqtt.py @@ -3,22 +3,22 @@ import re import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.automation import ACTION_REGISTRY -from esphomeyaml.components import logger -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_AVAILABILITY, CONF_BIRTH_MESSAGE, CONF_BROKER, CONF_CLIENT_ID, \ +from esphome import automation +from esphome.automation import ACTION_REGISTRY +from esphome.components import logger +import esphome.config_validation as cv +from esphome.const import CONF_AVAILABILITY, CONF_BIRTH_MESSAGE, CONF_BROKER, CONF_CLIENT_ID, \ CONF_COMMAND_TOPIC, CONF_DISCOVERY, CONF_DISCOVERY_PREFIX, CONF_DISCOVERY_RETAIN, \ - CONF_ESPHOMEYAML, CONF_ID, CONF_INTERNAL, CONF_KEEPALIVE, CONF_LEVEL, CONF_LOG_TOPIC, \ + CONF_ESPHOME, CONF_ID, CONF_INTERNAL, CONF_KEEPALIVE, CONF_LEVEL, CONF_LOG_TOPIC, \ CONF_MQTT, CONF_NAME, CONF_ON_JSON_MESSAGE, CONF_ON_MESSAGE, CONF_PASSWORD, CONF_PAYLOAD, \ CONF_PAYLOAD_AVAILABLE, CONF_PAYLOAD_NOT_AVAILABLE, CONF_PORT, CONF_QOS, CONF_REBOOT_TIMEOUT, \ CONF_RETAIN, CONF_SHUTDOWN_MESSAGE, CONF_SSL_FINGERPRINTS, CONF_STATE_TOPIC, CONF_TOPIC, \ CONF_TOPIC_PREFIX, CONF_TRIGGER_ID, CONF_USERNAME, CONF_WILL_MESSAGE -from esphomeyaml.core import EsphomeyamlError -from esphomeyaml.cpp_generator import Pvariable, RawExpression, StructInitializer, \ - TemplateArguments, add, process_lambda, templatable, get_variable -from esphomeyaml.cpp_types import Action, App, Component, JsonObjectConstRef, JsonObjectRef, \ - Trigger, bool_, esphomelib_ns, optional, std_string, uint8, void +from esphome.core import EsphomeError +from esphome.cpp_generator import Pvariable, RawExpression, StructInitializer, TemplateArguments, \ + add, get_variable, process_lambda, templatable +from esphome.cpp_types import Action, App, Component, JsonObjectConstRef, JsonObjectRef, \ + Trigger, bool_, esphome_ns, optional, std_string, uint8, void def validate_message_just_topic(value): @@ -38,7 +38,7 @@ MQTT_MESSAGE_SCHEMA = vol.Any(None, MQTT_MESSAGE_BASE.extend({ vol.Required(CONF_PAYLOAD): cv.mqtt_payload, })) -mqtt_ns = esphomelib_ns.namespace('mqtt') +mqtt_ns = esphome_ns.namespace('mqtt') MQTTMessage = mqtt_ns.struct('MQTTMessage') MQTTClientComponent = mqtt_ns.class_('MQTTClientComponent', Component) MQTTPublishAction = mqtt_ns.class_('MQTTPublishAction', Action) @@ -299,10 +299,10 @@ def build_hass_config(data, component_type, config, include_state=True, include_ class GenerateHassConfigData(object): def __init__(self, config): if 'mqtt' not in config: - raise EsphomeyamlError("Cannot generate Home Assistant MQTT config if MQTT is not " - "used!") + raise EsphomeError("Cannot generate Home Assistant MQTT config if MQTT is not " + "used!") mqtt = config[CONF_MQTT] - self.topic_prefix = mqtt.get(CONF_TOPIC_PREFIX, config[CONF_ESPHOMEYAML][CONF_NAME]) + self.topic_prefix = mqtt.get(CONF_TOPIC_PREFIX, config[CONF_ESPHOME][CONF_NAME]) birth_message = mqtt.get(CONF_BIRTH_MESSAGE) if CONF_BIRTH_MESSAGE not in mqtt: birth_message = { diff --git a/esphomeyaml/components/my9231.py b/esphome/components/my9231.py similarity index 76% rename from esphomeyaml/components/my9231.py rename to esphome/components/my9231.py index 602d1f52a..096a78287 100644 --- a/esphomeyaml/components/my9231.py +++ b/esphome/components/my9231.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import (CONF_BIT_DEPTH, CONF_CLOCK_PIN, CONF_DATA_PIN, CONF_ID, - CONF_NUM_CHANNELS, CONF_NUM_CHIPS, CONF_UPDATE_ON_BOOT) -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome import pins +from esphome.components import output +import esphome.config_validation as cv +from esphome.const import (CONF_BIT_DEPTH, CONF_CLOCK_PIN, CONF_DATA_PIN, CONF_ID, + CONF_NUM_CHANNELS, CONF_NUM_CHIPS, CONF_UPDATE_ON_BOOT) +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component MY9231OutputComponent = output.output_ns.class_('MY9231OutputComponent', Component) MULTI_CONF = True diff --git a/esphomeyaml/components/ota.py b/esphome/components/ota.py similarity index 77% rename from esphomeyaml/components/ota.py rename to esphome/components/ota.py index deac3d28d..61cb870c4 100644 --- a/esphomeyaml/components/ota.py +++ b/esphome/components/ota.py @@ -2,15 +2,15 @@ import logging import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_OTA, CONF_PASSWORD, CONF_PORT, CONF_SAFE_MODE -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_OTA, CONF_PASSWORD, CONF_PORT, CONF_SAFE_MODE +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_types import App, Component, esphome_ns _LOGGER = logging.getLogger(__name__) -OTAComponent = esphomelib_ns.class_('OTAComponent', Component) +OTAComponent = esphome_ns.class_('OTAComponent', Component) CONFIG_SCHEMA = vol.Schema({ cv.GenerateID(): cv.declare_variable_id(OTAComponent), diff --git a/esphomeyaml/components/output/__init__.py b/esphome/components/output/__init__.py similarity index 87% rename from esphomeyaml/components/output/__init__.py rename to esphome/components/output/__init__.py index b5a575c6f..fde09ab32 100644 --- a/esphomeyaml/components/output/__init__.py +++ b/esphome/components/output/__init__.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.automation import maybe_simple_id, ACTION_REGISTRY -import esphomeyaml.config_validation as cv -from esphomeyaml.components.power_supply import PowerSupplyComponent -from esphomeyaml.const import CONF_INVERTED, CONF_MAX_POWER, CONF_POWER_SUPPLY, CONF_ID, CONF_LEVEL -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import add, get_variable, Pvariable, templatable -from esphomeyaml.cpp_types import esphomelib_ns, Action, float_ +from esphome.automation import ACTION_REGISTRY, maybe_simple_id +from esphome.components.power_supply import PowerSupplyComponent +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INVERTED, CONF_LEVEL, CONF_MAX_POWER, CONF_POWER_SUPPLY +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable, templatable +from esphome.cpp_types import Action, esphome_ns, float_ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ @@ -25,7 +25,7 @@ FLOAT_OUTPUT_SCHEMA = BINARY_OUTPUT_SCHEMA.extend({ FLOAT_OUTPUT_PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend(FLOAT_OUTPUT_SCHEMA.schema) -output_ns = esphomelib_ns.namespace('output') +output_ns = esphome_ns.namespace('output') BinaryOutput = output_ns.class_('BinaryOutput') BinaryOutputPtr = BinaryOutput.operator('ptr') FloatOutput = output_ns.class_('FloatOutput', BinaryOutput) @@ -60,7 +60,6 @@ def register_output(var, config): BUILD_FLAGS = '-DUSE_OUTPUT' - CONF_OUTPUT_TURN_ON = 'output.turn_on' OUTPUT_TURN_ON_ACTION = maybe_simple_id({ vol.Required(CONF_ID): cv.use_variable_id(BinaryOutput), diff --git a/esphomeyaml/components/output/custom.py b/esphome/components/output/custom.py similarity index 88% rename from esphomeyaml/components/output/custom.py rename to esphome/components/output/custom.py index 53c4f5293..4abb0873f 100644 --- a/esphomeyaml/components/output/custom.py +++ b/esphome/components/output/custom.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_OUTPUTS, CONF_TYPE -from esphomeyaml.cpp_generator import process_lambda, variable -from esphomeyaml.cpp_types import std_vector +from esphome.components import output +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_OUTPUTS, CONF_TYPE +from esphome.cpp_generator import process_lambda, variable +from esphome.cpp_types import std_vector CustomBinaryOutputConstructor = output.output_ns.class_('CustomBinaryOutputConstructor') CustomFloatOutputConstructor = output.output_ns.class_('CustomFloatOutputConstructor') diff --git a/esphomeyaml/components/output/esp8266_pwm.py b/esphome/components/output/esp8266_pwm.py similarity index 72% rename from esphomeyaml/components/output/esp8266_pwm.py rename to esphome/components/output/esp8266_pwm.py index 3f8539e6d..b8496206b 100644 --- a/esphomeyaml/components/output/esp8266_pwm.py +++ b/esphome/components/output/esp8266_pwm.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_FREQUENCY, CONF_ID, CONF_NUMBER, CONF_PIN, ESP_PLATFORM_ESP8266 -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome import pins +from esphome.components import output +import esphome.config_validation as cv +from esphome.const import CONF_FREQUENCY, CONF_ID, CONF_NUMBER, CONF_PIN, ESP_PLATFORM_ESP8266 +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component ESP_PLATFORMS = [ESP_PLATFORM_ESP8266] diff --git a/esphomeyaml/components/output/gpio.py b/esphome/components/output/gpio.py similarity index 68% rename from esphomeyaml/components/output/gpio.py rename to esphome/components/output/gpio.py index fb4949c1e..82cd30ce4 100644 --- a/esphomeyaml/components/output/gpio.py +++ b/esphome/components/output/gpio.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_PIN -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome import pins +from esphome.components import output +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_PIN +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component GPIOBinaryOutputComponent = output.output_ns.class_('GPIOBinaryOutputComponent', output.BinaryOutput, Component) diff --git a/esphomeyaml/components/output/ledc.py b/esphome/components/output/ledc.py similarity index 80% rename from esphomeyaml/components/output/ledc.py rename to esphome/components/output/ledc.py index bd42ba356..70d500efb 100644 --- a/esphomeyaml/components/output/ledc.py +++ b/esphome/components/output/ledc.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import APB_CLOCK_FREQ, CONF_BIT_DEPTH, CONF_CHANNEL, CONF_FREQUENCY, \ +from esphome import pins +from esphome.components import output +import esphome.config_validation as cv +from esphome.const import APB_CLOCK_FREQ, CONF_BIT_DEPTH, CONF_CHANNEL, CONF_FREQUENCY, \ CONF_ID, CONF_PIN, ESP_PLATFORM_ESP32 -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component ESP_PLATFORMS = [ESP_PLATFORM_ESP32] diff --git a/esphomeyaml/components/output/my9231.py b/esphome/components/output/my9231.py similarity index 74% rename from esphomeyaml/components/output/my9231.py rename to esphome/components/output/my9231.py index ee9f7f494..0cbb5be88 100644 --- a/esphomeyaml/components/output/my9231.py +++ b/esphome/components/output/my9231.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import output -from esphomeyaml.components.my9231 import MY9231OutputComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CHANNEL, CONF_ID, CONF_MY9231_ID, CONF_POWER_SUPPLY -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component +from esphome.components import output +from esphome.components.my9231 import MY9231OutputComponent +import esphome.config_validation as cv +from esphome.const import CONF_CHANNEL, CONF_ID, CONF_MY9231_ID, CONF_POWER_SUPPLY +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component DEPENDENCIES = ['my9231'] diff --git a/esphomeyaml/components/output/pca9685.py b/esphome/components/output/pca9685.py similarity index 75% rename from esphomeyaml/components/output/pca9685.py rename to esphome/components/output/pca9685.py index b43c0f767..bb51a2490 100644 --- a/esphomeyaml/components/output/pca9685.py +++ b/esphome/components/output/pca9685.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import output -from esphomeyaml.components.pca9685 import PCA9685OutputComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CHANNEL, CONF_ID, CONF_PCA9685_ID, CONF_POWER_SUPPLY -from esphomeyaml.cpp_generator import Pvariable, get_variable +from esphome.components import output +from esphome.components.pca9685 import PCA9685OutputComponent +import esphome.config_validation as cv +from esphome.const import CONF_CHANNEL, CONF_ID, CONF_PCA9685_ID, CONF_POWER_SUPPLY +from esphome.cpp_generator import Pvariable, get_variable DEPENDENCIES = ['pca9685'] diff --git a/esphomeyaml/components/pca9685.py b/esphome/components/pca9685.py similarity index 72% rename from esphomeyaml/components/pca9685.py rename to esphome/components/pca9685.py index e30758b31..0906db90d 100644 --- a/esphomeyaml/components/pca9685.py +++ b/esphome/components/pca9685.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import i2c, output -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_FREQUENCY, CONF_ID -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import i2c, output +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_FREQUENCY, CONF_ID +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['i2c'] MULTI_CONF = True diff --git a/esphomeyaml/components/pcf8574.py b/esphome/components/pcf8574.py similarity index 74% rename from esphomeyaml/components/pcf8574.py rename to esphome/components/pcf8574.py index ef6841355..a5ab90a44 100644 --- a/esphomeyaml/components/pcf8574.py +++ b/esphome/components/pcf8574.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml import pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_PCF8575 -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, GPIOInputPin, GPIOOutputPin, io_ns +from esphome import pins +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_PCF8575 +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, GPIOInputPin, GPIOOutputPin, io_ns DEPENDENCIES = ['i2c'] MULTI_CONF = True diff --git a/esphomeyaml/components/pn532.py b/esphome/components/pn532.py similarity index 72% rename from esphomeyaml/components/pn532.py rename to esphome/components/pn532.py index 9d2afbf0e..ea188d3ae 100644 --- a/esphomeyaml/components/pn532.py +++ b/esphome/components/pn532.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import automation, pins -from esphomeyaml.components import binary_sensor, spi -from esphomeyaml.components.spi import SPIComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CS_PIN, CONF_ID, CONF_ON_TAG, CONF_SPI_ID, CONF_TRIGGER_ID, \ +from esphome import automation, pins +from esphome.components import binary_sensor, spi +from esphome.components.spi import SPIComponent +import esphome.config_validation as cv +from esphome.const import CONF_CS_PIN, CONF_ID, CONF_ON_TAG, CONF_SPI_ID, CONF_TRIGGER_ID, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, PollingComponent, Trigger, std_string +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, PollingComponent, Trigger, std_string DEPENDENCIES = ['spi'] MULTI_CONF = True diff --git a/esphomeyaml/components/power_supply.py b/esphome/components/power_supply.py similarity index 65% rename from esphomeyaml/components/power_supply.py rename to esphome/components/power_supply.py index de02c708e..bb8501eb0 100644 --- a/esphomeyaml/components/power_supply.py +++ b/esphome/components/power_supply.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ENABLE_TIME, CONF_ID, CONF_KEEP_ON_TIME, CONF_PIN -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome import pins +import esphome.config_validation as cv +from esphome.const import CONF_ENABLE_TIME, CONF_ID, CONF_KEEP_ON_TIME, CONF_PIN +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component, esphome_ns -PowerSupplyComponent = esphomelib_ns.class_('PowerSupplyComponent', Component) +PowerSupplyComponent = esphome_ns.class_('PowerSupplyComponent', Component) MULTI_CONF = True diff --git a/esphomeyaml/components/rdm6300.py b/esphome/components/rdm6300.py similarity index 67% rename from esphomeyaml/components/rdm6300.py rename to esphome/components/rdm6300.py index 7f38895e9..5c89d83fb 100644 --- a/esphomeyaml/components/rdm6300.py +++ b/esphome/components/rdm6300.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import binary_sensor, uart -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_UART_ID -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import binary_sensor, uart +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_UART_ID +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['uart'] diff --git a/esphomeyaml/components/remote_receiver.py b/esphome/components/remote_receiver.py similarity index 84% rename from esphomeyaml/components/remote_receiver.py rename to esphome/components/remote_receiver.py index 40dfd86c7..c571b1ced 100644 --- a/esphomeyaml/components/remote_receiver.py +++ b/esphome/components/remote_receiver.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml import pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BUFFER_SIZE, CONF_DUMP, CONF_FILTER, CONF_ID, CONF_IDLE, \ +from esphome import pins +import esphome.config_validation as cv +from esphome.const import CONF_BUFFER_SIZE, CONF_DUMP, CONF_FILTER, CONF_ID, CONF_IDLE, \ CONF_PIN, CONF_TOLERANCE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns -from esphomeyaml.py_compat import string_types +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import App, Component, esphome_ns +from esphome.py_compat import string_types -remote_ns = esphomelib_ns.namespace('remote') +remote_ns = esphome_ns.namespace('remote') MULTI_CONF = True RemoteControlComponentBase = remote_ns.class_('RemoteControlComponentBase') diff --git a/esphomeyaml/components/remote_transmitter.py b/esphome/components/remote_transmitter.py similarity index 89% rename from esphomeyaml/components/remote_transmitter.py rename to esphome/components/remote_transmitter.py index f0ae3636f..d0e82826e 100644 --- a/esphomeyaml/components/remote_transmitter.py +++ b/esphome/components/remote_transmitter.py @@ -1,16 +1,16 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components.remote_receiver import RemoteControlComponentBase, remote_ns -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_CARRIER_DUTY_PERCENT, CONF_CHANNEL, CONF_CODE, \ +from esphome import pins +from esphome.components.remote_receiver import RemoteControlComponentBase, remote_ns +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_CARRIER_DUTY_PERCENT, CONF_CHANNEL, CONF_CODE, \ CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_ID, CONF_INVERTED, CONF_ONE, CONF_PIN, \ CONF_PROTOCOL, CONF_PULSE_LENGTH, CONF_STATE, CONF_SYNC, CONF_ZERO -from esphomeyaml.core import HexInt -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component -from esphomeyaml.py_compat import text_type +from esphome.core import HexInt +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component +from esphome.py_compat import text_type RemoteTransmitterComponent = remote_ns.class_('RemoteTransmitterComponent', RemoteControlComponentBase, Component) diff --git a/esphomeyaml/components/script.py b/esphome/components/script.py similarity index 71% rename from esphomeyaml/components/script.py rename to esphome/components/script.py index 834179b12..b2641b2d6 100644 --- a/esphomeyaml/components/script.py +++ b/esphome/components/script.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.automation import ACTION_REGISTRY, maybe_simple_id -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_types import Action, NoArg, Trigger, esphomelib_ns +from esphome import automation +from esphome.automation import ACTION_REGISTRY, maybe_simple_id +import esphome.config_validation as cv +from esphome.const import CONF_ID +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_types import Action, NoArg, Trigger, esphome_ns -Script = esphomelib_ns.class_('Script', Trigger.template(NoArg)) -ScriptExecuteAction = esphomelib_ns.class_('ScriptExecuteAction', Action) -ScriptStopAction = esphomelib_ns.class_('ScriptStopAction', Action) +Script = esphome_ns.class_('Script', Trigger.template(NoArg)) +ScriptExecuteAction = esphome_ns.class_('ScriptExecuteAction', Action) +ScriptStopAction = esphome_ns.class_('ScriptStopAction', Action) CONFIG_SCHEMA = automation.validate_automation({ vol.Required(CONF_ID): cv.declare_variable_id(Script), diff --git a/esphomeyaml/components/sensor/__init__.py b/esphome/components/sensor/__init__.py similarity index 94% rename from esphomeyaml/components/sensor/__init__.py rename to esphome/components/sensor/__init__.py index 3cfb795d1..0ade5e1de 100644 --- a/esphomeyaml/components/sensor/__init__.py +++ b/esphome/components/sensor/__init__.py @@ -1,21 +1,21 @@ import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.automation import CONDITION_REGISTRY -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ABOVE, CONF_ACCURACY_DECIMALS, CONF_ALPHA, CONF_BELOW, \ +from esphome import automation +from esphome.automation import CONDITION_REGISTRY +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_ABOVE, CONF_ACCURACY_DECIMALS, CONF_ALPHA, CONF_BELOW, \ CONF_DEBOUNCE, CONF_DELTA, CONF_EXPIRE_AFTER, CONF_EXPONENTIAL_MOVING_AVERAGE, CONF_FILTERS, \ CONF_FILTER_NAN, CONF_FILTER_OUT, CONF_HEARTBEAT, CONF_ICON, CONF_ID, CONF_INTERNAL, \ CONF_LAMBDA, CONF_MQTT_ID, CONF_MULTIPLY, CONF_OFFSET, CONF_ON_RAW_VALUE, CONF_ON_VALUE, \ CONF_ON_VALUE_RANGE, CONF_OR, CONF_SEND_EVERY, CONF_SEND_FIRST_AT, \ CONF_SLIDING_WINDOW_MOVING_AVERAGE, CONF_THROTTLE, CONF_TRIGGER_ID, CONF_UNIQUE, \ CONF_UNIT_OF_MEASUREMENT, CONF_WINDOW_SIZE -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable -from esphomeyaml.cpp_types import App, Component, Nameable, PollingComponent, Trigger, \ - esphomelib_ns, float_, optional +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable +from esphome.cpp_types import App, Component, Nameable, PollingComponent, Trigger, \ + esphome_ns, float_, optional PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ @@ -63,7 +63,7 @@ FILTERS_SCHEMA = cv.ensure_list({ }, cv.has_exactly_one_key(*FILTER_KEYS)) # Base -sensor_ns = esphomelib_ns.namespace('sensor') +sensor_ns = esphome_ns.namespace('sensor') Sensor = sensor_ns.class_('Sensor', Nameable) SensorPtr = Sensor.operator('ptr') MQTTSensorComponent = sensor_ns.class_('MQTTSensorComponent', mqtt.MQTTComponent) diff --git a/esphomeyaml/components/sensor/adc.py b/esphome/components/sensor/adc.py similarity index 82% rename from esphomeyaml/components/sensor/adc.py rename to esphome/components/sensor/adc.py index f330ce395..aacc54421 100644 --- a/esphomeyaml/components/sensor/adc.py +++ b/esphome/components/sensor/adc.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ATTENUATION, CONF_ID, CONF_NAME, CONF_PIN, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, global_ns +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ATTENUATION, CONF_ID, CONF_NAME, CONF_PIN, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, global_ns ATTENUATION_MODES = { '0db': global_ns.ADC_0db, diff --git a/esphomeyaml/components/sensor/ads1115.py b/esphome/components/sensor/ads1115.py similarity index 86% rename from esphomeyaml/components/sensor/ads1115.py rename to esphome/components/sensor/ads1115.py index a5ae2eadb..8d03fcc55 100644 --- a/esphomeyaml/components/sensor/ads1115.py +++ b/esphome/components/sensor/ads1115.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import sensor -from esphomeyaml.components.ads1115 import ADS1115Component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADS1115_ID, CONF_GAIN, CONF_MULTIPLEXER, CONF_NAME, \ +from esphome.components import sensor +from esphome.components.ads1115 import ADS1115Component +import esphome.config_validation as cv +from esphome.const import CONF_ADS1115_ID, CONF_GAIN, CONF_MULTIPLEXER, CONF_NAME, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import get_variable -from esphomeyaml.py_compat import string_types +from esphome.cpp_generator import get_variable +from esphome.py_compat import string_types DEPENDENCIES = ['ads1115'] diff --git a/esphomeyaml/components/sensor/apds9960.py b/esphome/components/sensor/apds9960.py similarity index 75% rename from esphomeyaml/components/sensor/apds9960.py rename to esphome/components/sensor/apds9960.py index ddd9fd7d5..225ab8ed0 100644 --- a/esphomeyaml/components/sensor/apds9960.py +++ b/esphome/components/sensor/apds9960.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import sensor -from esphomeyaml.components.apds9960 import APDS9960, CONF_APDS9960_ID -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_NAME, CONF_TYPE -from esphomeyaml.cpp_generator import get_variable +from esphome.components import sensor +from esphome.components.apds9960 import APDS9960, CONF_APDS9960_ID +import esphome.config_validation as cv +from esphome.const import CONF_NAME, CONF_TYPE +from esphome.cpp_generator import get_variable DEPENDENCIES = ['apds9960'] diff --git a/esphomeyaml/components/sensor/bh1750.py b/esphome/components/sensor/bh1750.py similarity index 81% rename from esphomeyaml/components/sensor/bh1750.py rename to esphome/components/sensor/bh1750.py index 9b003eeb5..5a416a5d0 100644 --- a/esphomeyaml/components/sensor/bh1750.py +++ b/esphome/components/sensor/bh1750.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_RESOLUTION, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_RESOLUTION, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/ble_rssi.py b/esphome/components/sensor/ble_rssi.py similarity index 61% rename from esphomeyaml/components/sensor/ble_rssi.py rename to esphome/components/sensor/ble_rssi.py index f8856c5e8..ccdc157b0 100644 --- a/esphomeyaml/components/sensor/ble_rssi.py +++ b/esphome/components/sensor/ble_rssi.py @@ -1,16 +1,16 @@ import voluptuous as vol -from esphomeyaml.components import sensor -from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ +from esphome.components import sensor +from esphome.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ make_address_array -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_MAC_ADDRESS, CONF_NAME -from esphomeyaml.cpp_generator import get_variable -from esphomeyaml.cpp_types import esphomelib_ns +import esphome.config_validation as cv +from esphome.const import CONF_MAC_ADDRESS, CONF_NAME +from esphome.cpp_generator import get_variable +from esphome.cpp_types import esphome_ns DEPENDENCIES = ['esp32_ble_tracker'] -ESP32BLERSSISensor = esphomelib_ns.class_('ESP32BLERSSISensor', sensor.Sensor) +ESP32BLERSSISensor = esphome_ns.class_('ESP32BLERSSISensor', sensor.Sensor) PLATFORM_SCHEMA = cv.nameable(sensor.SENSOR_PLATFORM_SCHEMA.extend({ cv.GenerateID(): cv.declare_variable_id(ESP32BLERSSISensor), diff --git a/esphomeyaml/components/sensor/bme280.py b/esphome/components/sensor/bme280.py similarity index 92% rename from esphomeyaml/components/sensor/bme280.py rename to esphome/components/sensor/bme280.py index 085238ad5..d4b8a5e10 100644 --- a/esphomeyaml/components/sensor/bme280.py +++ b/esphome/components/sensor/bme280.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_HUMIDITY, CONF_ID, CONF_IIR_FILTER, CONF_NAME, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_HUMIDITY, CONF_ID, CONF_IIR_FILTER, CONF_NAME, \ CONF_OVERSAMPLING, CONF_PRESSURE, CONF_TEMPERATURE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/bme680.py b/esphome/components/sensor/bme680.py similarity index 93% rename from esphomeyaml/components/sensor/bme680.py rename to esphome/components/sensor/bme680.py index 31bd4cfce..bc32f8d13 100644 --- a/esphomeyaml/components/sensor/bme680.py +++ b/esphome/components/sensor/bme680.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import core -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_DURATION, CONF_GAS_RESISTANCE, CONF_HEATER, \ +from esphome import core +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_DURATION, CONF_GAS_RESISTANCE, CONF_HEATER, \ CONF_HUMIDITY, CONF_ID, CONF_IIR_FILTER, CONF_NAME, CONF_OVERSAMPLING, CONF_PRESSURE, \ CONF_TEMPERATURE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/bmp085.py b/esphome/components/sensor/bmp085.py similarity index 83% rename from esphomeyaml/components/sensor/bmp085.py rename to esphome/components/sensor/bmp085.py index 1995efa44..9886ce176 100644 --- a/esphomeyaml/components/sensor/bmp085.py +++ b/esphome/components/sensor/bmp085.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_PRESSURE, CONF_TEMPERATURE, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_PRESSURE, CONF_TEMPERATURE, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import HexIntLiteral, Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import HexIntLiteral, Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/bmp280.py b/esphome/components/sensor/bmp280.py similarity index 91% rename from esphomeyaml/components/sensor/bmp280.py rename to esphome/components/sensor/bmp280.py index 47975cc74..74deeb950 100644 --- a/esphomeyaml/components/sensor/bmp280.py +++ b/esphome/components/sensor/bmp280.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_IIR_FILTER, CONF_NAME, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_IIR_FILTER, CONF_NAME, \ CONF_OVERSAMPLING, CONF_PRESSURE, CONF_TEMPERATURE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/cse7766.py b/esphome/components/sensor/cse7766.py similarity index 85% rename from esphomeyaml/components/sensor/cse7766.py rename to esphome/components/sensor/cse7766.py index c436ac31c..d2d38b8c7 100644 --- a/esphomeyaml/components/sensor/cse7766.py +++ b/esphome/components/sensor/cse7766.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import sensor, uart -from esphomeyaml.components.uart import UARTComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CURRENT, CONF_ID, CONF_NAME, CONF_POWER, CONF_UART_ID, \ +from esphome.components import sensor, uart +from esphome.components.uart import UARTComponent +import esphome.config_validation as cv +from esphome.const import CONF_CURRENT, CONF_ID, CONF_NAME, CONF_POWER, CONF_UART_ID, \ CONF_UPDATE_INTERVAL, CONF_VOLTAGE -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['uart'] diff --git a/esphomeyaml/components/sensor/custom.py b/esphome/components/sensor/custom.py similarity index 78% rename from esphomeyaml/components/sensor/custom.py rename to esphome/components/sensor/custom.py index d54166415..314dbe51e 100644 --- a/esphomeyaml/components/sensor/custom.py +++ b/esphome/components/sensor/custom.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_SENSORS, CONF_NAME -from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable, add -from esphomeyaml.cpp_types import std_vector +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_SENSORS +from esphome.cpp_generator import Pvariable, add, process_lambda, variable +from esphome.cpp_types import std_vector CustomSensorConstructor = sensor.sensor_ns.class_('CustomSensorConstructor') diff --git a/esphomeyaml/components/sensor/dallas.py b/esphome/components/sensor/dallas.py similarity index 81% rename from esphomeyaml/components/sensor/dallas.py rename to esphome/components/sensor/dallas.py index c26917fce..aaf860334 100644 --- a/esphomeyaml/components/sensor/dallas.py +++ b/esphome/components/sensor/dallas.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import sensor -from esphomeyaml.components.dallas import DallasComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_DALLAS_ID, CONF_INDEX, CONF_NAME, \ +from esphome.components import sensor +from esphome.components.dallas import DallasComponent +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_DALLAS_ID, CONF_INDEX, CONF_NAME, \ CONF_RESOLUTION -from esphomeyaml.cpp_generator import HexIntLiteral, get_variable +from esphome.cpp_generator import HexIntLiteral, get_variable DallasTemperatureSensor = sensor.sensor_ns.class_('DallasTemperatureSensor', sensor.EmptyPollingParentSensor) diff --git a/esphomeyaml/components/sensor/dht.py b/esphome/components/sensor/dht.py similarity index 84% rename from esphomeyaml/components/sensor/dht.py rename to esphome/components/sensor/dht.py index 7e481c4c8..8cc680d7c 100644 --- a/esphomeyaml/components/sensor/dht.py +++ b/esphome/components/sensor/dht.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_HUMIDITY, CONF_ID, CONF_MODEL, CONF_NAME, \ +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_HUMIDITY, CONF_ID, CONF_MODEL, CONF_NAME, \ CONF_PIN, CONF_TEMPERATURE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, PollingComponent -from esphomeyaml.pins import gpio_input_pullup_pin_schema +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, PollingComponent +from esphome.pins import gpio_input_pullup_pin_schema DHTModel = sensor.sensor_ns.enum('DHTModel') DHT_MODELS = { diff --git a/esphomeyaml/components/sensor/dht12.py b/esphome/components/sensor/dht12.py similarity index 83% rename from esphomeyaml/components/sensor/dht12.py rename to esphome/components/sensor/dht12.py index a49677d26..c457eec80 100644 --- a/esphomeyaml/components/sensor/dht12.py +++ b/esphome/components/sensor/dht12.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/duty_cycle.py b/esphome/components/sensor/duty_cycle.py similarity index 71% rename from esphomeyaml/components/sensor/duty_cycle.py rename to esphome/components/sensor/duty_cycle.py index 422d9d6d0..a083015a3 100644 --- a/esphomeyaml/components/sensor/duty_cycle.py +++ b/esphome/components/sensor/duty_cycle.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_PIN, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import App +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_PIN, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import App DutyCycleSensor = sensor.sensor_ns.class_('DutyCycleSensor', sensor.PollingSensorComponent) diff --git a/esphomeyaml/components/sensor/esp32_hall.py b/esphome/components/sensor/esp32_hall.py similarity index 71% rename from esphomeyaml/components/sensor/esp32_hall.py rename to esphome/components/sensor/esp32_hall.py index 1f43d886f..7cb31c179 100644 --- a/esphomeyaml/components/sensor/esp32_hall.py +++ b/esphome/components/sensor/esp32_hall.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL, ESP_PLATFORM_ESP32 -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Application +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL, ESP_PLATFORM_ESP32 +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Application ESP_PLATFORMS = [ESP_PLATFORM_ESP32] diff --git a/esphomeyaml/components/sensor/hdc1080.py b/esphome/components/sensor/hdc1080.py similarity index 83% rename from esphomeyaml/components/sensor/hdc1080.py rename to esphome/components/sensor/hdc1080.py index e1e4a236d..a85f7a1d1 100644 --- a/esphomeyaml/components/sensor/hdc1080.py +++ b/esphome/components/sensor/hdc1080.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/hlw8012.py b/esphome/components/sensor/hlw8012.py similarity index 88% rename from esphomeyaml/components/sensor/hlw8012.py rename to esphome/components/sensor/hlw8012.py index 5c57c5ed2..f5a72e22a 100644 --- a/esphomeyaml/components/sensor/hlw8012.py +++ b/esphome/components/sensor/hlw8012.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CF1_PIN, CONF_CF_PIN, CONF_CHANGE_MODE_EVERY, CONF_CURRENT, \ +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_CF1_PIN, CONF_CF_PIN, CONF_CHANGE_MODE_EVERY, CONF_CURRENT, \ CONF_CURRENT_RESISTOR, CONF_ID, CONF_NAME, CONF_POWER, CONF_SEL_PIN, CONF_UPDATE_INTERVAL, \ CONF_VOLTAGE, CONF_VOLTAGE_DIVIDER -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import PollingComponent, App +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, PollingComponent HLW8012Component = sensor.sensor_ns.class_('HLW8012Component', PollingComponent) HLW8012VoltageSensor = sensor.sensor_ns.class_('HLW8012VoltageSensor', sensor.EmptySensor) diff --git a/esphomeyaml/components/sensor/hmc5883l.py b/esphome/components/sensor/hmc5883l.py similarity index 91% rename from esphomeyaml/components/sensor/hmc5883l.py rename to esphome/components/sensor/hmc5883l.py index 61d9cb1c8..4ac7a75cf 100644 --- a/esphomeyaml/components/sensor/hmc5883l.py +++ b/esphome/components/sensor/hmc5883l.py @@ -1,12 +1,12 @@ # coding=utf-8 import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.components import sensor, i2c -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL, CONF_RANGE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import PollingComponent, App +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_RANGE, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] @@ -21,7 +21,6 @@ HMC5883LFieldStrengthSensor = sensor.sensor_ns.class_('HMC5883LFieldStrengthSens HMC5883LHeadingSensor = sensor.sensor_ns.class_('HMC5883LHeadingSensor', sensor.EmptyPollingParentSensor) - HMC5883LRange = sensor.sensor_ns.enum('HMC5883LRange') HMC5883L_RANGES = { 88: HMC5883LRange.HMC5883L_RANGE_88_UT, diff --git a/esphomeyaml/components/sensor/homeassistant.py b/esphome/components/sensor/homeassistant.py similarity index 73% rename from esphomeyaml/components/sensor/homeassistant.py rename to esphome/components/sensor/homeassistant.py index 5caa3529c..e282a825c 100644 --- a/esphomeyaml/components/sensor/homeassistant.py +++ b/esphome/components/sensor/homeassistant.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_types import App +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_types import App DEPENDENCIES = ['api'] diff --git a/esphomeyaml/components/sensor/htu21d.py b/esphome/components/sensor/htu21d.py similarity index 83% rename from esphomeyaml/components/sensor/htu21d.py rename to esphome/components/sensor/htu21d.py index 954159b88..07ee0297f 100644 --- a/esphomeyaml/components/sensor/htu21d.py +++ b/esphome/components/sensor/htu21d.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Application, PollingComponent +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Application, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/hx711.py b/esphome/components/sensor/hx711.py similarity index 78% rename from esphomeyaml/components/sensor/hx711.py rename to esphome/components/sensor/hx711.py index ace1664a4..aab8fff25 100644 --- a/esphomeyaml/components/sensor/hx711.py +++ b/esphome/components/sensor/hx711.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CLK_PIN, CONF_GAIN, CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Application +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_CLK_PIN, CONF_GAIN, CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import App, Application MakeHX711Sensor = Application.struct('MakeHX711Sensor') HX711Sensor = sensor.sensor_ns.class_('HX711Sensor', sensor.PollingSensorComponent) diff --git a/esphomeyaml/components/sensor/ina219.py b/esphome/components/sensor/ina219.py similarity index 90% rename from esphomeyaml/components/sensor/ina219.py rename to esphome/components/sensor/ina219.py index e03dff532..e69057f41 100644 --- a/esphomeyaml/components/sensor/ina219.py +++ b/esphome/components/sensor/ina219.py @@ -1,14 +1,14 @@ # coding=utf-8 import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_BUS_VOLTAGE, CONF_CURRENT, CONF_ID, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_BUS_VOLTAGE, CONF_CURRENT, CONF_ID, \ CONF_MAX_CURRENT, CONF_MAX_VOLTAGE, CONF_NAME, CONF_POWER, CONF_SHUNT_RESISTANCE, \ CONF_SHUNT_VOLTAGE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/ina3221.py b/esphome/components/sensor/ina3221.py similarity index 91% rename from esphomeyaml/components/sensor/ina3221.py rename to esphome/components/sensor/ina3221.py index d062ae975..cac822fbf 100644 --- a/esphomeyaml/components/sensor/ina3221.py +++ b/esphome/components/sensor/ina3221.py @@ -1,13 +1,13 @@ # coding=utf-8 import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_BUS_VOLTAGE, CONF_CURRENT, CONF_ID, CONF_NAME, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_BUS_VOLTAGE, CONF_CURRENT, CONF_ID, CONF_NAME, \ CONF_POWER, CONF_SHUNT_RESISTANCE, CONF_SHUNT_VOLTAGE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/max31855.py b/esphome/components/sensor/max31855.py similarity index 70% rename from esphomeyaml/components/sensor/max31855.py rename to esphome/components/sensor/max31855.py index ef37f1801..1a57fab1f 100644 --- a/esphomeyaml/components/sensor/max31855.py +++ b/esphome/components/sensor/max31855.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor, spi -from esphomeyaml.components.spi import SPIComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CS_PIN, CONF_ID, CONF_NAME, CONF_SPI_ID, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App +from esphome import pins +from esphome.components import sensor, spi +from esphome.components.spi import SPIComponent +import esphome.config_validation as cv +from esphome.const import CONF_CS_PIN, CONF_ID, CONF_NAME, CONF_SPI_ID, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App MAX31855Sensor = sensor.sensor_ns.class_('MAX31855Sensor', sensor.PollingSensorComponent, spi.SPIDevice) diff --git a/esphomeyaml/components/sensor/max6675.py b/esphome/components/sensor/max6675.py similarity index 71% rename from esphomeyaml/components/sensor/max6675.py rename to esphome/components/sensor/max6675.py index f2d6349a3..0ea383d4f 100644 --- a/esphomeyaml/components/sensor/max6675.py +++ b/esphome/components/sensor/max6675.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor, spi -from esphomeyaml.components.spi import SPIComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CS_PIN, CONF_ID, CONF_NAME, CONF_SPI_ID, \ +from esphome import pins +from esphome.components import sensor, spi +from esphome.components.spi import SPIComponent +import esphome.config_validation as cv +from esphome.const import CONF_CS_PIN, CONF_ID, CONF_NAME, CONF_SPI_ID, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App MAX6675Sensor = sensor.sensor_ns.class_('MAX6675Sensor', sensor.PollingSensorComponent, spi.SPIDevice) diff --git a/esphomeyaml/components/sensor/mhz19.py b/esphome/components/sensor/mhz19.py similarity index 81% rename from esphomeyaml/components/sensor/mhz19.py rename to esphome/components/sensor/mhz19.py index c606c9552..e051f5b4c 100644 --- a/esphomeyaml/components/sensor/mhz19.py +++ b/esphome/components/sensor/mhz19.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import sensor, uart -from esphomeyaml.components.uart import UARTComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CO2, CONF_ID, CONF_NAME, CONF_TEMPERATURE, CONF_UART_ID, \ +from esphome.components import sensor, uart +from esphome.components.uart import UARTComponent +import esphome.config_validation as cv +from esphome.const import CONF_CO2, CONF_ID, CONF_NAME, CONF_TEMPERATURE, CONF_UART_ID, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['uart'] diff --git a/esphomeyaml/components/sensor/mpu6050.py b/esphome/components/sensor/mpu6050.py similarity index 92% rename from esphomeyaml/components/sensor/mpu6050.py rename to esphome/components/sensor/mpu6050.py index cd2926f5a..44982f140 100644 --- a/esphomeyaml/components/sensor/mpu6050.py +++ b/esphome/components/sensor/mpu6050.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_TEMPERATURE, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/mqtt_subscribe.py b/esphome/components/sensor/mqtt_subscribe.py similarity index 72% rename from esphomeyaml/components/sensor/mqtt_subscribe.py rename to esphome/components/sensor/mqtt_subscribe.py index 64f2d3da7..3516e3d62 100644 --- a/esphomeyaml/components/sensor/mqtt_subscribe.py +++ b/esphome/components/sensor/mqtt_subscribe.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_QOS, CONF_TOPIC -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_QOS, CONF_TOPIC +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['mqtt'] diff --git a/esphomeyaml/components/sensor/ms5611.py b/esphome/components/sensor/ms5611.py similarity index 84% rename from esphomeyaml/components/sensor/ms5611.py rename to esphome/components/sensor/ms5611.py index 3eb935a9e..cd10b47bb 100644 --- a/esphomeyaml/components/sensor/ms5611.py +++ b/esphome/components/sensor/ms5611.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_PRESSURE, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_ID, CONF_NAME, CONF_PRESSURE, \ CONF_TEMPERATURE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/pmsx003.py b/esphome/components/sensor/pmsx003.py similarity index 89% rename from esphomeyaml/components/sensor/pmsx003.py rename to esphome/components/sensor/pmsx003.py index 1d05c34da..8556ad459 100644 --- a/esphomeyaml/components/sensor/pmsx003.py +++ b/esphome/components/sensor/pmsx003.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import sensor, uart -from esphomeyaml.components.uart import UARTComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_FORMALDEHYDE, CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_PM_10_0, \ +from esphome.components import sensor, uart +from esphome.components.uart import UARTComponent +import esphome.config_validation as cv +from esphome.const import CONF_FORMALDEHYDE, CONF_HUMIDITY, CONF_ID, CONF_NAME, CONF_PM_10_0, \ CONF_PM_1_0, CONF_PM_2_5, CONF_TEMPERATURE, CONF_TYPE, CONF_UART_ID -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['uart'] diff --git a/esphomeyaml/components/sensor/pulse_counter.py b/esphome/components/sensor/pulse_counter.py similarity index 86% rename from esphomeyaml/components/sensor/pulse_counter.py rename to esphome/components/sensor/pulse_counter.py index 763b52811..b1ae21b2c 100644 --- a/esphomeyaml/components/sensor/pulse_counter.py +++ b/esphome/components/sensor/pulse_counter.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_COUNT_MODE, CONF_FALLING_EDGE, CONF_ID, CONF_INTERNAL_FILTER, \ +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_COUNT_MODE, CONF_FALLING_EDGE, CONF_ID, CONF_INTERNAL_FILTER, \ CONF_NAME, CONF_PIN, CONF_RISING_EDGE, CONF_UPDATE_INTERVAL -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import App +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import App PulseCounterCountMode = sensor.sensor_ns.enum('PulseCounterCountMode') COUNT_MODES = { diff --git a/esphomeyaml/components/sensor/rotary_encoder.py b/esphome/components/sensor/rotary_encoder.py similarity index 82% rename from esphomeyaml/components/sensor/rotary_encoder.py rename to esphome/components/sensor/rotary_encoder.py index 3f49c3b1a..f8ceb5bb7 100644 --- a/esphomeyaml/components/sensor/rotary_encoder.py +++ b/esphome/components/sensor/rotary_encoder.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_RESOLUTION -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_RESOLUTION +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_input_pin_expression, setup_component +from esphome.cpp_types import App, Component RotaryEncoderResolution = sensor.sensor_ns.enum('RotaryEncoderResolution') RESOLUTIONS = { diff --git a/esphomeyaml/components/sensor/sht3xd.py b/esphome/components/sensor/sht3xd.py similarity index 84% rename from esphomeyaml/components/sensor/sht3xd.py rename to esphome/components/sensor/sht3xd.py index 9f73d29a4..d873f82ed 100644 --- a/esphomeyaml/components/sensor/sht3xd.py +++ b/esphome/components/sensor/sht3xd.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_HUMIDITY, CONF_ID, CONF_NAME, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_HUMIDITY, CONF_ID, CONF_NAME, \ CONF_TEMPERATURE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/tcs34725.py b/esphome/components/sensor/tcs34725.py similarity index 93% rename from esphomeyaml/components/sensor/tcs34725.py rename to esphome/components/sensor/tcs34725.py index ad9eefc12..6989d3e69 100644 --- a/esphomeyaml/components/sensor/tcs34725.py +++ b/esphome/components/sensor/tcs34725.py @@ -1,13 +1,13 @@ # coding=utf-8 import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_COLOR_TEMPERATURE, CONF_GAIN, CONF_ID, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_COLOR_TEMPERATURE, CONF_GAIN, CONF_ID, \ CONF_ILLUMINANCE, CONF_INTEGRATION_TIME, CONF_NAME, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/template.py b/esphome/components/sensor/template.py similarity index 80% rename from esphomeyaml/components/sensor/template.py rename to esphome/components/sensor/template.py index 27d5d91a6..fb28f06dc 100644 --- a/esphomeyaml/components/sensor/template.py +++ b/esphome/components/sensor/template.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_STATE, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import Action, App, float_, optional +from esphome.automation import ACTION_REGISTRY +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_STATE, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import Action, App, float_, optional TemplateSensor = sensor.sensor_ns.class_('TemplateSensor', sensor.PollingSensorComponent) SensorPublishAction = sensor.sensor_ns.class_('SensorPublishAction', Action) diff --git a/esphomeyaml/components/sensor/total_daily_energy.py b/esphome/components/sensor/total_daily_energy.py similarity index 75% rename from esphomeyaml/components/sensor/total_daily_energy.py rename to esphome/components/sensor/total_daily_energy.py index c2afbc795..f2c3d5b38 100644 --- a/esphomeyaml/components/sensor/total_daily_energy.py +++ b/esphome/components/sensor/total_daily_energy.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import sensor, time -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_TIME_ID -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import sensor, time +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_TIME_ID +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['time'] diff --git a/esphomeyaml/components/sensor/tsl2561.py b/esphome/components/sensor/tsl2561.py similarity index 86% rename from esphomeyaml/components/sensor/tsl2561.py rename to esphome/components/sensor/tsl2561.py index 03e2741f3..6e26f016a 100644 --- a/esphomeyaml/components/sensor/tsl2561.py +++ b/esphome/components/sensor/tsl2561.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import i2c, sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_GAIN, CONF_ID, CONF_INTEGRATION_TIME, CONF_NAME, \ +from esphome.components import i2c, sensor +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_GAIN, CONF_ID, CONF_INTEGRATION_TIME, CONF_NAME, \ CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App DEPENDENCIES = ['i2c'] diff --git a/esphomeyaml/components/sensor/ultrasonic.py b/esphome/components/sensor/ultrasonic.py similarity index 80% rename from esphomeyaml/components/sensor/ultrasonic.py rename to esphome/components/sensor/ultrasonic.py index 33f94a73d..894b7a73d 100644 --- a/esphomeyaml/components/sensor/ultrasonic.py +++ b/esphome/components/sensor/ultrasonic.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ECHO_PIN, CONF_ID, CONF_NAME, CONF_TIMEOUT_METER, \ +from esphome import pins +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ECHO_PIN, CONF_ID, CONF_NAME, CONF_TIMEOUT_METER, \ CONF_TIMEOUT_TIME, CONF_TRIGGER_PIN, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, gpio_output_pin_expression, \ +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_input_pin_expression, gpio_output_pin_expression, \ setup_component -from esphomeyaml.cpp_types import App +from esphome.cpp_types import App UltrasonicSensorComponent = sensor.sensor_ns.class_('UltrasonicSensorComponent', sensor.PollingSensorComponent) diff --git a/esphomeyaml/components/sensor/uptime.py b/esphome/components/sensor/uptime.py similarity index 70% rename from esphomeyaml/components/sensor/uptime.py rename to esphome/components/sensor/uptime.py index 67ac79220..33ee717d0 100644 --- a/esphomeyaml/components/sensor/uptime.py +++ b/esphome/components/sensor/uptime.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App UptimeSensor = sensor.sensor_ns.class_('UptimeSensor', sensor.PollingSensorComponent) diff --git a/esphomeyaml/components/sensor/wifi_signal.py b/esphome/components/sensor/wifi_signal.py similarity index 70% rename from esphomeyaml/components/sensor/wifi_signal.py rename to esphome/components/sensor/wifi_signal.py index d86e6ccd8..cb5e5a768 100644 --- a/esphomeyaml/components/sensor/wifi_signal.py +++ b/esphome/components/sensor/wifi_signal.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.components import sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App WiFiSignalSensor = sensor.sensor_ns.class_('WiFiSignalSensor', sensor.PollingSensorComponent) diff --git a/esphomeyaml/components/sensor/xiaomi_miflora.py b/esphome/components/sensor/xiaomi_miflora.py similarity index 85% rename from esphomeyaml/components/sensor/xiaomi_miflora.py rename to esphome/components/sensor/xiaomi_miflora.py index 5ec566be1..64e002b9a 100644 --- a/esphomeyaml/components/sensor/xiaomi_miflora.py +++ b/esphome/components/sensor/xiaomi_miflora.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import esp32_ble_tracker, sensor -from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ +from esphome.components import esp32_ble_tracker, sensor +from esphome.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ make_address_array -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BATTERY_LEVEL, CONF_CONDUCTIVITY, CONF_ID, CONF_ILLUMINANCE, \ +import esphome.config_validation as cv +from esphome.const import CONF_BATTERY_LEVEL, CONF_CONDUCTIVITY, CONF_ID, CONF_ILLUMINANCE, \ CONF_MAC_ADDRESS, CONF_MOISTURE, CONF_NAME, CONF_TEMPERATURE -from esphomeyaml.cpp_generator import get_variable, Pvariable +from esphome.cpp_generator import Pvariable, get_variable DEPENDENCIES = ['esp32_ble_tracker'] diff --git a/esphomeyaml/components/sensor/xiaomi_mijia.py b/esphome/components/sensor/xiaomi_mijia.py similarity index 81% rename from esphomeyaml/components/sensor/xiaomi_mijia.py rename to esphome/components/sensor/xiaomi_mijia.py index 675dec3a6..d7fdf1743 100644 --- a/esphomeyaml/components/sensor/xiaomi_mijia.py +++ b/esphome/components/sensor/xiaomi_mijia.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml.components import esp32_ble_tracker, sensor -from esphomeyaml.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ +from esphome.components import esp32_ble_tracker, sensor +from esphome.components.esp32_ble_tracker import CONF_ESP32_BLE_ID, ESP32BLETracker, \ make_address_array -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BATTERY_LEVEL, CONF_HUMIDITY, CONF_MAC_ADDRESS, CONF_MAKE_ID, \ +import esphome.config_validation as cv +from esphome.const import CONF_BATTERY_LEVEL, CONF_HUMIDITY, CONF_MAC_ADDRESS, CONF_MAKE_ID, \ CONF_NAME, CONF_TEMPERATURE -from esphomeyaml.cpp_generator import get_variable, Pvariable +from esphome.cpp_generator import Pvariable, get_variable DEPENDENCIES = ['esp32_ble_tracker'] diff --git a/esphomeyaml/components/spi.py b/esphome/components/spi.py similarity index 66% rename from esphomeyaml/components/spi.py rename to esphome/components/spi.py index 7171c6754..247a30635 100644 --- a/esphomeyaml/components/spi.py +++ b/esphome/components/spi.py @@ -1,15 +1,15 @@ import voluptuous as vol -from esphomeyaml import pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CLK_PIN, CONF_ID, CONF_MISO_PIN, CONF_MOSI_PIN -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_input_pin_expression, gpio_output_pin_expression, \ +from esphome import pins +import esphome.config_validation as cv +from esphome.const import CONF_CLK_PIN, CONF_ID, CONF_MISO_PIN, CONF_MOSI_PIN +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_input_pin_expression, gpio_output_pin_expression, \ setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome.cpp_types import App, Component, esphome_ns -SPIComponent = esphomelib_ns.class_('SPIComponent', Component) -SPIDevice = esphomelib_ns.class_('SPIDevice') +SPIComponent = esphome_ns.class_('SPIComponent', Component) +SPIDevice = esphome_ns.class_('SPIDevice') MULTI_CONF = True CONFIG_SCHEMA = vol.All(vol.Schema({ diff --git a/esphomeyaml/components/status_led.py b/esphome/components/status_led.py similarity index 55% rename from esphomeyaml/components/status_led.py rename to esphome/components/status_led.py index 1fd5da1b6..fc71c678d 100644 --- a/esphomeyaml/components/status_led.py +++ b/esphome/components/status_led.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import config_validation as cv, pins -from esphomeyaml.const import CONF_ID, CONF_PIN -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome import config_validation as cv, pins +from esphome.const import CONF_ID, CONF_PIN +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component, esphome_ns -StatusLEDComponent = esphomelib_ns.class_('StatusLEDComponent', Component) +StatusLEDComponent = esphome_ns.class_('StatusLEDComponent', Component) CONFIG_SCHEMA = vol.Schema({ cv.GenerateID(): cv.declare_variable_id(StatusLEDComponent), diff --git a/esphomeyaml/components/stepper/__init__.py b/esphome/components/stepper/__init__.py similarity index 89% rename from esphomeyaml/components/stepper/__init__.py rename to esphome/components/stepper/__init__.py index b9a297c87..fa601d833 100644 --- a/esphomeyaml/components/stepper/__init__.py +++ b/esphome/components/stepper/__init__.py @@ -1,19 +1,19 @@ import voluptuous as vol -from esphomeyaml.automation import ACTION_REGISTRY -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ACCELERATION, CONF_DECELERATION, CONF_ID, CONF_MAX_SPEED, \ +from esphome.automation import ACTION_REGISTRY +import esphome.config_validation as cv +from esphome.const import CONF_ACCELERATION, CONF_DECELERATION, CONF_ID, CONF_MAX_SPEED, \ CONF_POSITION, CONF_TARGET -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, templatable -from esphomeyaml.cpp_types import Action, esphomelib_ns, int32 +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable, templatable +from esphome.cpp_types import Action, esphome_ns, int32 PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) # pylint: disable=invalid-name -stepper_ns = esphomelib_ns.namespace('stepper') +stepper_ns = esphome_ns.namespace('stepper') Stepper = stepper_ns.class_('Stepper') SetTargetAction = stepper_ns.class_('SetTargetAction', Action) diff --git a/esphomeyaml/components/stepper/a4988.py b/esphome/components/stepper/a4988.py similarity index 72% rename from esphomeyaml/components/stepper/a4988.py rename to esphome/components/stepper/a4988.py index acdc378af..76a0dfc1c 100644 --- a/esphomeyaml/components/stepper/a4988.py +++ b/esphome/components/stepper/a4988.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import stepper -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DIR_PIN, CONF_ID, CONF_SLEEP_PIN, CONF_STEP_PIN -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import Component, App +from esphome import pins +from esphome.components import stepper +import esphome.config_validation as cv +from esphome.const import CONF_DIR_PIN, CONF_ID, CONF_SLEEP_PIN, CONF_STEP_PIN +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component A4988 = stepper.stepper_ns.class_('A4988', stepper.Stepper, Component) diff --git a/esphomeyaml/components/stepper/uln2003.py b/esphome/components/stepper/uln2003.py similarity index 81% rename from esphomeyaml/components/stepper/uln2003.py rename to esphome/components/stepper/uln2003.py index b0b2834d0..550a78c4a 100644 --- a/esphomeyaml/components/stepper/uln2003.py +++ b/esphome/components/stepper/uln2003.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import stepper -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_PIN_A, CONF_PIN_B, CONF_PIN_C, CONF_PIN_D, \ +from esphome import pins +from esphome.components import stepper +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_PIN_A, CONF_PIN_B, CONF_PIN_C, CONF_PIN_D, \ CONF_SLEEP_WHEN_DONE, CONF_STEP_MODE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component ULN2003StepMode = stepper.stepper_ns.enum('ULN2003StepMode') diff --git a/esphomeyaml/components/substitutions.py b/esphome/components/substitutions.py similarity index 91% rename from esphomeyaml/components/substitutions.py rename to esphome/components/substitutions.py index 65b3e0840..3177ed8a4 100644 --- a/esphomeyaml/components/substitutions.py +++ b/esphome/components/substitutions.py @@ -3,9 +3,9 @@ import re import voluptuous as vol -from esphomeyaml import core -import esphomeyaml.config_validation as cv -from esphomeyaml.core import EsphomeyamlError +from esphome import core +import esphome.config_validation as cv +from esphome.core import EsphomeError _LOGGER = logging.getLogger(__name__) @@ -110,8 +110,8 @@ def do_substitution_pass(config): substitutions = config[CONF_SUBSTITUTIONS] if not isinstance(substitutions, dict): - raise EsphomeyamlError(u"Substitutions must be a key to value mapping, got {}" - u"".format(type(substitutions))) + raise EsphomeError(u"Substitutions must be a key to value mapping, got {}" + u"".format(type(substitutions))) key = '' try: @@ -127,7 +127,7 @@ def do_substitution_pass(config): except vol.Invalid as err: err.path.append(key) - raise EsphomeyamlError(u"Error while parsing substitutions: {}".format(err)) + raise EsphomeError(u"Error while parsing substitutions: {}".format(err)) config[CONF_SUBSTITUTIONS] = substitutions _substitute_item(substitutions, config, []) diff --git a/esphomeyaml/components/switch/__init__.py b/esphome/components/switch/__init__.py similarity index 88% rename from esphomeyaml/components/switch/__init__.py rename to esphome/components/switch/__init__.py index a3b9c1029..cd6fe3e3c 100644 --- a/esphomeyaml/components/switch/__init__.py +++ b/esphome/components/switch/__init__.py @@ -1,21 +1,21 @@ import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.automation import maybe_simple_id, ACTION_REGISTRY, CONDITION_REGISTRY, Condition -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ICON, CONF_ID, CONF_INVERTED, CONF_MQTT_ID, CONF_INTERNAL, \ - CONF_OPTIMISTIC, CONF_ON_TURN_ON, CONF_ON_TURN_OFF, CONF_TRIGGER_ID -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import add, Pvariable, get_variable -from esphomeyaml.cpp_types import esphomelib_ns, Nameable, Action, App, Trigger, NoArg +from esphome import automation +from esphome.automation import ACTION_REGISTRY, CONDITION_REGISTRY, Condition, maybe_simple_id +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_ICON, CONF_ID, CONF_INTERNAL, CONF_INVERTED, CONF_MQTT_ID, \ + CONF_ON_TURN_OFF, CONF_ON_TURN_ON, CONF_OPTIMISTIC, CONF_TRIGGER_ID +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add, get_variable +from esphome.cpp_types import Action, App, Nameable, NoArg, Trigger, esphome_ns PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) -switch_ns = esphomelib_ns.namespace('switch_') +switch_ns = esphome_ns.namespace('switch_') Switch = switch_ns.class_('Switch', Nameable) SwitchPtr = Switch.operator('ptr') MQTTSwitchComponent = switch_ns.class_('MQTTSwitchComponent', mqtt.MQTTComponent) @@ -76,7 +76,6 @@ def register_switch(var, config): BUILD_FLAGS = '-DUSE_SWITCH' - CONF_SWITCH_TOGGLE = 'switch.toggle' SWITCH_TOGGLE_ACTION_SCHEMA = maybe_simple_id({ vol.Required(CONF_ID): cv.use_variable_id(Switch), diff --git a/esphomeyaml/components/switch/custom.py b/esphome/components/switch/custom.py similarity index 78% rename from esphomeyaml/components/switch/custom.py rename to esphome/components/switch/custom.py index 0f12cd3ba..5b2fc9e6c 100644 --- a/esphomeyaml/components/switch/custom.py +++ b/esphome/components/switch/custom.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import switch -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_SWITCHES, CONF_NAME -from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable, add -from esphomeyaml.cpp_types import std_vector +from esphome.components import switch +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_SWITCHES +from esphome.cpp_generator import Pvariable, add, process_lambda, variable +from esphome.cpp_types import std_vector CustomSwitchConstructor = switch.switch_ns.class_('CustomSwitchConstructor') diff --git a/esphomeyaml/components/switch/gpio.py b/esphome/components/switch/gpio.py similarity index 80% rename from esphomeyaml/components/switch/gpio.py rename to esphome/components/switch/gpio.py index 8a2f76d06..4c46315a7 100644 --- a/esphomeyaml/components/switch/gpio.py +++ b/esphome/components/switch/gpio.py @@ -1,12 +1,12 @@ import voluptuous as vol -from esphomeyaml import pins -from esphomeyaml.components import switch -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_PIN, CONF_RESTORE_MODE, CONF_INTERLOCK -from esphomeyaml.cpp_generator import Pvariable, add, get_variable -from esphomeyaml.cpp_helpers import gpio_output_pin_expression, setup_component -from esphomeyaml.cpp_types import App, Component +from esphome import pins +from esphome.components import switch +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INTERLOCK, CONF_NAME, CONF_PIN, CONF_RESTORE_MODE +from esphome.cpp_generator import Pvariable, add, get_variable +from esphome.cpp_helpers import gpio_output_pin_expression, setup_component +from esphome.cpp_types import App, Component GPIOSwitch = switch.switch_ns.class_('GPIOSwitch', switch.Switch, Component) GPIOSwitchRestoreMode = switch.switch_ns.enum('GPIOSwitchRestoreMode') diff --git a/esphomeyaml/components/switch/output.py b/esphome/components/switch/output.py similarity index 70% rename from esphomeyaml/components/switch/output.py rename to esphome/components/switch/output.py index 43427a8c6..54c5ec655 100644 --- a/esphomeyaml/components/switch/output.py +++ b/esphome/components/switch/output.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import output, switch -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_OUTPUT -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import output, switch +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_OUTPUT +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component OutputSwitch = switch.switch_ns.class_('OutputSwitch', switch.Switch, Component) diff --git a/esphomeyaml/components/switch/remote_transmitter.py b/esphome/components/switch/remote_transmitter.py similarity index 94% rename from esphomeyaml/components/switch/remote_transmitter.py rename to esphome/components/switch/remote_transmitter.py index 8ea8eb7a9..4cdf4c7d8 100644 --- a/esphomeyaml/components/switch/remote_transmitter.py +++ b/esphome/components/switch/remote_transmitter.py @@ -1,19 +1,20 @@ import voluptuous as vol -from esphomeyaml.components import switch -from esphomeyaml.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ +from esphome.components import switch +from esphome.components.remote_transmitter import RC_SWITCH_RAW_SCHEMA, \ RC_SWITCH_TYPE_A_SCHEMA, RC_SWITCH_TYPE_B_SCHEMA, RC_SWITCH_TYPE_C_SCHEMA, \ RC_SWITCH_TYPE_D_SCHEMA, RemoteTransmitterComponent, binary_code, build_rc_switch_protocol, \ remote_ns -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ADDRESS, CONF_CARRIER_FREQUENCY, CONF_CHANNEL, CONF_CODE, \ - CONF_COMMAND, CONF_DATA, CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_INVERTED, CONF_JVC, \ +import esphome.config_validation as cv +from esphome.const import CONF_ADDRESS, CONF_CARRIER_FREQUENCY, CONF_CHANNEL, CONF_CODE, \ + CONF_COMMAND, CONF_DATA, CONF_DEVICE, CONF_FAMILY, CONF_GROUP, CONF_ID, CONF_INVERTED, \ + CONF_JVC, \ CONF_LG, CONF_NAME, CONF_NBITS, CONF_NEC, CONF_PANASONIC, CONF_PROTOCOL, CONF_RAW, \ CONF_RC_SWITCH_RAW, CONF_RC_SWITCH_TYPE_A, CONF_RC_SWITCH_TYPE_B, CONF_RC_SWITCH_TYPE_C, \ CONF_RC_SWITCH_TYPE_D, CONF_REPEAT, CONF_SAMSUNG, CONF_SONY, CONF_STATE, CONF_TIMES, \ - CONF_WAIT_TIME, CONF_ID -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, progmem_array -from esphomeyaml.cpp_types import int32 + CONF_WAIT_TIME +from esphome.cpp_generator import Pvariable, add, get_variable, progmem_array +from esphome.cpp_types import int32 DEPENDENCIES = ['remote_transmitter'] diff --git a/esphomeyaml/components/switch/restart.py b/esphome/components/switch/restart.py similarity index 72% rename from esphomeyaml/components/switch/restart.py rename to esphome/components/switch/restart.py index 8ac45cc7a..915bfcab5 100644 --- a/esphomeyaml/components/switch/restart.py +++ b/esphome/components/switch/restart.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import switch -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_INVERTED, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_types import App +from esphome.components import switch +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INVERTED, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_types import App RestartSwitch = switch.switch_ns.class_('RestartSwitch', switch.Switch) diff --git a/esphomeyaml/components/switch/shutdown.py b/esphome/components/switch/shutdown.py similarity index 72% rename from esphomeyaml/components/switch/shutdown.py rename to esphome/components/switch/shutdown.py index c639cdf28..10f98a8a9 100644 --- a/esphomeyaml/components/switch/shutdown.py +++ b/esphome/components/switch/shutdown.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import switch -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_INVERTED, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_types import App +from esphome.components import switch +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_INVERTED, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_types import App ShutdownSwitch = switch.switch_ns.class_('ShutdownSwitch', switch.Switch) diff --git a/esphomeyaml/components/switch/template.py b/esphome/components/switch/template.py similarity index 82% rename from esphomeyaml/components/switch/template.py rename to esphome/components/switch/template.py index 9b15e2612..6fd34dd46 100644 --- a/esphomeyaml/components/switch/template.py +++ b/esphome/components/switch/template.py @@ -1,15 +1,14 @@ import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.automation import ACTION_REGISTRY -from esphomeyaml.components import switch -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_OPTIMISTIC, \ - CONF_RESTORE_STATE, \ - CONF_STATE, CONF_TURN_OFF_ACTION, CONF_TURN_ON_ACTION, CONF_ASSUMED_STATE -from esphomeyaml.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import Action, App, Component, NoArg, bool_, optional +from esphome import automation +from esphome.automation import ACTION_REGISTRY +from esphome.components import switch +import esphome.config_validation as cv +from esphome.const import CONF_ASSUMED_STATE, CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_OPTIMISTIC, \ + CONF_RESTORE_STATE, CONF_STATE, CONF_TURN_OFF_ACTION, CONF_TURN_ON_ACTION +from esphome.cpp_generator import Pvariable, add, get_variable, process_lambda, templatable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import Action, App, Component, NoArg, bool_, optional TemplateSwitch = switch.switch_ns.class_('TemplateSwitch', switch.Switch, Component) SwitchPublishAction = switch.switch_ns.class_('SwitchPublishAction', Action) diff --git a/esphomeyaml/components/switch/uart.py b/esphome/components/switch/uart.py similarity index 75% rename from esphomeyaml/components/switch/uart.py rename to esphome/components/switch/uart.py index 57573c746..4c5852c38 100644 --- a/esphomeyaml/components/switch/uart.py +++ b/esphome/components/switch/uart.py @@ -1,13 +1,13 @@ import voluptuous as vol -from esphomeyaml.components import switch, uart -from esphomeyaml.components.uart import UARTComponent -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_DATA, CONF_ID, CONF_INVERTED, CONF_NAME, CONF_UART_ID -from esphomeyaml.core import HexInt -from esphomeyaml.cpp_generator import Pvariable, get_variable -from esphomeyaml.cpp_types import App -from esphomeyaml.py_compat import text_type +from esphome.components import switch, uart +from esphome.components.uart import UARTComponent +import esphome.config_validation as cv +from esphome.const import CONF_DATA, CONF_ID, CONF_INVERTED, CONF_NAME, CONF_UART_ID +from esphome.core import HexInt +from esphome.cpp_generator import Pvariable, get_variable +from esphome.cpp_types import App +from esphome.py_compat import text_type DEPENDENCIES = ['uart'] diff --git a/esphomeyaml/components/text_sensor/__init__.py b/esphome/components/text_sensor/__init__.py similarity index 81% rename from esphomeyaml/components/text_sensor/__init__.py rename to esphome/components/text_sensor/__init__.py index 287d341e6..3945d1eaf 100644 --- a/esphomeyaml/components/text_sensor/__init__.py +++ b/esphome/components/text_sensor/__init__.py @@ -1,21 +1,21 @@ import voluptuous as vol -from esphomeyaml import automation -from esphomeyaml.components import mqtt -from esphomeyaml.components.mqtt import setup_mqtt_component -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ICON, CONF_ID, CONF_INTERNAL, CONF_MQTT_ID, CONF_ON_VALUE, \ +from esphome import automation +from esphome.components import mqtt +from esphome.components.mqtt import setup_mqtt_component +import esphome.config_validation as cv +from esphome.const import CONF_ICON, CONF_ID, CONF_INTERNAL, CONF_MQTT_ID, CONF_ON_VALUE, \ CONF_TRIGGER_ID -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_types import esphomelib_ns, Nameable, Trigger, std_string, App +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_types import App, Nameable, Trigger, esphome_ns, std_string PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) # pylint: disable=invalid-name -text_sensor_ns = esphomelib_ns.namespace('text_sensor') +text_sensor_ns = esphome_ns.namespace('text_sensor') TextSensor = text_sensor_ns.class_('TextSensor', Nameable) TextSensorPtr = TextSensor.operator('ptr') MQTTTextSensor = text_sensor_ns.class_('MQTTTextSensor', mqtt.MQTTComponent) diff --git a/esphomeyaml/components/text_sensor/custom.py b/esphome/components/text_sensor/custom.py similarity index 79% rename from esphomeyaml/components/text_sensor/custom.py rename to esphome/components/text_sensor/custom.py index eeeb23b55..1fe2a889a 100644 --- a/esphomeyaml/components/text_sensor/custom.py +++ b/esphome/components/text_sensor/custom.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import text_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_TEXT_SENSORS, CONF_NAME -from esphomeyaml.cpp_generator import process_lambda, variable, Pvariable, add -from esphomeyaml.cpp_types import std_vector +from esphome.components import text_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_TEXT_SENSORS +from esphome.cpp_generator import Pvariable, add, process_lambda, variable +from esphome.cpp_types import std_vector CustomTextSensorConstructor = text_sensor.text_sensor_ns.class_('CustomTextSensorConstructor') diff --git a/esphomeyaml/components/text_sensor/homeassistant.py b/esphome/components/text_sensor/homeassistant.py similarity index 75% rename from esphomeyaml/components/text_sensor/homeassistant.py rename to esphome/components/text_sensor/homeassistant.py index 909f2cee7..bcfe656cb 100644 --- a/esphomeyaml/components/text_sensor/homeassistant.py +++ b/esphome/components/text_sensor/homeassistant.py @@ -1,10 +1,10 @@ import voluptuous as vol -from esphomeyaml.components import text_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_types import App, Component +from esphome.components import text_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ENTITY_ID, CONF_ID, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_types import App, Component DEPENDENCIES = ['api'] diff --git a/esphomeyaml/components/text_sensor/mqtt_subscribe.py b/esphome/components/text_sensor/mqtt_subscribe.py similarity index 75% rename from esphomeyaml/components/text_sensor/mqtt_subscribe.py rename to esphome/components/text_sensor/mqtt_subscribe.py index 6c484aa1b..ead467700 100644 --- a/esphomeyaml/components/text_sensor/mqtt_subscribe.py +++ b/esphome/components/text_sensor/mqtt_subscribe.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import text_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME, CONF_QOS, CONF_TOPIC -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import text_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME, CONF_QOS, CONF_TOPIC +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component DEPENDENCIES = ['mqtt'] diff --git a/esphomeyaml/components/text_sensor/template.py b/esphome/components/text_sensor/template.py similarity index 74% rename from esphomeyaml/components/text_sensor/template.py rename to esphome/components/text_sensor/template.py index 95c47f764..aeae550b2 100644 --- a/esphomeyaml/components/text_sensor/template.py +++ b/esphome/components/text_sensor/template.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import text_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_UPDATE_INTERVAL -from esphomeyaml.cpp_generator import Pvariable, add, process_lambda -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, PollingComponent, optional, std_string +from esphome.components import text_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_LAMBDA, CONF_NAME, CONF_UPDATE_INTERVAL +from esphome.cpp_generator import Pvariable, add, process_lambda +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, PollingComponent, optional, std_string TemplateTextSensor = text_sensor.text_sensor_ns.class_('TemplateTextSensor', text_sensor.TextSensor, PollingComponent) diff --git a/esphomeyaml/components/text_sensor/version.py b/esphome/components/text_sensor/version.py similarity index 70% rename from esphomeyaml/components/text_sensor/version.py rename to esphome/components/text_sensor/version.py index e3fb95ed2..3ef73c5db 100644 --- a/esphomeyaml/components/text_sensor/version.py +++ b/esphome/components/text_sensor/version.py @@ -1,9 +1,9 @@ -from esphomeyaml.components import text_sensor -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_NAME -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component +from esphome.components import text_sensor +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_NAME +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component VersionTextSensor = text_sensor.text_sensor_ns.class_('VersionTextSensor', text_sensor.TextSensor, Component) diff --git a/esphomeyaml/components/time/__init__.py b/esphome/components/time/__init__.py similarity index 95% rename from esphomeyaml/components/time/__init__.py rename to esphome/components/time/__init__.py index e5a1cc3ce..f73c7c837 100644 --- a/esphomeyaml/components/time/__init__.py +++ b/esphome/components/time/__init__.py @@ -4,14 +4,14 @@ import math import voluptuous as vol -from esphomeyaml import automation -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CRON, CONF_DAYS_OF_MONTH, CONF_DAYS_OF_WEEK, CONF_HOURS, \ +from esphome import automation +import esphome.config_validation as cv +from esphome.const import CONF_CRON, CONF_DAYS_OF_MONTH, CONF_DAYS_OF_WEEK, CONF_HOURS, \ CONF_MINUTES, CONF_MONTHS, CONF_ON_TIME, CONF_SECONDS, CONF_TIMEZONE, CONF_TRIGGER_ID -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_types import App, Component, NoArg, Trigger, esphomelib_ns -from esphomeyaml.py_compat import string_types +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_types import App, Component, NoArg, Trigger, esphome_ns +from esphome.py_compat import string_types _LOGGER = logging.getLogger(__name__) @@ -19,10 +19,10 @@ PLATFORM_SCHEMA = cv.PLATFORM_SCHEMA.extend({ }) -time_ns = esphomelib_ns.namespace('time') +time_ns = esphome_ns.namespace('time') RealTimeClockComponent = time_ns.class_('RealTimeClockComponent', Component) CronTrigger = time_ns.class_('CronTrigger', Trigger.template(NoArg), Component) -EsphomelibTime = time_ns.struct('EsphomelibTime') +ESPTime = time_ns.struct('ESPTime') def _tz_timedelta(td): diff --git a/esphomeyaml/components/time/homeassistant.py b/esphome/components/time/homeassistant.py similarity index 65% rename from esphomeyaml/components/time/homeassistant.py rename to esphome/components/time/homeassistant.py index 3ebe3ca8d..092798ec1 100644 --- a/esphomeyaml/components/time/homeassistant.py +++ b/esphome/components/time/homeassistant.py @@ -1,10 +1,9 @@ -from esphomeyaml.components import time as time_ -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID -from esphomeyaml.cpp_generator import Pvariable -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App - +from esphome.components import time as time_ +import esphome.config_validation as cv +from esphome.const import CONF_ID +from esphome.cpp_generator import Pvariable +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App DEPENDENCIES = ['api'] diff --git a/esphomeyaml/components/time/sntp.py b/esphome/components/time/sntp.py similarity index 71% rename from esphomeyaml/components/time/sntp.py rename to esphome/components/time/sntp.py index 15d74f3df..f3b4a9e86 100644 --- a/esphomeyaml/components/time/sntp.py +++ b/esphome/components/time/sntp.py @@ -1,11 +1,11 @@ import voluptuous as vol -from esphomeyaml.components import time as time_ -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_ID, CONF_SERVERS -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App +from esphome.components import time as time_ +import esphome.config_validation as cv +from esphome.const import CONF_ID, CONF_SERVERS +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App SNTPComponent = time_.time_ns.class_('SNTPComponent', time_.RealTimeClockComponent) diff --git a/esphomeyaml/components/uart.py b/esphome/components/uart.py similarity index 62% rename from esphomeyaml/components/uart.py rename to esphome/components/uart.py index 4623b7551..65d416ce5 100644 --- a/esphomeyaml/components/uart.py +++ b/esphome/components/uart.py @@ -1,14 +1,14 @@ import voluptuous as vol -from esphomeyaml import pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_BAUD_RATE, CONF_ID, CONF_RX_PIN, CONF_TX_PIN -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import App, Component, esphomelib_ns +from esphome import pins +import esphome.config_validation as cv +from esphome.const import CONF_BAUD_RATE, CONF_ID, CONF_RX_PIN, CONF_TX_PIN +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, esphome_ns -UARTComponent = esphomelib_ns.class_('UARTComponent', Component) -UARTDevice = esphomelib_ns.class_('UARTDevice') +UARTComponent = esphome_ns.class_('UARTComponent', Component) +UARTDevice = esphome_ns.class_('UARTDevice') MULTI_CONF = True CONFIG_SCHEMA = vol.All(vol.Schema({ diff --git a/esphomeyaml/components/web_server.py b/esphome/components/web_server.py similarity index 65% rename from esphomeyaml/components/web_server.py rename to esphome/components/web_server.py index aca7b8bbc..e8b7420f0 100644 --- a/esphomeyaml/components/web_server.py +++ b/esphome/components/web_server.py @@ -1,13 +1,13 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_CSS_URL, CONF_ID, CONF_JS_URL, CONF_PORT -from esphomeyaml.core import CORE -from esphomeyaml.cpp_generator import Pvariable, add -from esphomeyaml.cpp_helpers import setup_component -from esphomeyaml.cpp_types import esphomelib_ns, StoringController, Component, App +import esphome.config_validation as cv +from esphome.const import CONF_CSS_URL, CONF_ID, CONF_JS_URL, CONF_PORT +from esphome.core import CORE +from esphome.cpp_generator import Pvariable, add +from esphome.cpp_helpers import setup_component +from esphome.cpp_types import App, Component, StoringController, esphome_ns -WebServer = esphomelib_ns.class_('WebServer', Component, StoringController) +WebServer = esphome_ns.class_('WebServer', Component, StoringController) CONFIG_SCHEMA = vol.Schema({ cv.GenerateID(): cv.declare_variable_id(WebServer), diff --git a/esphomeyaml/components/wifi.py b/esphome/components/wifi.py similarity index 91% rename from esphomeyaml/components/wifi.py rename to esphome/components/wifi.py index 70b955919..5b070af84 100644 --- a/esphomeyaml/components/wifi.py +++ b/esphome/components/wifi.py @@ -1,20 +1,20 @@ import voluptuous as vol -import esphomeyaml.config_validation as cv -from esphomeyaml.const import CONF_AP, CONF_BSSID, CONF_CHANNEL, CONF_DNS1, CONF_DNS2, \ +import esphome.config_validation as cv +from esphome.const import CONF_AP, CONF_BSSID, CONF_CHANNEL, CONF_DNS1, CONF_DNS2, \ CONF_DOMAIN, CONF_FAST_CONNECT, CONF_GATEWAY, CONF_ID, CONF_MANUAL_IP, CONF_NETWORKS, \ CONF_PASSWORD, CONF_POWER_SAVE_MODE, CONF_REBOOT_TIMEOUT, CONF_SSID, CONF_STATIC_IP, \ CONF_SUBNET, CONF_USE_ADDRESS -from esphomeyaml.core import CORE, HexInt -from esphomeyaml.cpp_generator import Pvariable, StructInitializer, add, variable -from esphomeyaml.cpp_types import App, Component, esphomelib_ns, global_ns +from esphome.core import CORE, HexInt +from esphome.cpp_generator import Pvariable, StructInitializer, add, variable +from esphome.cpp_types import App, Component, esphome_ns, global_ns IPAddress = global_ns.class_('IPAddress') -ManualIP = esphomelib_ns.struct('ManualIP') -WiFiComponent = esphomelib_ns.class_('WiFiComponent', Component) -WiFiAP = esphomelib_ns.struct('WiFiAP') +ManualIP = esphome_ns.struct('ManualIP') +WiFiComponent = esphome_ns.class_('WiFiComponent', Component) +WiFiAP = esphome_ns.struct('WiFiAP') -WiFiPowerSaveMode = esphomelib_ns.enum('WiFiPowerSaveMode') +WiFiPowerSaveMode = esphome_ns.enum('WiFiPowerSaveMode') WIFI_POWER_SAVE_MODES = { 'NONE': WiFiPowerSaveMode.WIFI_POWER_SAVE_NONE, 'LIGHT': WiFiPowerSaveMode.WIFI_POWER_SAVE_LIGHT, diff --git a/esphomeyaml/config.py b/esphome/config.py similarity index 94% rename from esphomeyaml/config.py rename to esphome/config.py index bac42aaf6..e358fa022 100644 --- a/esphomeyaml/config.py +++ b/esphome/config.py @@ -8,17 +8,17 @@ import re import voluptuous as vol -from esphomeyaml import core, core_config, yaml_util -from esphomeyaml.components import substitutions -from esphomeyaml.const import CONF_ESPHOMEYAML, CONF_PLATFORM, ESP_PLATFORMS -from esphomeyaml.core import CORE, EsphomeyamlError -from esphomeyaml.helpers import color, indent -from esphomeyaml.py_compat import text_type -from esphomeyaml.util import safe_print +from esphome import core, core_config, yaml_util +from esphome.components import substitutions +from esphome.const import CONF_ESPHOME, CONF_PLATFORM, ESP_PLATFORMS +from esphome.core import CORE, EsphomeError +from esphome.helpers import color, indent +from esphome.py_compat import text_type +from esphome.util import safe_print # pylint: disable=unused-import, wrong-import-order from typing import List, Optional, Tuple, Union # noqa -from esphomeyaml.core import ConfigType # noqa +from esphome.core import ConfigType # noqa _LOGGER = logging.getLogger(__name__) @@ -29,7 +29,7 @@ def get_component(domain): if domain in _COMPONENT_CACHE: return _COMPONENT_CACHE[domain] - path = 'esphomeyaml.components.{}'.format(domain) + path = 'esphome.components.{}'.format(domain) try: module = importlib.import_module(path) except (ImportError, ValueError) as err: @@ -52,8 +52,8 @@ def is_platform_component(component): def iter_components(config): for domain, conf in config.items(): - if domain == CONF_ESPHOMEYAML: - yield CONF_ESPHOMEYAML, core_config, conf + if domain == CONF_ESPHOME: + yield CONF_ESPHOME, core_config, conf continue component = get_component(domain) if getattr(component, 'MULTI_CONF', False): @@ -164,7 +164,7 @@ def iter_ids(config, path=None): def do_id_pass(result): # type: (Config) -> None - from esphomeyaml.cpp_generator import MockObjClass + from esphome.cpp_generator import MockObjClass declare_ids = [] # type: List[Tuple[core.ID, ConfigPath]] searching_ids = [] # type: List[Tuple[core.ID, ConfigPath]] @@ -226,12 +226,12 @@ def validate_config(config): skip_paths = list() # type: List[ConfigPath] # Step 1: Load everything - result.add_domain([CONF_ESPHOMEYAML], CONF_ESPHOMEYAML) - result[CONF_ESPHOMEYAML] = config[CONF_ESPHOMEYAML] + result.add_domain([CONF_ESPHOME], CONF_ESPHOME) + result[CONF_ESPHOME] = config[CONF_ESPHOME] for domain, conf in config.items(): domain = str(domain) - if domain == CONF_ESPHOMEYAML or domain.startswith(u'.'): + if domain == CONF_ESPHOME or domain.startswith(u'.'): skip_paths.append([domain]) continue result.add_domain([domain], domain) @@ -333,9 +333,9 @@ def validate_config(config): # Step 2: Validate configuration try: - result[CONF_ESPHOMEYAML] = core_config.CONFIG_SCHEMA(result[CONF_ESPHOMEYAML]) + result[CONF_ESPHOME] = core_config.CONFIG_SCHEMA(result[CONF_ESPHOME]) except vol.Invalid as ex: - _comp_error(ex, [CONF_ESPHOMEYAML]) + _comp_error(ex, [CONF_ESPHOME]) for domain, conf in result.items(): domain = str(domain) @@ -438,14 +438,14 @@ def load_config(): try: config = yaml_util.load_yaml(CORE.config_path) except OSError: - raise EsphomeyamlError(u"Invalid YAML at {}".format(CORE.config_path)) + raise EsphomeError(u"Invalid YAML at {}".format(CORE.config_path)) CORE.raw_config = config config = substitutions.do_substitution_pass(config) core_config.preload_core_config(config) try: result = validate_config(config) - except EsphomeyamlError: + except EsphomeError: raise except Exception: _LOGGER.error(u"Unexpected exception while reading configuration:") @@ -584,7 +584,7 @@ def read_config(verbose): _LOGGER.info("Reading configuration...") try: res = load_config() - except EsphomeyamlError as err: + except EsphomeError as err: _LOGGER.error(u"Error while reading config: %s", err) return None if res.errors: diff --git a/esphomeyaml/config_validation.py b/esphome/config_validation.py similarity index 98% rename from esphomeyaml/config_validation.py rename to esphome/config_validation.py index b6330538a..16be90326 100644 --- a/esphomeyaml/config_validation.py +++ b/esphome/config_validation.py @@ -9,14 +9,14 @@ import uuid as uuid_ import voluptuous as vol -from esphomeyaml import core -from esphomeyaml.const import CONF_AVAILABILITY, CONF_COMMAND_TOPIC, CONF_DISCOVERY, CONF_ID, \ +from esphome import core +from esphome.const import CONF_AVAILABILITY, CONF_COMMAND_TOPIC, CONF_DISCOVERY, CONF_ID, \ CONF_INTERNAL, CONF_NAME, CONF_PAYLOAD_AVAILABLE, CONF_PAYLOAD_NOT_AVAILABLE, CONF_PLATFORM, \ CONF_RETAIN, CONF_SETUP_PRIORITY, CONF_STATE_TOPIC, CONF_TOPIC, ESP_PLATFORM_ESP32, \ ESP_PLATFORM_ESP8266 -from esphomeyaml.core import CORE, HexInt, IPAddress, Lambda, TimePeriod, TimePeriodMicroseconds, \ +from esphome.core import CORE, HexInt, IPAddress, Lambda, TimePeriod, TimePeriodMicroseconds, \ TimePeriodMilliseconds, TimePeriodSeconds -from esphomeyaml.py_compat import text_type, string_types, integer_types +from esphome.py_compat import integer_types, string_types, text_type _LOGGER = logging.getLogger(__name__) @@ -578,6 +578,7 @@ def requires_component(comp): if comp not in CORE.raw_config: raise vol.Invalid("This option requires component {}".format(comp)) return value + return validator diff --git a/esphomeyaml/const.py b/esphome/const.py similarity index 98% rename from esphomeyaml/const.py rename to esphome/const.py index 797033ed0..befb8a2b0 100644 --- a/esphomeyaml/const.py +++ b/esphome/const.py @@ -1,11 +1,11 @@ -"""Constants used by esphomeyaml.""" +"""Constants used by esphome.""" MAJOR_VERSION = 1 MINOR_VERSION = 10 PATCH_VERSION = '0-dev' __short_version__ = '{}.{}'.format(MAJOR_VERSION, MINOR_VERSION) __version__ = '{}.{}'.format(__short_version__, PATCH_VERSION) -ESPHOMELIB_VERSION = 'dev' +ESPHOME_CORE_VERSION = 'dev' ESP_PLATFORM_ESP32 = 'ESP32' ESP_PLATFORM_ESP8266 = 'ESP8266' @@ -13,11 +13,11 @@ ESP_PLATFORMS = [ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266] APB_CLOCK_FREQ = 80000000 -CONF_ESPHOMEYAML = 'esphomeyaml' +CONF_ESPHOME = 'esphome' CONF_NAME = 'name' CONF_PLATFORM = 'platform' CONF_BOARD = 'board' -CONF_ESPHOMELIB_VERSION = 'esphomelib_version' +CONF_ESPHOME_CORE_VERSION = 'esphome_core_version' CONF_USE_CUSTOM_CODE = 'use_custom_code' CONF_ARDUINO_VERSION = 'arduino_version' CONF_LOCAL = 'local' diff --git a/esphomeyaml/core.py b/esphome/core.py similarity index 92% rename from esphomeyaml/core.py rename to esphome/core.py index 5ff76cc9c..ad1ced816 100644 --- a/esphomeyaml/core.py +++ b/esphome/core.py @@ -6,20 +6,20 @@ import math import os import re -from esphomeyaml.const import CONF_ARDUINO_VERSION, CONF_ESPHOMELIB_VERSION, CONF_ESPHOMEYAML, \ - CONF_LOCAL, CONF_WIFI, ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266, CONF_USE_ADDRESS -from esphomeyaml.helpers import ensure_unique_string - # pylint: disable=unused-import, wrong-import-order from typing import Any, Dict, List # noqa -from esphomeyaml.py_compat import integer_types, IS_PY2 +from esphome.const import CONF_ARDUINO_VERSION, CONF_ESPHOME, CONF_ESPHOME_CORE_VERSION, \ + CONF_LOCAL, \ + CONF_USE_ADDRESS, CONF_WIFI, ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266 +from esphome.helpers import ensure_unique_string +from esphome.py_compat import IS_PY2, integer_types _LOGGER = logging.getLogger(__name__) -class EsphomeyamlError(Exception): - """General esphomeyaml exception occurred.""" +class EsphomeError(Exception): + """General ESPHome exception occurred.""" if IS_PY2: @@ -55,7 +55,7 @@ class MACAddress(object): return ':'.join('{:02X}'.format(part) for part in self.parts) def as_hex(self): - from esphomeyaml.cpp_generator import RawExpression + from esphome.cpp_generator import RawExpression num = ''.join('{:02X}'.format(part) for part in self.parts) return RawExpression('0x{}ULL'.format(num)) @@ -261,7 +261,7 @@ class ID(object): self.type = type def resolve(self, registered_ids): - from esphomeyaml.config_validation import RESERVED_IDS + from esphome.config_validation import RESERVED_IDS if self.id is None: base = str(self.type).replace('::', '_').lower() @@ -289,7 +289,7 @@ class ID(object): # pylint: disable=too-many-instance-attributes -class EsphomeyamlCore(object): +class EsphomeCore(object): def __init__(self): # True if command is run from dashboard self.dashboard = False @@ -322,19 +322,19 @@ class EsphomeyamlCore(object): if 'ethernet' in self.config: return self.config['ethernet'][CONF_USE_ADDRESS] - return None + raise EsphomeError("No network configured") @property - def esphomelib_version(self): # type: () -> Dict[str, str] - return self.config[CONF_ESPHOMEYAML][CONF_ESPHOMELIB_VERSION] + def esphome_core_version(self): # type: () -> Dict[str, str] + return self.config[CONF_ESPHOME][CONF_ESPHOME_CORE_VERSION] @property - def is_local_esphomelib_copy(self): - return CONF_LOCAL in self.esphomelib_version + def is_local_esphome_core_copy(self): + return CONF_LOCAL in self.esphome_core_version @property def arduino_version(self): # type: () -> str - return self.config[CONF_ESPHOMEYAML][CONF_ARDUINO_VERSION] + return self.config[CONF_ESPHOME][CONF_ARDUINO_VERSION] @property def config_dir(self): @@ -388,7 +388,7 @@ class EsphomeyamlCore(object): while self.pending_tasks: i += 1 if i > 1000000: - raise EsphomeyamlError("Circular dependency detected!") + raise EsphomeError("Circular dependency detected!") task, domain = self.pending_tasks.popleft() _LOGGER.debug("Executing task for domain=%s", domain) @@ -399,7 +399,7 @@ class EsphomeyamlCore(object): _LOGGER.debug(" -> %s finished", domain) def add(self, expression, require=True): - from esphomeyaml.cpp_generator import Expression + from esphome.cpp_generator import Expression if require and isinstance(expression, Expression): expression.require() @@ -427,7 +427,7 @@ class EsphomeyamlCore(object): def register_variable(self, id, obj): if id in self.variables: - raise EsphomeyamlError("ID {} is already registered".format(id)) + raise EsphomeError("ID {} is already registered".format(id)) _LOGGER.debug("Registered variable %s of type %s", id.id, id.type) self.variables[id] = obj @@ -435,7 +435,7 @@ class EsphomeyamlCore(object): return id in self.variables -CORE = EsphomeyamlCore() +CORE = EsphomeCore() ConfigType = Dict[str, Any] -CoreType = EsphomeyamlCore +CoreType = EsphomeCore diff --git a/esphomeyaml/core_config.py b/esphome/core_config.py similarity index 74% rename from esphomeyaml/core_config.py rename to esphome/core_config.py index 1bd510a9e..159b1b7ef 100644 --- a/esphomeyaml/core_config.py +++ b/esphome/core_config.py @@ -4,28 +4,30 @@ import re import voluptuous as vol -from esphomeyaml import automation, pins -import esphomeyaml.config_validation as cv -from esphomeyaml.const import ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP8266_DEV, \ +from esphome import automation, pins +import esphome.config_validation as cv +from esphome.const import ARDUINO_VERSION_ESP32_DEV, ARDUINO_VERSION_ESP8266_DEV, \ CONF_ARDUINO_VERSION, CONF_BOARD, CONF_BOARD_FLASH_MODE, CONF_BRANCH, CONF_BUILD_PATH, \ - CONF_COMMIT, CONF_ESPHOMELIB_VERSION, CONF_ESPHOMEYAML, CONF_LOCAL, CONF_NAME, CONF_ON_BOOT, \ - CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, CONF_PRIORITY, CONF_REPOSITORY, CONF_TAG, \ - CONF_TRIGGER_ID, CONF_USE_CUSTOM_CODE, ESPHOMELIB_VERSION, ESP_PLATFORM_ESP32, \ - ESP_PLATFORM_ESP8266, CONF_LIBRARIES, CONF_INCLUDES, CONF_PLATFORMIO_OPTIONS -from esphomeyaml.core import CORE, EsphomeyamlError -from esphomeyaml.cpp_generator import Pvariable, RawExpression, add -from esphomeyaml.cpp_types import App, NoArg, const_char_ptr, esphomelib_ns -from esphomeyaml.py_compat import text_type + CONF_COMMIT, CONF_ESPHOME, CONF_ESPHOME_CORE_VERSION, CONF_INCLUDES, CONF_LIBRARIES, \ + CONF_LOCAL, \ + CONF_NAME, CONF_ON_BOOT, CONF_ON_LOOP, CONF_ON_SHUTDOWN, CONF_PLATFORM, \ + CONF_PLATFORMIO_OPTIONS, \ + CONF_PRIORITY, CONF_REPOSITORY, CONF_TAG, CONF_TRIGGER_ID, CONF_USE_CUSTOM_CODE, \ + ESPHOME_CORE_VERSION, ESP_PLATFORM_ESP32, ESP_PLATFORM_ESP8266 +from esphome.core import CORE, EsphomeError +from esphome.cpp_generator import Pvariable, RawExpression, add +from esphome.cpp_types import App, NoArg, const_char_ptr, esphome_ns +from esphome.py_compat import text_type _LOGGER = logging.getLogger(__name__) -LIBRARY_URI_REPO = u'https://github.com/OttoWinter/esphomelib.git' -GITHUB_ARCHIVE_ZIP = u'https://github.com/OttoWinter/esphomelib/archive/{}.zip' +LIBRARY_URI_REPO = u'https://github.com/esphome/esphome-core.git' +GITHUB_ARCHIVE_ZIP = u'https://github.com/esphome/esphome-core/archive/{}.zip' BUILD_FLASH_MODES = ['qio', 'qout', 'dio', 'dout'] -StartupTrigger = esphomelib_ns.StartupTrigger -ShutdownTrigger = esphomelib_ns.ShutdownTrigger -LoopTrigger = esphomelib_ns.LoopTrigger +StartupTrigger = esphome_ns.StartupTrigger +ShutdownTrigger = esphome_ns.ShutdownTrigger +LoopTrigger = esphome_ns.LoopTrigger VERSION_REGEX = re.compile(r'^[0-9]+\.[0-9]+\.[0-9]+(?:[ab]\d+)?$') @@ -44,14 +46,14 @@ def validate_board(value): return value -def validate_simple_esphomelib_version(value): +def validate_simple_esphome_core_version(value): value = cv.string_strict(value) if value.upper() == 'LATEST': - if ESPHOMELIB_VERSION == 'dev': - return validate_simple_esphomelib_version('dev') + if ESPHOME_CORE_VERSION == 'dev': + return validate_simple_esphome_core_version('dev') return { CONF_REPOSITORY: LIBRARY_URI_REPO, - CONF_TAG: 'v' + ESPHOMELIB_VERSION, + CONF_TAG: 'v' + ESPHOME_CORE_VERSION, } if value.upper() == 'DEV': return { @@ -63,16 +65,16 @@ def validate_simple_esphomelib_version(value): CONF_REPOSITORY: LIBRARY_URI_REPO, CONF_TAG: 'v' + value, } - raise vol.Invalid("Only simple esphomelib versions!") + raise vol.Invalid("Only simple esphome core versions!") -def validate_local_esphomelib_version(value): +def validate_local_esphome_core_version(value): value = cv.directory(value) path = CORE.relative_path(value) library_json = os.path.join(path, 'library.json') if not os.path.exists(library_json): raise vol.Invalid(u"Could not find '{}' file. '{}' does not seem to point to an " - u"esphomelib copy.".format(library_json, value)) + u"esphome-core copy.".format(library_json, value)) return value @@ -83,10 +85,10 @@ def validate_commit(value): return value -ESPHOMELIB_VERSION_SCHEMA = vol.Any( - validate_simple_esphomelib_version, +ESPHOME_CORE_VERSION_SCHEMA = vol.Any( + validate_simple_esphome_core_version, vol.Schema({ - vol.Required(CONF_LOCAL): validate_local_esphomelib_version, + vol.Required(CONF_LOCAL): validate_local_esphome_core_version, }), vol.All( vol.Schema({ @@ -160,7 +162,7 @@ CONFIG_SCHEMA = vol.Schema({ vol.Required(CONF_PLATFORM): cv.one_of('ESP8266', 'ESPRESSIF8266', 'ESP32', 'ESPRESSIF32', upper=True), vol.Required(CONF_BOARD): validate_board, - vol.Optional(CONF_ESPHOMELIB_VERSION, default='latest'): ESPHOMELIB_VERSION_SCHEMA, + vol.Optional(CONF_ESPHOME_CORE_VERSION, default='latest'): ESPHOME_CORE_VERSION_SCHEMA, vol.Optional(CONF_ARDUINO_VERSION, default='recommended'): validate_arduino_version, vol.Optional(CONF_USE_CUSTOM_CODE, default=False): cv.boolean, vol.Optional(CONF_BUILD_PATH, default=default_build_path): cv.string, @@ -182,23 +184,26 @@ CONFIG_SCHEMA = vol.Schema({ vol.Optional(CONF_INCLUDES): cv.ensure_list(cv.file_), vol.Optional(CONF_LIBRARIES): cv.ensure_list(cv.string_strict), - vol.Optional('library_uri'): cv.invalid("The library_uri option has been removed in 1.8.0 and " - "was moved into the esphomelib_version option."), - vol.Optional('use_build_flags'): cv.invalid("The use_build_flags option has been replaced by " - "use_custom_code option in 1.8.0."), + vol.Optional('esphomelib_version'): cv.invalid("The esphomelib_version has been renamed to " + "esphome_core_version in 1.11.0"), }) def preload_core_config(config): - if CONF_ESPHOMEYAML not in config: - raise EsphomeyamlError(u"No esphomeyaml section in config") - core_conf = config[CONF_ESPHOMEYAML] + if CONF_ESPHOME not in config: + if 'esphomeyaml' in config: + raise EsphomeError(u"The top-level 'esphomeyaml' section has been renamed to " + u"'esphome' in 1.11.0.\n" + u"Please replace the esphomeyaml: line in your config with" + u"esphome:") + raise EsphomeError(u"No esphome section in config") + core_conf = config[CONF_ESPHOME] if CONF_PLATFORM not in core_conf: - raise EsphomeyamlError("esphomeyaml.platform not specified.") + raise EsphomeError("esphome.platform not specified.") if CONF_BOARD not in core_conf: - raise EsphomeyamlError("esphomeyaml.board not specified.") + raise EsphomeError("esphome.board not specified.") if CONF_NAME not in core_conf: - raise EsphomeyamlError("esphomeyaml.name not specified.") + raise EsphomeError("esphome.name not specified.") try: CORE.esp_platform = validate_platform(core_conf[CONF_PLATFORM]) @@ -207,7 +212,7 @@ def preload_core_config(config): CORE.build_path = CORE.relative_path( cv.string(core_conf.get(CONF_BUILD_PATH, default_build_path()))) except vol.Invalid as e: - raise EsphomeyamlError(text_type(e)) + raise EsphomeError(text_type(e)) def to_code(config): diff --git a/esphomeyaml/cpp_generator.py b/esphome/cpp_generator.py similarity index 98% rename from esphomeyaml/cpp_generator.py rename to esphome/cpp_generator.py index fbfe99100..3bbd2bc2b 100644 --- a/esphomeyaml/cpp_generator.py +++ b/esphome/cpp_generator.py @@ -1,13 +1,13 @@ from collections import OrderedDict -from esphomeyaml.core import CORE, HexInt, Lambda, TimePeriod, TimePeriodMicroseconds, \ +from esphome.core import CORE, HexInt, Lambda, TimePeriod, TimePeriodMicroseconds, \ TimePeriodMilliseconds, TimePeriodSeconds -from esphomeyaml.helpers import cpp_string_escape, indent_all_but_first_and_last +from esphome.helpers import cpp_string_escape, indent_all_but_first_and_last # pylint: disable=unused-import, wrong-import-order from typing import Any, Generator, List, Optional, Tuple, Union # noqa -from esphomeyaml.core import ID # noqa -from esphomeyaml.py_compat import text_type, string_types, integer_types +from esphome.core import ID # noqa +from esphome.py_compat import text_type, string_types, integer_types class Expression(object): @@ -397,7 +397,7 @@ def process_lambda(value, # type: Lambda return_type=None # type: Optional[Expression] ): # type: (...) -> Generator[LambdaExpression] - from esphomeyaml.components.globals import GlobalVariableComponent + from esphome.components.globals import GlobalVariableComponent if value is None: yield diff --git a/esphomeyaml/cpp_helpers.py b/esphome/cpp_helpers.py similarity index 75% rename from esphomeyaml/cpp_helpers.py rename to esphome/cpp_helpers.py index c96dce697..4b3a628d8 100644 --- a/esphomeyaml/cpp_helpers.py +++ b/esphome/cpp_helpers.py @@ -1,8 +1,8 @@ -from esphomeyaml.const import CONF_INVERTED, CONF_MODE, CONF_NUMBER, CONF_PCF8574, \ +from esphome.const import CONF_INVERTED, CONF_MODE, CONF_NUMBER, CONF_PCF8574, \ CONF_SETUP_PRIORITY -from esphomeyaml.core import CORE, EsphomeyamlError -from esphomeyaml.cpp_generator import IntLiteral, RawExpression -from esphomeyaml.cpp_types import GPIOInputPin, GPIOOutputPin +from esphome.core import CORE, EsphomeError +from esphome.cpp_generator import IntLiteral, RawExpression +from esphome.cpp_types import GPIOInputPin, GPIOOutputPin def generic_gpio_pin_expression_(conf, mock_obj, default_mode): @@ -11,7 +11,7 @@ def generic_gpio_pin_expression_(conf, mock_obj, default_mode): number = conf[CONF_NUMBER] inverted = conf.get(CONF_INVERTED) if CONF_PCF8574 in conf: - from esphomeyaml.components import pcf8574 + from esphome.components import pcf8574 for hub in CORE.get_variable(conf[CONF_PCF8574]): yield None @@ -24,7 +24,7 @@ def generic_gpio_pin_expression_(conf, mock_obj, default_mode): yield hub.make_output_pin(number, inverted) return - raise EsphomeyamlError(u"Unknown default mode {}".format(default_mode)) + raise EsphomeError(u"Unknown default mode {}".format(default_mode)) if len(conf) == 1: yield IntLiteral(number) return diff --git a/esphome/cpp_types.py b/esphome/cpp_types.py new file mode 100644 index 000000000..8f9a2e294 --- /dev/null +++ b/esphome/cpp_types.py @@ -0,0 +1,37 @@ +from esphome.cpp_generator import MockObj + +global_ns = MockObj('', '') +void = global_ns.namespace('void') +float_ = global_ns.namespace('float') +bool_ = global_ns.namespace('bool') +std_ns = global_ns.namespace('std') +std_string = std_ns.class_('string') +std_vector = std_ns.class_('vector') +uint8 = global_ns.namespace('uint8_t') +uint16 = global_ns.namespace('uint16_t') +uint32 = global_ns.namespace('uint32_t') +int32 = global_ns.namespace('int32_t') +const_char_ptr = global_ns.namespace('const char *') +NAN = global_ns.namespace('NAN') +esphome_ns = global_ns # using namespace esphome; +NoArg = esphome_ns.class_('NoArg') +App = esphome_ns.App +io_ns = esphome_ns.namespace('io') +Nameable = esphome_ns.class_('Nameable') +Trigger = esphome_ns.class_('Trigger') +Action = esphome_ns.class_('Action') +Component = esphome_ns.class_('Component') +ComponentPtr = Component.operator('ptr') +PollingComponent = esphome_ns.class_('PollingComponent', Component) +Application = esphome_ns.class_('Application') +optional = esphome_ns.class_('optional') +arduino_json_ns = global_ns.namespace('ArduinoJson') +JsonObject = arduino_json_ns.class_('JsonObject') +JsonObjectRef = JsonObject.operator('ref') +JsonObjectConstRef = JsonObjectRef.operator('const') +Controller = esphome_ns.class_('Controller') +StoringController = esphome_ns.class_('StoringController', Controller) + +GPIOPin = esphome_ns.class_('GPIOPin') +GPIOOutputPin = esphome_ns.class_('GPIOOutputPin', GPIOPin) +GPIOInputPin = esphome_ns.class_('GPIOInputPin', GPIOPin) diff --git a/esphomeyaml/dashboard/__init__.py b/esphome/dashboard/__init__.py similarity index 100% rename from esphomeyaml/dashboard/__init__.py rename to esphome/dashboard/__init__.py diff --git a/esphomeyaml/dashboard/dashboard.py b/esphome/dashboard/dashboard.py similarity index 86% rename from esphomeyaml/dashboard/dashboard.py rename to esphome/dashboard/dashboard.py index 2b6a0a9de..4c7b8f9a7 100644 --- a/esphomeyaml/dashboard/dashboard.py +++ b/esphome/dashboard/dashboard.py @@ -11,28 +11,28 @@ import threading import tornado import tornado.concurrent -import tornado.httpserver -import tornado.netutil import tornado.gen +import tornado.httpserver import tornado.ioloop import tornado.iostream from tornado.log import access_log +import tornado.netutil import tornado.process import tornado.web import tornado.websocket -from esphomeyaml import const -from esphomeyaml.__main__ import get_serial_ports -from esphomeyaml.helpers import mkdir_p -from esphomeyaml.py_compat import IS_PY2 -from esphomeyaml.storage_json import EsphomeyamlStorageJSON, StorageJSON, \ - esphomeyaml_storage_path, ext_storage_path -from esphomeyaml.util import shlex_quote +from esphome import const +from esphome.__main__ import get_serial_ports +from esphome.helpers import mkdir_p +from esphome.py_compat import IS_PY2 +from esphome.storage_json import EsphomeStorageJSON, StorageJSON, \ + esphome_storage_path, ext_storage_path +from esphome.util import shlex_quote # pylint: disable=unused-import, wrong-import-order from typing import Optional # noqa -from esphomeyaml.zeroconf import Zeroconf, DashboardStatus +from esphome.zeroconf import DashboardStatus, Zeroconf _LOGGER = logging.getLogger(__name__) CONFIG_DIR = '' @@ -59,9 +59,9 @@ class BaseHandler(tornado.web.RequestHandler): # pylint: disable=abstract-method, arguments-differ -class EsphomeyamlCommandWebSocket(tornado.websocket.WebSocketHandler): +class EsphomeCommandWebSocket(tornado.websocket.WebSocketHandler): def __init__(self, application, request, **kwargs): - super(EsphomeyamlCommandWebSocket, self).__init__(application, request, **kwargs) + super(EsphomeCommandWebSocket, self).__init__(application, request, **kwargs) self.proc = None self.closed = False @@ -113,53 +113,53 @@ class EsphomeyamlCommandWebSocket(tornado.websocket.WebSocketHandler): raise NotImplementedError -class EsphomeyamlLogsHandler(EsphomeyamlCommandWebSocket): +class EsphomeLogsHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = CONFIG_DIR + '/' + js['configuration'] - return ["esphomeyaml", "--dashboard", config_file, "logs", '--serial-port', js["port"]] + return ["esphome", "--dashboard", config_file, "logs", '--serial-port', js["port"]] -class EsphomeyamlRunHandler(EsphomeyamlCommandWebSocket): +class EsphomeRunHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = os.path.join(CONFIG_DIR, js['configuration']) - return ["esphomeyaml", "--dashboard", config_file, "run", '--upload-port', js["port"]] + return ["esphome", "--dashboard", config_file, "run", '--upload-port', js["port"]] -class EsphomeyamlCompileHandler(EsphomeyamlCommandWebSocket): +class EsphomeCompileHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = os.path.join(CONFIG_DIR, js['configuration']) - return ["esphomeyaml", "--dashboard", config_file, "compile"] + return ["esphome", "--dashboard", config_file, "compile"] -class EsphomeyamlValidateHandler(EsphomeyamlCommandWebSocket): +class EsphomeValidateHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = os.path.join(CONFIG_DIR, js['configuration']) - return ["esphomeyaml", "--dashboard", config_file, "config"] + return ["esphome", "--dashboard", config_file, "config"] -class EsphomeyamlCleanMqttHandler(EsphomeyamlCommandWebSocket): +class EsphomeCleanMqttHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = os.path.join(CONFIG_DIR, js['configuration']) - return ["esphomeyaml", "--dashboard", config_file, "clean-mqtt"] + return ["esphome", "--dashboard", config_file, "clean-mqtt"] -class EsphomeyamlCleanHandler(EsphomeyamlCommandWebSocket): +class EsphomeCleanHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = os.path.join(CONFIG_DIR, js['configuration']) - return ["esphomeyaml", "--dashboard", config_file, "clean"] + return ["esphome", "--dashboard", config_file, "clean"] -class EsphomeyamlHassConfigHandler(EsphomeyamlCommandWebSocket): +class EsphomeHassConfigHandler(EsphomeCommandWebSocket): def build_command(self, message): js = json.loads(message) config_file = os.path.join(CONFIG_DIR, js['configuration']) - return ["esphomeyaml", "--dashboard", config_file, "hass-config"] + return ["esphome", "--dashboard", config_file, "hass-config"] class SerialPortRequestHandler(BaseHandler): @@ -184,7 +184,7 @@ class SerialPortRequestHandler(BaseHandler): class WizardRequestHandler(BaseHandler): def post(self): - from esphomeyaml import wizard + from esphome import wizard if not self.is_authenticated(): self.redirect('/login') @@ -291,7 +291,7 @@ class DashboardEntry(object): def update_old(self): if self.storage is None: return '' - return self.storage.esphomeyaml_version or '' + return self.storage.esphome_version or '' @property def update_new(self): @@ -307,8 +307,8 @@ class MainRequestHandler(BaseHandler): begin = bool(self.get_argument('begin', False)) entries = _list_dashboard_entries() version = const.__version__ - docs_link = 'https://beta.esphomelib.com/esphomeyaml/' if 'b' in version else \ - 'https://esphomelib.com/esphomeyaml/' + docs_link = 'https://beta.esphome.io/' if 'b' in version else \ + 'https://esphome.io/' self.render("templates/index.html", entries=entries, version=version, begin=begin, docs_link=docs_link, @@ -396,8 +396,8 @@ class LoginHandler(BaseHandler): def render_hassio_login(self, error=None): version = const.__version__ - docs_link = 'https://beta.esphomelib.com/esphomeyaml/' if 'b' in version else \ - 'https://esphomelib.com/esphomeyaml/' + docs_link = 'https://beta.esphome.io/' if 'b' in version else \ + 'https://esphome.io/' self.render("templates/login.html", version=version, docs_link=docs_link, error=error, get_static_file_url=get_static_file_url) @@ -490,13 +490,13 @@ def make_app(debug=False): app = tornado.web.Application([ (r"/", MainRequestHandler), (r"/login", LoginHandler), - (r"/logs", EsphomeyamlLogsHandler), - (r"/run", EsphomeyamlRunHandler), - (r"/compile", EsphomeyamlCompileHandler), - (r"/validate", EsphomeyamlValidateHandler), - (r"/clean-mqtt", EsphomeyamlCleanMqttHandler), - (r"/clean", EsphomeyamlCleanHandler), - (r"/hass-config", EsphomeyamlHassConfigHandler), + (r"/logs", EsphomeLogsHandler), + (r"/run", EsphomeRunHandler), + (r"/compile", EsphomeCompileHandler), + (r"/validate", EsphomeValidateHandler), + (r"/clean-mqtt", EsphomeCleanMqttHandler), + (r"/clean", EsphomeCleanHandler), + (r"/hass-config", EsphomeHassConfigHandler), (r"/edit", EditRequestHandler), (r"/download.bin", DownloadBinaryRequestHandler), (r"/serial-ports", SerialPortRequestHandler), @@ -521,7 +521,7 @@ def start_web_server(args): CONFIG_DIR = args.configuration mkdir_p(CONFIG_DIR) - mkdir_p(os.path.join(CONFIG_DIR, ".esphomeyaml")) + mkdir_p(os.path.join(CONFIG_DIR, ".esphome")) ON_HASSIO = args.hassio if ON_HASSIO: @@ -538,10 +538,10 @@ def start_web_server(args): PASSWORD_DIGEST = hmac.new(args.password.encode()).digest() if USING_HASSIO_AUTH or USING_PASSWORD: - path = esphomeyaml_storage_path(CONFIG_DIR) - storage = EsphomeyamlStorageJSON.load(path) + path = esphome_storage_path(CONFIG_DIR) + storage = EsphomeStorageJSON.load(path) if storage is None: - storage = EsphomeyamlStorageJSON.get_default() + storage = EsphomeStorageJSON.get_default() storage.save(path) COOKIE_SECRET = storage.cookie_secret diff --git a/esphomeyaml/dashboard/static/ace.js b/esphome/dashboard/static/ace.js similarity index 100% rename from esphomeyaml/dashboard/static/ace.js rename to esphome/dashboard/static/ace.js diff --git a/esphomeyaml/dashboard/static/esphomeyaml.css b/esphome/dashboard/static/esphome.css similarity index 100% rename from esphomeyaml/dashboard/static/esphomeyaml.css rename to esphome/dashboard/static/esphome.css diff --git a/esphomeyaml/dashboard/static/esphomeyaml.js b/esphome/dashboard/static/esphome.js similarity index 100% rename from esphomeyaml/dashboard/static/esphomeyaml.js rename to esphome/dashboard/static/esphome.js diff --git a/esphomeyaml/dashboard/static/ext-searchbox.js b/esphome/dashboard/static/ext-searchbox.js similarity index 100% rename from esphomeyaml/dashboard/static/ext-searchbox.js rename to esphome/dashboard/static/ext-searchbox.js diff --git a/esphomeyaml/dashboard/static/favicon.ico b/esphome/dashboard/static/favicon.ico similarity index 100% rename from esphomeyaml/dashboard/static/favicon.ico rename to esphome/dashboard/static/favicon.ico diff --git a/esphomeyaml/dashboard/static/jquery-ui.min.js b/esphome/dashboard/static/jquery-ui.min.js similarity index 100% rename from esphomeyaml/dashboard/static/jquery-ui.min.js rename to esphome/dashboard/static/jquery-ui.min.js diff --git a/esphomeyaml/dashboard/static/jquery.min.js b/esphome/dashboard/static/jquery.min.js similarity index 100% rename from esphomeyaml/dashboard/static/jquery.min.js rename to esphome/dashboard/static/jquery.min.js diff --git a/esphomeyaml/dashboard/static/jquery.validate.min.js b/esphome/dashboard/static/jquery.validate.min.js similarity index 100% rename from esphomeyaml/dashboard/static/jquery.validate.min.js rename to esphome/dashboard/static/jquery.validate.min.js diff --git a/esphomeyaml/dashboard/static/materialize-stepper.min.css b/esphome/dashboard/static/materialize-stepper.min.css similarity index 100% rename from esphomeyaml/dashboard/static/materialize-stepper.min.css rename to esphome/dashboard/static/materialize-stepper.min.css diff --git a/esphomeyaml/dashboard/static/materialize-stepper.min.js b/esphome/dashboard/static/materialize-stepper.min.js similarity index 100% rename from esphomeyaml/dashboard/static/materialize-stepper.min.js rename to esphome/dashboard/static/materialize-stepper.min.js diff --git a/esphomeyaml/dashboard/static/materialize.min.css b/esphome/dashboard/static/materialize.min.css similarity index 100% rename from esphomeyaml/dashboard/static/materialize.min.css rename to esphome/dashboard/static/materialize.min.css diff --git a/esphomeyaml/dashboard/static/materialize.min.js b/esphome/dashboard/static/materialize.min.js similarity index 100% rename from esphomeyaml/dashboard/static/materialize.min.js rename to esphome/dashboard/static/materialize.min.js diff --git a/esphomeyaml/dashboard/static/mode-yaml.js b/esphome/dashboard/static/mode-yaml.js similarity index 100% rename from esphomeyaml/dashboard/static/mode-yaml.js rename to esphome/dashboard/static/mode-yaml.js diff --git a/esphomeyaml/dashboard/static/theme-dreamweaver.js b/esphome/dashboard/static/theme-dreamweaver.js similarity index 100% rename from esphomeyaml/dashboard/static/theme-dreamweaver.js rename to esphome/dashboard/static/theme-dreamweaver.js diff --git a/esphomeyaml/dashboard/templates/index.html b/esphome/dashboard/templates/index.html similarity index 93% rename from esphomeyaml/dashboard/templates/index.html rename to esphome/dashboard/templates/index.html index 42e6ab816..48a8872bc 100644 --- a/esphomeyaml/dashboard/templates/index.html +++ b/esphome/dashboard/templates/index.html @@ -6,7 +6,7 @@ - + @@ -116,7 +116,7 @@