🏗 Merge C++ into python codebase (#504)

## Description:

Move esphome-core codebase into esphome (and a bunch of other refactors). See https://github.com/esphome/feature-requests/issues/97

Yes this is a shit ton of work and no there's no way to automate it :( But it will be worth it 👍

Progress:
- Core support (file copy etc): 80%
- Base Abstractions (light, switch): ~50%
- Integrations: ~10%
- Working? Yes, (but only with ported components).

Other refactors:
- Moves all codegen related stuff into a single class: `esphome.codegen` (imported as `cg`)
- Rework coroutine syntax
- Move from `component/platform.py` to `domain/component.py` structure as with HA
- Move all defaults out of C++ and into config validation.
- Remove `make_...` helpers from Application class. Reason: Merge conflicts with every single new integration.
- Pointer Variables are stored globally instead of locally in setup(). Reason: stack size limit.

Future work:
- Rework const.py - Move all `CONF_...` into a conf class (usage `conf.UPDATE_INTERVAL` vs `CONF_UPDATE_INTERVAL`). Reason: Less convoluted import block
- Enable loading from `custom_components` folder.

**Related issue (if applicable):** https://github.com/esphome/feature-requests/issues/97

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

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

If user exposed functionality or configuration variables are added/changed:
  - [ ] Documentation added/updated in [esphomedocs](https://github.com/OttoWinter/esphomedocs).
This commit is contained in:
Otto Winter
2019-04-17 12:06:00 +02:00
committed by GitHub
parent 049807e3ab
commit 6682c43dfa
817 changed files with 54156 additions and 10830 deletions
+90 -105
View File
@@ -2,12 +2,6 @@ esphome:
name: test1
platform: ESP32
board: nodemcu-32s
# Use this for testing while developing:
# Note the travis check for esphome PRs will fail until the
# esphome-core PR has been merged.
# esphome_core_version:
# local: ~/path/to/esphome-core
use_custom_code: false
on_boot:
priority: 150.0
then:
@@ -709,18 +703,6 @@ output:
- platform: my9231
id: my_5
channel: 5
- platform: copy
id: my_copy1
outputs:
- my_1
- my_2
- my_3
- platform: copy
id: my_copy2
type: binary
outputs:
- id22
- id2
light:
- platform: binary
@@ -874,6 +856,7 @@ light:
remote_transmitter:
- pin: 32
carrier_duty_percent: 100%
switch:
- platform: gpio
@@ -883,92 +866,94 @@ switch:
inverted: True
command_topic: custom_command_topic
restore_mode: ALWAYS_OFF
- platform: remote_transmitter
name: "JVC Off"
jvc:
data: 0x10EF
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
nec:
address: 0x4242
command: 0x8484
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
lg:
data: 4294967295
nbits: 28
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
samsung:
data: 0xABCDEF
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
sony:
data: 0xABCDEF
nbits: 12
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
panasonic:
address: 0x4004
command: 0x1000BCD
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
rc_switch_raw:
code: '001010011001111101011011'
protocol: 1
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
rc_switch_type_a:
group: '11001'
device: '01000'
state: True
protocol:
pulse_length: 175
sync: [1, 31]
zero: [1, 3]
one: [3, 1]
inverted: False
repeat: 25
- platform: remote_transmitter
name: "Panasonic TV Off"
rc_switch_type_b:
address: 4
channel: 2
state: True
- platform: remote_transmitter
name: "Panasonic TV Off"
rc_switch_type_c:
family: 'a'
group: 1
device: 2
state: True
- platform: remote_transmitter
name: "Panasonic TV Off"
- platform: template
name: JVC Off
id: living_room_lights_on
rc_switch_type_d:
group: 'a'
device: 2
state: True
- platform: remote_transmitter
name: "Panasonic TV Off"
rc5:
address: 0x00
command: 0x0B
- platform: remote_transmitter
name: "Panasonic TV Off"
turn_on_action:
remote_transmitter.transmit_jvc:
data: 0x10EF
- platform: template
name: NEC
id: living_room_lights_off
raw:
carrier_frequency: 35kHz
data:
- 1000
- -1000
turn_on_action:
remote_transmitter.transmit_nec:
address: 0x4242
command: 0x8484
- platform: template
name: LG
turn_on_action:
remote_transmitter.transmit_lg:
data: 4294967295
nbits: 28
- platform: template
name: Samsung
turn_on_action:
remote_transmitter.transmit_samsung:
data: 0xABCDEF
- platform: template
name: Sony
turn_on_action:
remote_transmitter.transmit_sony:
data: 0xABCDEF
nbits: 12
- platform: template
name: Panasonic
turn_on_action:
remote_transmitter.transmit_panasonic:
address: 0x4004
command: 0x1000BCD
- platform: template
name: RC Switch Raw
turn_on_action:
remote_transmitter.transmit_rc_switch_raw:
code: '001010011001111101011011'
protocol: 1
- platform: template
name: RC Switch Type A
turn_on_action:
remote_transmitter.transmit_rc_switch_type_a:
group: '11001'
device: '01000'
state: True
protocol:
pulse_length: 175
sync: [1, 31]
zero: [1, 3]
one: [3, 1]
inverted: False
- platform: template
name: RC Switch Type B
turn_on_action:
remote_transmitter.transmit_rc_switch_type_b:
address: 4
channel: 2
state: True
- platform: template
name: RC Switch Type C
turn_on_action:
remote_transmitter.transmit_rc_switch_type_c:
family: 'a'
group: 1
device: 2
state: True
- platform: template
name: RC Switch Type D
turn_on_action:
remote_transmitter.transmit_rc_switch_type_d:
group: 'a'
device: 2
state: True
- platform: template
name: RC5
turn_on_action:
remote_transmitter.transmit_rc5:
address: 0x00
command: 0x0B
- platform: template
name: RC5
turn_on_action:
remote_transmitter.transmit_raw:
code: [1000, -1000]
- platform: template
name: Living Room Lights
id: livingroom_lights
@@ -1061,8 +1046,8 @@ interval:
then:
- display.page.show: !lambda |-
if (true) return id(page1); else return id(page2);
- display.page.show_next: display
- display.page.show_previous: display
- display.page.show_next: display1
- display.page.show_previous: display1
display:
- platform: lcd_gpio
@@ -1094,7 +1079,7 @@ display:
model: "SSD1306 128x64"
reset_pin: GPIO23
address: 0x3C
id: display
id: display1
pages:
- id: page1
lambda: |-