mirror of
https://github.com/esphome/esphome.git
synced 2024-11-10 09:17:46 +01:00
6682c43dfa
## 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).
168 lines
3 KiB
YAML
168 lines
3 KiB
YAML
esphome:
|
|
name: $devicename
|
|
platform: ESP8266
|
|
board: esp07
|
|
build_path: build/test3
|
|
|
|
substitutions:
|
|
devicename: test3
|
|
|
|
api:
|
|
|
|
i2c:
|
|
sda: 4
|
|
scl: 5
|
|
scan: False
|
|
|
|
spi:
|
|
clk_pin: GPIO12
|
|
mosi_pin: GPIO13
|
|
miso_pin: GPIO14
|
|
|
|
uart:
|
|
tx_pin: GPIO1
|
|
rx_pin: GPIO3
|
|
baud_rate: 115200
|
|
|
|
ota:
|
|
safe_mode: True
|
|
port: 3286
|
|
|
|
logger:
|
|
hardware_uart: UART1
|
|
level: DEBUG
|
|
|
|
web_server:
|
|
|
|
deep_sleep:
|
|
run_duration: 20s
|
|
sleep_duration: 50s
|
|
|
|
sensor:
|
|
- platform: apds9960
|
|
type: proximity
|
|
name: APDS9960 Proximity
|
|
- platform: apds9960
|
|
type: clear
|
|
name: APDS9960 Clear
|
|
- platform: apds9960
|
|
type: red
|
|
name: APDS9960 Red
|
|
- platform: apds9960
|
|
type: green
|
|
name: APDS9960 Green
|
|
- platform: apds9960
|
|
type: blue
|
|
name: APDS9960 Blue
|
|
- platform: homeassistant
|
|
entity_id: sensor.hello_world
|
|
id: ha_hello_world
|
|
|
|
time:
|
|
- platform: homeassistant
|
|
|
|
apds9960:
|
|
address: 0x20
|
|
update_interval: 60s
|
|
|
|
mpr121:
|
|
id: mpr121_first
|
|
address: 0x5A
|
|
|
|
binary_sensor:
|
|
- platform: apds9960
|
|
direction: up
|
|
name: APDS9960 Up
|
|
- platform: apds9960
|
|
direction: down
|
|
name: APDS9960 Down
|
|
- platform: apds9960
|
|
direction: left
|
|
name: APDS9960 Left
|
|
- platform: apds9960
|
|
direction: right
|
|
name: APDS9960 Right
|
|
- platform: homeassistant
|
|
entity_id: binary_sensor.hello_world
|
|
id: ha_hello_world_binary
|
|
#mpr121
|
|
- platform: mpr121
|
|
id: touchkey0
|
|
channel: 0
|
|
name: "touchkey0"
|
|
- platform: mpr121
|
|
channel: 1
|
|
name: "touchkey1"
|
|
- platform: mpr121
|
|
channel: 2
|
|
name: "touchkey2"
|
|
- platform: mpr121
|
|
channel: 3
|
|
name: "touchkey3"
|
|
on_press:
|
|
then:
|
|
- switch.toggle: mpr121_toggle
|
|
|
|
remote_receiver:
|
|
pin: GPIO12
|
|
dump: []
|
|
|
|
status_led:
|
|
pin: GPIO2
|
|
|
|
text_sensor:
|
|
- platform: version
|
|
name: "ESPHome Version"
|
|
icon: mdi:icon
|
|
id: version_sensor
|
|
on_value:
|
|
- lambda: !lambda |-
|
|
ESP_LOGD("main", "The state is %s=%s", x.c_str(), id(version_sensor).state.c_str());
|
|
- script.execute: my_script
|
|
- homeassistant.service:
|
|
service: notify.html5
|
|
data:
|
|
title: New Humidity
|
|
data_template:
|
|
message: The humidity is {{ my_variable }}%.
|
|
variables:
|
|
my_variable: |-
|
|
return id(version_sensor).state;
|
|
- platform: template
|
|
name: "Template Text Sensor"
|
|
lambda: |-
|
|
return {"Hello World"};
|
|
- platform: homeassistant
|
|
entity_id: sensor.hello_world2
|
|
id: ha_hello_world2
|
|
|
|
script:
|
|
- id: my_script
|
|
then:
|
|
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
|
|
|
switch:
|
|
- platform: template
|
|
name: "mpr121_toggle"
|
|
id: mpr121_toggle
|
|
optimistic: True
|
|
|
|
stepper:
|
|
- platform: uln2003
|
|
id: my_stepper
|
|
pin_a: GPIO12
|
|
pin_b: GPIO13
|
|
pin_c: GPIO14
|
|
pin_d: GPIO15
|
|
sleep_when_done: no
|
|
step_mode: HALF_STEP
|
|
max_speed: 250 steps/s
|
|
|
|
# Optional:
|
|
acceleration: inf
|
|
deceleration: inf
|
|
|
|
interval:
|
|
interval: 5s
|
|
then:
|
|
- logger.log: "Interval Run"
|