mirror of
https://github.com/randybb/esphome-configs.git
synced 2026-12-06 09:06:52 +01:00
mcu-trainer: rename trainer devices, add mcu-trainer-ant
mcu-lvgl-trainer -> mcu-trainer, mcu-dimmer -> mcu-trainer-fan (Trainer Fan). mcu-trainer-ant: ANT+ receiver on an Ebyte E104-BT5040U dongle (Open DFU), without USB since the USB stack holds HFCLK and RadiANT can't start the HFXO. mcu-trainer receives its values over UART (GPIO17/18) with packet_transport.
This commit is contained in:
1 parent
2acb5c8506
commit
27cbbbe217
5 files changed
+488
-6
No files matched your search
@@ -0,0 +1,202 @@
|
||||
---
|
||||
# Hardware: M5Stack M5Stamp Pico
|
||||
# Pinout:
|
||||
# GPIO22 -> dimmer1 (output ac_dimmer gate_pin)
|
||||
# GPIO25 -> dimmer1 (output ac_dimmer zero_cross_pin) (inverted)
|
||||
# GPIO27 -> LED (light esp32_rmt_led_strip)
|
||||
# GPIO32 Grove SDA
|
||||
# GPIO33 Grove SCL
|
||||
substitutions:
|
||||
device: trainer-fan
|
||||
name: Trainer Fan
|
||||
area: Basement
|
||||
comment: Pain cave fan
|
||||
|
||||
esphome:
|
||||
name: mcu-${device}
|
||||
friendly_name: ${name}
|
||||
area: ${area}
|
||||
comment: ${comment}
|
||||
on_loop:
|
||||
then:
|
||||
lambda: |-
|
||||
static uint32_t last_state = 0;
|
||||
auto state = App.get_app_state();
|
||||
if (state != last_state) {
|
||||
if (state & STATUS_LED_ERROR) {
|
||||
id(led).turn_on().set_effect('ERROR').perform();
|
||||
} else if (state & STATUS_LED_WARNING) {
|
||||
id(led).turn_on().set_effect('BOOT').perform();
|
||||
} else {
|
||||
id(led).turn_off().perform();
|
||||
}
|
||||
last_state = state;
|
||||
}
|
||||
|
||||
esp32:
|
||||
variant: esp32
|
||||
toolchain: esp-idf
|
||||
framework:
|
||||
advanced:
|
||||
flash_chip: gd
|
||||
type: esp-idf
|
||||
|
||||
packages:
|
||||
common: !include common/common.yaml
|
||||
ipv6_only: !include common/ipv6_only.yaml
|
||||
|
||||
# fan:
|
||||
# - platform: speed
|
||||
# output: fan_dimmer1
|
||||
# id: fan1
|
||||
# name: Exercise Room
|
||||
# speed_count: 5
|
||||
# preset_modes:
|
||||
# - 50%
|
||||
# - 60%
|
||||
# - 70%
|
||||
# - 80%
|
||||
# - 90%
|
||||
# - 100%
|
||||
# on_preset_set:
|
||||
# then:
|
||||
# - fan.turn_on:
|
||||
# id: fan1
|
||||
# speed: !lambda |-
|
||||
# return x.c_str();
|
||||
# # default_transition_length: 10s
|
||||
|
||||
button:
|
||||
- platform: template
|
||||
name: Exercise Room Fan 50 %
|
||||
on_press:
|
||||
then:
|
||||
- output.set_level:
|
||||
id: dimmer1
|
||||
level: 50%
|
||||
- platform: template
|
||||
name: Exercise Room Fan 60 %
|
||||
on_press:
|
||||
then:
|
||||
- output.set_level:
|
||||
id: dimmer1
|
||||
level: 60%
|
||||
- platform: template
|
||||
name: Exercise Room Fan 70 %
|
||||
on_press:
|
||||
then:
|
||||
- output.set_level:
|
||||
id: dimmer1
|
||||
level: 70%
|
||||
- platform: template
|
||||
name: Exercise Room Fan 80 %
|
||||
on_press:
|
||||
then:
|
||||
- output.set_level:
|
||||
id: dimmer1
|
||||
level: 80%
|
||||
- platform: template
|
||||
name: Exercise Room Fan 90 %
|
||||
on_press:
|
||||
then:
|
||||
- output.set_level:
|
||||
id: dimmer1
|
||||
level: 90%
|
||||
- platform: template
|
||||
name: Exercise Room Fan 100 %
|
||||
on_press:
|
||||
then:
|
||||
- output.set_level:
|
||||
id: dimmer1
|
||||
level: 100%
|
||||
- platform: template
|
||||
name: Exercise Room Fan +10 %
|
||||
on_press:
|
||||
then:
|
||||
- light.dim_relative:
|
||||
id: fan_dimmer1
|
||||
relative_brightness: 10%
|
||||
- platform: template
|
||||
name: Exercise Room Fan -10 %
|
||||
on_press:
|
||||
then:
|
||||
- light.dim_relative:
|
||||
id: fan_dimmer1
|
||||
relative_brightness: -10%
|
||||
|
||||
light:
|
||||
- platform: monochromatic
|
||||
output: dimmer1
|
||||
id: fan_dimmer1
|
||||
name: Exercise Room Fan
|
||||
default_transition_length: 10s
|
||||
- platform: esp32_rmt_led_strip
|
||||
name: LED
|
||||
id: led
|
||||
channel_colors: GRB
|
||||
pin: 27
|
||||
num_leds: 1
|
||||
# rmt_channel: 0
|
||||
chipset: ws2812
|
||||
restore_mode: ALWAYS_OFF
|
||||
effects:
|
||||
- strobe:
|
||||
name: "BEACON"
|
||||
colors:
|
||||
- state: true
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 50%
|
||||
duration: 200ms
|
||||
- state: false
|
||||
duration: 200ms
|
||||
- state: true
|
||||
red: 0%
|
||||
green: 0%
|
||||
blue: 50%
|
||||
duration: 200ms
|
||||
- state: false
|
||||
duration: 10s
|
||||
- lambda:
|
||||
name: "ERROR"
|
||||
update_interval: 0.5s
|
||||
lambda: |-
|
||||
static bool state = false;
|
||||
auto call = id(led).turn_on();
|
||||
call.set_transition_length(500);
|
||||
call.set_rgb(1, 0, 0);
|
||||
if (!state) {
|
||||
call.set_brightness(1);
|
||||
} else {
|
||||
// If using 0, it freaks Home Assistant UI.
|
||||
call.set_brightness(0.01);
|
||||
}
|
||||
call.perform();
|
||||
state = !state;
|
||||
- lambda:
|
||||
name: "BOOT"
|
||||
update_interval: 0.5s
|
||||
lambda: |-
|
||||
static bool state = false;
|
||||
auto call = id(led).turn_on();
|
||||
call.set_transition_length(500);
|
||||
call.set_rgb(0, 1, 0);
|
||||
if (!state) {
|
||||
call.set_brightness(1);
|
||||
} else {
|
||||
// If using 0, it freaks Home Assistant UI.
|
||||
call.set_brightness(0.01);
|
||||
}
|
||||
call.perform();
|
||||
state = !state;
|
||||
|
||||
output:
|
||||
- platform: ac_dimmer
|
||||
id: dimmer1
|
||||
# min_power: 0.60
|
||||
# zero_means_zero: true
|
||||
gate_pin: 22
|
||||
zero_cross_pin:
|
||||
number: 25
|
||||
mode: INPUT
|
||||
inverted: yes
|
||||
Reference in new issue
Block a user