Files
esphome-configs/mcu-eworkbench.yaml
2025-05-02 20:23:18 +02:00

275 lines
5.4 KiB
YAML

substitutions:
device: eworkbench
name: Electronics Workbench
comment: "Office R | Electronics Workbench"
esphome:
name: mcu-${device}
comment: ${comment}
platformio_options:
board_build.flash_mode: dio
esp32:
board: esp32-c3-devkitm-1
variant: esp32c3
framework:
type: esp-idf
version: 5.3.2
platform_version: 53.03.11
packages:
common: !include common/common.yaml
# GPIO20 UART RX, LOGGER
# GPIO21 UART TX, LOGGER
# GPIO9 GPIO
#
# GPIO0 I2C SCL
# GPIO1 I2C SDA
# GPIO2 RGB
# GPIO1 BUTTON
# GPIO4 GPIO
# GPIO5 GPIO
# GPIO6 GPIO
# GPIO7 GPIO
# GPIO8 GPIO
# GPIO10 GPIO
# GPIO18 UART RX
# GPIO19 UART TX
i2c:
- id: i2c_grove
sda: 1
scl: 0
scan: true
# - id: i2c_grove_2
# sda: 19
# scl: 18
# scan: true
uart:
- id: uart_log
rx_pin: 20
tx_pin: 21
baud_rate: 115200
- id: uart_hdmi_switch
rx_pin: 18
tx_pin: 19
baud_rate: 9600
pcf8574:
- id: 'pcf8574_hub'
address: 0x20
pcf8575: true
switch:
- platform: gpio
name: "PCF8574 Pin #0"
pin:
pcf8574: pcf8574_hub
number: 0
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
- platform: gpio
name: "PCF8574 Pin #1"
pin:
pcf8574: pcf8574_hub
number: 1
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
- platform: gpio
name: "PCF8574 Pin #7"
pin:
pcf8574: pcf8574_hub
number: 7
# One of INPUT or OUTPUT
mode:
output: true
inverted: false
binary_sensor:
- platform: gpio
name: "PCF8574 Pin #10"
pin:
pcf8574: pcf8574_hub
number: 8
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #11"
pin:
pcf8574: pcf8574_hub
number: 9
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #12"
pin:
pcf8574: pcf8574_hub
number: 10
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #13"
pin:
pcf8574: pcf8574_hub
number: 11
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #14"
pin:
pcf8574: pcf8574_hub
number: 12
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #15"
pin:
pcf8574: pcf8574_hub
number: 13
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #15"
pin:
pcf8574: pcf8574_hub
number: 14
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
- platform: gpio
name: "PCF8574 Pin #17"
pin:
pcf8574: pcf8574_hub
number: 15
# One of INPUT or OUTPUT
mode: INPUT
inverted: false
# binary_sensor:
# - platform: gpio
# id: rotary_encoder_button
# pin:
# number: 6
# # mode: INPUT_PULLUP
# inverted: true
# filters:
# - delayed_on: 30ms
# - delayed_off: 30ms
# on_press:
# - display_menu.enter:
# display:
# - platform: lcd_pcf8574
# id: my_lcd
# i2c_id: i2c_grove
# dimensions: 20x4
# address: 0x27
# user_characters:
# - position: 0
# data: # mark_back symbol
# - 0b00100
# - 0b01000
# - 0b11110
# - 0b01001
# - 0b00101
# - 0b00001
# - 0b11110
# - 0b00000
# lambda: |-
# id(my_lcd_menu).draw();
# if (!id(my_lcd_menu).is_active())
# it.print("Menu is not active");
# lcd_menu:
# id: my_lcd_menu
# display_id: my_lcd
# active: true
# mode: rotary
# mark_back: 0x08
# mark_selected: 0x3e
# mark_editing: 0x2a
# mark_submenu: 0x7e
# items:
# - type: back
# text: 'Back'
# - type: label
# text: 'Label 1'
# - type: label
# text: !lambda |-
# return "Templated label";
# select:
# - platform: template
# id: hdmi_switch
# optimistic: true
# options:
# - PC1
# - PC2
# - PC3
# - PC4
# initial_option: PC1
# # set_action:
# # - logger.log:
# # format: "Chosen option: %s (index %d)"
# # args: ["x.c_str()", "i"]
# # - uart.write:
# # id: uart_hdmi_switch
# # data: [0x47, 0x30, 0x31, 0x67, 0x41, 0x00]
# sensor:
# - platform: rotary_encoder
# id: rotary_encoder_sensor
# pin_a: 4
# pin_b: 5
# filters:
# debounce: 30ms
# on_anticlockwise:
# - display_menu.up:
# on_clockwise:
# - display_menu.down:
time:
- platform: homeassistant
id: ha_time
timezone: Europe/Bratislava
# display:
# - platform: tm1637
# id: tm1637_display
# clk_pin: 4
# dio_pin: 5
# update_interval: 500ms
# # intensity: 0
# lambda: |-
# static int i = 0;
# i++;
# if (id(alarm_id)) {
# if ((i % 2) == 0)
# it.print("8 8 ");
# else
# it.print(" 8 8");
# } else {
# if (((i / 10) % 2) == 0) {
# //it.set_intensity(7);
# if ((i % 2) == 0)
# it.strftime("%H.%M", id(ha_time).now());
# else
# it.strftime("%H%M", id(ha_time).now());
# } else {
# //it.set_intensity(1);
# it.printf("%.0f~C", id(temperature).state);
# }
# }