2019-02-13 16:54:02 +01:00
|
|
|
esphome:
|
2019-02-13 11:20:22 +01:00
|
|
|
name: $devicename
|
|
|
|
platform: ESP8266
|
2019-04-22 21:56:30 +02:00
|
|
|
board: d1_mini
|
2019-02-13 11:20:22 +01:00
|
|
|
build_path: build/test3
|
2019-04-22 21:56:30 +02:00
|
|
|
on_boot:
|
|
|
|
- wait_until:
|
|
|
|
- api.connected
|
|
|
|
- wifi.connected
|
2019-05-08 11:31:06 +02:00
|
|
|
includes:
|
|
|
|
- custom.h
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
substitutions:
|
|
|
|
devicename: test3
|
|
|
|
|
|
|
|
api:
|
2019-04-22 21:56:30 +02:00
|
|
|
port: 8000
|
|
|
|
password: 'pwd'
|
|
|
|
reboot_timeout: 0min
|
|
|
|
services:
|
|
|
|
- service: hello_world
|
|
|
|
variables:
|
|
|
|
name: string
|
|
|
|
then:
|
|
|
|
- logger.log:
|
|
|
|
format: 'Hello World %s!'
|
|
|
|
args:
|
|
|
|
- name.c_str()
|
|
|
|
- service: empty_service
|
|
|
|
then:
|
|
|
|
- logger.log: 'Service Called'
|
|
|
|
- service: all_types
|
|
|
|
variables:
|
|
|
|
bool_: bool
|
|
|
|
int_: int
|
|
|
|
float_: float
|
|
|
|
string_: string
|
|
|
|
then:
|
|
|
|
- logger.log: 'Something happened'
|
|
|
|
- stepper.set_target:
|
|
|
|
id: my_stepper2
|
|
|
|
target: !lambda 'return int_;'
|
|
|
|
|
|
|
|
wifi:
|
|
|
|
ssid: 'MySSID'
|
|
|
|
password: 'password1'
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
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
|
2019-05-08 11:31:06 +02:00
|
|
|
esp8266_store_log_strings_in_flash: false
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
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
|
2019-04-22 21:56:30 +02:00
|
|
|
- platform: adc
|
|
|
|
pin: VCC
|
|
|
|
id: my_sensor
|
|
|
|
filters:
|
|
|
|
- offset: 5.0
|
|
|
|
- multiply: 2.0
|
|
|
|
- filter_out: NAN
|
|
|
|
- sliding_window_moving_average:
|
|
|
|
- exponential_moving_average:
|
|
|
|
- lambda: 'return 0;'
|
|
|
|
- delta: 100
|
|
|
|
- throttle: 100ms
|
|
|
|
- debounce: 500s
|
|
|
|
- calibrate_linear:
|
|
|
|
- 0 -> 0
|
|
|
|
- 100 -> 100
|
|
|
|
- platform: tcs34725
|
|
|
|
red_channel:
|
|
|
|
name: Red Channel
|
|
|
|
green_channel:
|
|
|
|
name: Green Channel
|
|
|
|
blue_channel:
|
|
|
|
name: Blue Channel
|
|
|
|
clear_channel:
|
|
|
|
name: Clear Channel
|
|
|
|
illuminance:
|
|
|
|
name: Illuminance
|
|
|
|
color_temperature:
|
|
|
|
name: Color Temperature
|
|
|
|
integration_time: 700ms
|
|
|
|
gain: 60x
|
2019-05-08 10:56:52 +02:00
|
|
|
- platform: custom
|
|
|
|
lambda: |-
|
2019-05-08 11:31:06 +02:00
|
|
|
auto s = new CustomSensor();
|
|
|
|
App.register_component(s);
|
2019-05-08 10:56:52 +02:00
|
|
|
return {s};
|
|
|
|
sensors:
|
|
|
|
- id: custom_sensor
|
|
|
|
name: Custom Sensor
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
time:
|
|
|
|
- platform: homeassistant
|
|
|
|
|
|
|
|
apds9960:
|
|
|
|
address: 0x20
|
|
|
|
update_interval: 60s
|
2019-05-08 10:56:52 +02:00
|
|
|
|
2019-02-24 21:48:28 +01:00
|
|
|
mpr121:
|
|
|
|
id: mpr121_first
|
|
|
|
address: 0x5A
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
binary_sensor:
|
|
|
|
- platform: apds9960
|
|
|
|
direction: up
|
|
|
|
name: APDS9960 Up
|
2019-04-22 21:56:30 +02:00
|
|
|
device_class: motion
|
|
|
|
filters:
|
|
|
|
- invert
|
|
|
|
- delayed_on: 20ms
|
|
|
|
- delayed_off: 20ms
|
|
|
|
- lambda: 'return false;'
|
|
|
|
on_state:
|
|
|
|
- logger.log: New state
|
|
|
|
id: my_binary_sensor
|
2019-02-13 11:20:22 +01:00
|
|
|
- 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
|
2019-02-24 21:48:28 +01:00
|
|
|
- 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
|
2019-04-22 21:56:30 +02:00
|
|
|
- platform: ttp229_lsf
|
|
|
|
channel: 1
|
|
|
|
name: TTP229 LSF Test
|
2019-05-10 21:44:02 +02:00
|
|
|
- platform: ttp229_bsf
|
|
|
|
channel: 1
|
|
|
|
name: TTP229 BSF Test
|
2019-05-08 10:56:52 +02:00
|
|
|
- platform: custom
|
|
|
|
lambda: |-
|
2019-05-08 11:31:06 +02:00
|
|
|
auto s = new CustomBinarySensor();
|
|
|
|
App.register_component(s);
|
2019-05-08 10:56:52 +02:00
|
|
|
return {s};
|
2019-05-08 11:31:06 +02:00
|
|
|
binary_sensors:
|
2019-05-08 10:56:52 +02:00
|
|
|
- id: custom_binary_sensor
|
|
|
|
name: Custom Binary Sensor
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
remote_receiver:
|
|
|
|
pin: GPIO12
|
|
|
|
dump: []
|
|
|
|
|
|
|
|
status_led:
|
|
|
|
pin: GPIO2
|
|
|
|
|
|
|
|
text_sensor:
|
|
|
|
- platform: version
|
2019-02-13 16:54:02 +01:00
|
|
|
name: "ESPHome Version"
|
2019-02-13 11:20:22 +01:00
|
|
|
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
|
2019-05-08 11:31:06 +02:00
|
|
|
- platform: custom
|
|
|
|
lambda: |-
|
|
|
|
auto s = new CustomTextSensor();
|
|
|
|
App.register_component(s);
|
|
|
|
return {s};
|
|
|
|
text_sensors:
|
|
|
|
- id: custom_text_sensor
|
|
|
|
name: Custom Text Sensor
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
script:
|
|
|
|
- id: my_script
|
|
|
|
then:
|
|
|
|
- lambda: 'ESP_LOGD("main", "Hello World!");'
|
|
|
|
|
2019-02-24 21:48:28 +01:00
|
|
|
switch:
|
|
|
|
- platform: template
|
|
|
|
name: "mpr121_toggle"
|
|
|
|
id: mpr121_toggle
|
|
|
|
optimistic: True
|
2019-04-22 21:56:30 +02:00
|
|
|
- platform: gpio
|
|
|
|
id: gpio_switch1
|
|
|
|
pin:
|
|
|
|
mcp23017: mcp
|
|
|
|
number: 0
|
|
|
|
mode: OUTPUT
|
|
|
|
interlock: &interlock [gpio_switch1, gpio_switch2]
|
|
|
|
- platform: gpio
|
|
|
|
id: gpio_switch2
|
|
|
|
pin: GPIO1
|
|
|
|
interlock: *interlock
|
2019-05-08 10:56:52 +02:00
|
|
|
- platform: custom
|
|
|
|
lambda: |-
|
2019-05-08 11:31:06 +02:00
|
|
|
auto s = new CustomSwitch();
|
2019-05-08 10:56:52 +02:00
|
|
|
return {s};
|
2019-05-08 11:31:06 +02:00
|
|
|
switches:
|
2019-05-08 10:56:52 +02:00
|
|
|
- id: custom_switch
|
|
|
|
name: Custom Switch
|
2019-02-24 21:48:28 +01:00
|
|
|
|
2019-05-08 11:31:06 +02:00
|
|
|
custom_component:
|
|
|
|
lambda: |-
|
|
|
|
auto s = new CustomComponent();
|
|
|
|
s->set_update_interval(15000);
|
|
|
|
return {s};
|
|
|
|
|
2019-02-13 11:20:22 +01:00
|
|
|
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
|
|
|
|
acceleration: inf
|
|
|
|
deceleration: inf
|
2019-04-22 21:56:30 +02:00
|
|
|
- platform: a4988
|
|
|
|
id: my_stepper2
|
|
|
|
step_pin: GPIO1
|
|
|
|
dir_pin: GPIO2
|
|
|
|
max_speed: 0.1 steps/s
|
|
|
|
acceleration: 10 steps/s^2
|
|
|
|
deceleration: 10 steps/s^2
|
2019-02-13 11:20:22 +01:00
|
|
|
|
|
|
|
interval:
|
|
|
|
interval: 5s
|
|
|
|
then:
|
|
|
|
- logger.log: "Interval Run"
|
2019-04-22 21:56:30 +02:00
|
|
|
- stepper.set_target:
|
|
|
|
id: my_stepper2
|
|
|
|
target: 500
|
|
|
|
- stepper.set_target:
|
|
|
|
id: my_stepper
|
|
|
|
target: !lambda 'return 0;'
|
|
|
|
- stepper.report_position:
|
|
|
|
id: my_stepper2
|
|
|
|
position: 0
|
|
|
|
- stepper.report_position:
|
|
|
|
id: my_stepper
|
|
|
|
position: !lambda 'return 50/100.0;'
|
|
|
|
|
|
|
|
climate:
|
|
|
|
- platform: bang_bang
|
|
|
|
name: Bang Bang Climate
|
|
|
|
sensor: ha_hello_world
|
|
|
|
default_target_temperature_low: 18°C
|
|
|
|
default_target_temperature_high: 24°C
|
|
|
|
idle_action:
|
|
|
|
- switch.turn_on: gpio_switch1
|
|
|
|
cool_action:
|
|
|
|
- switch.turn_on: gpio_switch2
|
|
|
|
heat_action:
|
|
|
|
- switch.turn_on: gpio_switch1
|
|
|
|
away_config:
|
|
|
|
default_target_temperature_low: 16°C
|
|
|
|
default_target_temperature_high: 20°C
|
|
|
|
|
|
|
|
cover:
|
|
|
|
- platform: endstop
|
|
|
|
name: Endstop Cover
|
|
|
|
stop_action:
|
|
|
|
- switch.turn_on: gpio_switch1
|
|
|
|
open_endstop: my_binary_sensor
|
|
|
|
open_action:
|
|
|
|
- switch.turn_on: gpio_switch1
|
|
|
|
open_duration: 5min
|
|
|
|
close_endstop: my_binary_sensor
|
|
|
|
close_action:
|
|
|
|
- switch.turn_on: gpio_switch2
|
|
|
|
- output.set_level:
|
|
|
|
id: out
|
|
|
|
level: 50%
|
|
|
|
- output.esp8266_pwm.set_frequency:
|
|
|
|
id: out
|
|
|
|
frequency: 500.0Hz
|
|
|
|
- output.esp8266_pwm.set_frequency:
|
|
|
|
id: out
|
|
|
|
frequency: !lambda 'return 500.0;'
|
|
|
|
- servo.write:
|
|
|
|
id: my_servo
|
|
|
|
level: -100%
|
|
|
|
- servo.write:
|
|
|
|
id: my_servo
|
|
|
|
level: !lambda 'return -1.0;'
|
|
|
|
- delay: 2s
|
|
|
|
- servo.detach: my_servo
|
|
|
|
close_duration: 4.5min
|
|
|
|
max_duration: 10min
|
|
|
|
- platform: time_based
|
|
|
|
name: Time Based Cover
|
|
|
|
stop_action:
|
|
|
|
- switch.turn_on: gpio_switch1
|
|
|
|
open_action:
|
|
|
|
- switch.turn_on: gpio_switch1
|
|
|
|
open_duration: 5min
|
|
|
|
close_action:
|
|
|
|
- switch.turn_on: gpio_switch2
|
|
|
|
close_duration: 4.5min
|
|
|
|
|
|
|
|
output:
|
|
|
|
- platform: esp8266_pwm
|
|
|
|
id: out
|
|
|
|
pin: D3
|
|
|
|
frequency: 50Hz
|
2019-05-27 09:58:55 +02:00
|
|
|
- platform: custom
|
|
|
|
type: binary
|
|
|
|
lambda: |-
|
|
|
|
auto s = new CustomBinaryOutput();
|
|
|
|
App.register_component(s);
|
|
|
|
return {s};
|
|
|
|
outputs:
|
|
|
|
- id: custom_binary
|
|
|
|
- platform: custom
|
|
|
|
type: float
|
|
|
|
lambda: |-
|
|
|
|
auto s = new CustomFloatOutput();
|
|
|
|
App.register_component(s);
|
|
|
|
return {s};
|
|
|
|
outputs:
|
|
|
|
- id: custom_float
|
2019-04-22 21:56:30 +02:00
|
|
|
|
|
|
|
mcp23017:
|
|
|
|
id: mcp
|
|
|
|
|
|
|
|
light:
|
|
|
|
- platform: neopixelbus
|
|
|
|
name: Neopixelbus Light
|
|
|
|
pin: GPIO1
|
|
|
|
type: GRBW
|
|
|
|
variant: SK6812
|
|
|
|
method: ESP8266_UART0
|
|
|
|
num_leds: 100
|
|
|
|
|
|
|
|
servo:
|
|
|
|
id: my_servo
|
|
|
|
output: out
|
|
|
|
|
|
|
|
ttp229_lsf:
|
2019-05-10 21:44:02 +02:00
|
|
|
|
|
|
|
ttp229_bsf:
|
|
|
|
sdo_pin: D0
|
|
|
|
scl_pin: D1
|