Created
August 27, 2022 06:24
-
-
Save jrsmile/747bcc01f7407571a2cbf2f3587245ad to your computer and use it in GitHub Desktop.
esphome basic example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
esphome: | |
name: test | |
esp32: | |
board: esp32dev | |
framework: | |
type: arduino | |
# Enable logging | |
logger: | |
# Enable Home Assistant API | |
api: | |
encryption: | |
key: "" | |
ota: | |
password: "" | |
wifi: | |
ssid: !secret wifi_ssid | |
password: !secret wifi_password | |
# Enable fallback hotspot (captive portal) in case wifi connection fails | |
ap: | |
ssid: "Test Fallback Hotspot" | |
password: "" | |
sensor: | |
- platform: rotary_encoder | |
name: "Rotary Encoder" | |
min_value: 0 | |
max_value: 100 | |
resolution: 2 | |
pin_a: 14 | |
pin_b: 13 | |
switch: | |
- platform: template | |
name: "Mute All Switch" | |
id: mute_all_switch | |
lambda: |- | |
if (id(mute_all_switch).state) { | |
return true; | |
} else { | |
return false; | |
} | |
optimistic: true | |
binary_sensor: | |
- platform: gpio | |
name: "Mute All toggle" | |
id: mute_all | |
pin: | |
number: 15 | |
mode: | |
input: true | |
pullup: true | |
inverted: true | |
filters: | |
- delayed_on: 10ms | |
on_click: | |
then: | |
lambda: !lambda |- | |
if (id(mute_all_switch).state) { | |
id(mute_all_switch).publish_state(false); | |
} else { | |
id(mute_all_switch).publish_state(true); | |
} | |
i2c: | |
sda: 5 | |
scl: 4 | |
font: | |
# gfonts://family[@weight] | |
- file: "gfonts://Roboto" | |
id: roboto | |
size: 20 | |
display: | |
- platform: ssd1306_i2c | |
model: "SSD1306 128x64" | |
address: 0x3C | |
lambda: |- | |
if (id(mute_all_switch).state) { | |
it.print(0, 0, id(roboto), "ALL Muted"); | |
} else { | |
it.print(0, 0, id(roboto), "Party On!"); | |
} | |
captive_portal: | |
esp32_ble_tracker: | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sensor:
name: "Rotary Encoder"
min_value: 0
max_value: 100
resolution: 2
pin_a: 14
pin_b: 13
name: "WiFi Signal"
update_interval: 60s
switch:
name: "Mute All Switch"
id: mute_all_switch
lambda: |-
if (id(mute_all_switch).state) {
return true;
} else {
return false;
}
optimistic: true
binary_sensor:
name: "Mute All toggle"
id: mute_all
pin:
number: 15
mode:
input: true
pullup: true
inverted: true
filters:
on_click:
then:
switch.toggle: mute_all_switch
i2c:
sda: 5
scl: 4
font:
id: roboto
size: 20
display:
platform: ssd1306_i2c
model: "SSD1306 128x64"
address: 0x3C
lambda: |-
if (id(mute_all_switch).state) {
it.print(0, 0, id(roboto), "ALL Muted");
} else {
it.print(0, 0, id(roboto), "Party On!");
}
captive_portal:
#esp32_ble_tracker:
esp32_ble_beacon:
type: iBeacon
uuid: '6650553f-c948-877b-c896-2277da2d3af1'