Skip to content

Commit

Permalink
Add native ESPHome API (#265)
Browse files Browse the repository at this point in the history
* Esphomeapi

* Updates

* Remove MQTT from wizard

* Add protobuf to requirements

* Fix

* API Client updates

* Dump config on API connect

* Old WiFi config migration

* Home Assistant state import

* Lint
  • Loading branch information
OttoWinter committed Dec 18, 2018
1 parent 7556845 commit da2821a
Show file tree
Hide file tree
Showing 49 changed files with 3,782 additions and 345 deletions.
8 changes: 5 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: Bug report
about: Create a report to help us improve
about: Create a report to help esphomelib improve

---

Expand All @@ -9,7 +9,9 @@ about: Create a report to help us improve
- esphomeyaml [here] - This is mostly for reporting bugs when compiling and when you get a long stack trace while compiling or if a configuration fails to validate.
- esphomelib [https://github.com/OttoWinter/esphomelib] - Report bugs there if the ESP is crashing or a feature is not working as expected.
- esphomedocs [https://github.com/OttoWinter/esphomedocs] - Report bugs there if the documentation is wrong/outdated.
- Provide as many details as possible. Paste logs, configuration sample and code into the backticks (```). Do not delete any text from this template!
- Provide as many details as possible. Paste logs, configuration sample and code into the backticks (```).
DO NOT DELETE ANY TEXT from this template! Otherwise the issue may be closed without a comment.
-->

**Operating environment (Hass.io/Docker/pip/etc.):**
Expand All @@ -33,7 +35,7 @@ Please add the link to the documentation at https://esphomelib.com/esphomeyaml/i

**Problem-relevant YAML-configuration entries:**
```yaml

PASTE YAML FILE HERE
```

**Traceback (if applicable):**
Expand Down
17 changes: 8 additions & 9 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,15 @@ about: Suggest an idea for this project
<!-- READ THIS FIRST:
- This is for feature requests only, if you want to have a certain new sensor/module supported, please use the "new integration" template.
- Please be as descriptive as possible, especially use-cases that can otherwise not be solved boost the problem's priority.
DO NOT DELETE ANY TEXT from this template! Otherwise the issue may be closed without a comment.
-->

**Is your feature request related to a problem? Please describe.**
<!--
A clear and concise description of what the problem is.
-->
Ex. I'm always frustrated when [...]
**Is your feature request related to a problem/use-case? Please describe.**
<!-- A clear and concise description of what the problem is. -->

**Describe the solution you'd like**
A description of what you want to happen.
**Describe the solution you'd like:**
<!-- A description of what you want to happen. -->

**Additional context**
Add any other context about the feature request here.
**Additional context:**
<!-- Add any other context about the feature request here. -->
15 changes: 4 additions & 11 deletions .github/ISSUE_TEMPLATE/new-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,10 @@ about: Suggest a new integration for esphomelib

---

<!-- READ THIS FIRST:
- This is for new integrations (such as new sensors/modules) only, for new features within the environment please use the "feature request" template.
- Do not delete anything from this template and fill out the form as precisely as possible.
-->
DO NOT POST NEW INTEGRATION REQUESTS HERE!

**What new integration would you wish to have?**
<!-- A name/description of the new integration/board. -->
Please post all new integration requests in the esphomelib repository:

**If possible, provide a link to an existing library for the integration:**
https://github.com/OttoWinter/esphomelib/issues

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Additional context**
Thank you!
6 changes: 0 additions & 6 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@
**Pull request in [esphomedocs](https://github.com/OttoWinter/esphomedocs) with documentation (if applicable):** OttoWinter/esphomedocs#<esphomedocs PR number goes here>
**Pull request in [esphomelib](https://github.com/OttoWinter/esphomelib) with C++ framework changes (if applicable):** OttoWinter/esphomelib#<esphomelib PR number goes here>

## Example entry for YAML configuration (if applicable):
```yaml

```

## Checklist:
- [ ] The code change is tested and works locally.
- [ ] Tests have been added to verify that the new code works (under `tests/` folder).
- [ ] Check this box if you have read, understand, comply, and agree with the [Code of Conduct](https://github.com/OttoWinter/esphomeyaml/blob/master/CODE_OF_CONDUCT.md).

If user exposed functionality or configuration variables are added/changed:
- [ ] Documentation added/updated in [esphomedocs](https://github.com/OttoWinter/esphomedocs).
5 changes: 1 addition & 4 deletions esphomeyaml-edge/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,9 @@
],
"hassio_api": true,
"auth_api": true,
"services": [
"mqtt:want"
],
"hassio_role": "default",
"homeassistant_api": false,
"host_network": false,
"host_network": true,
"boot": "auto",
"ports": {
"6052/tcp": 6052
Expand Down
8 changes: 7 additions & 1 deletion esphomeyaml/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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_DOMAIN, CONF_ESPHOMEYAML, \
CONF_HOSTNAME, CONF_LOGGER, CONF_MANUAL_IP, CONF_NAME, CONF_STATIC_IP, CONF_USE_CUSTOM_CODE, \
Expand All @@ -22,7 +23,7 @@

_LOGGER = logging.getLogger(__name__)

PRE_INITIALIZE = ['esphomeyaml', 'logger', 'wifi', 'ota', 'mqtt', 'web_server', 'i2c']
PRE_INITIALIZE = ['esphomeyaml', 'logger', 'wifi', 'ota', 'mqtt', 'web_server', 'api', 'i2c']


def get_serial_ports():
Expand Down Expand Up @@ -202,6 +203,8 @@ def show_logs(config, args, port):
if port != 'OTA' and serial_port:
run_miniterm(config, port)
return 0
if 'api' in config:
return run_logs(config, get_upload_host(config))
return mqtt.show_logs(config, args.topic, args.username, args.password, args.client_id)


Expand Down Expand Up @@ -368,6 +371,8 @@ def parse_args(argv):
parser = argparse.ArgumentParser(prog='esphomeyaml')
parser.add_argument('-v', '--verbose', help="Enable verbose esphomeyaml logs.",
action='store_true')
parser.add_argument('--dashboard', help="Internal flag to set if the command is run from the "
"dashboard.", action='store_true')
parser.add_argument('configuration', help='Your YAML configuration file.')

subparsers = parser.add_subparsers(help='Commands', dest='command')
Expand Down Expand Up @@ -445,6 +450,7 @@ def parse_args(argv):

def run_esphomeyaml(argv):
args = parse_args(argv)
CORE.dashboard = args.dashboard

setup_log(args.verbose)
if args.command in PRE_CONFIG_ACTIONS:
Expand Down
Empty file added esphomeyaml/api/__init__.py
Empty file.
Loading

0 comments on commit da2821a

Please sign in to comment.