Created
October 27, 2024 18:15
-
-
Save imduffy15/1e21a78c592429c8be7ee537c089956d to your computer and use it in GitHub Desktop.
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
# Basic device configuration | |
esphome: | |
name: esp32s2_keypad | |
friendly_name: "ESP32-S2 Keypad" | |
platform: ESP32 | |
board: lolin_s2_mini | |
# Add TasmotaDeviceGroupsForESPHome external component | |
external_components: | |
- source: github://cossid/tasmotadevicegroupsforesphome@main | |
components: [ device_groups ] | |
refresh: 10 min | |
# Enable logging | |
logger: | |
level: INFO | |
baud_rate: 115200 | |
# Enable Home Assistant API without authentication | |
api: | |
# Enable OTA updates without password | |
ota: | |
platform: esphome | |
# WiFi configuration with your specific credentials | |
wifi: | |
ssid: "REMOVED" | |
password: "REMOVED" | |
# Enable fallback AP mode without password | |
ap: | |
ssid: "ESP32S3-Keypad Fallback" | |
# Enable Web Server for easy monitoring | |
web_server: | |
port: 80 | |
# MQTT Configuration with your server | |
mqtt: | |
broker: "REMOVED" | |
discovery: true | |
discovery_retain: true | |
# Tasmota Device Groups Configuration | |
device_groups: | |
- group_name: "breakfast_bar" | |
send_mask: 0xFFFFFFFF | |
receive_mask: 0xFFFFFFFF | |
switches: | |
- key1_switch | |
- group_name: "dining_light" | |
send_mask: 0xFFFFFFFF | |
receive_mask: 0xFFFFFFFF | |
switches: | |
- key2_switch | |
- group_name: "sitting_room_light" | |
send_mask: 0xFFFFFFFF | |
receive_mask: 0xFFFFFFFF | |
switches: | |
- key3_switch | |
# Matrix Keypad Configuration as root element | |
matrix_keypad: | |
id: mykeypad | |
rows: | |
- pin: GPIO2 # Free GPIO pin | |
- pin: GPIO5 # Free GPIO pin | |
columns: | |
- pin: GPIO1 # Free GPIO pin | |
- pin: GPIO3 | |
- pin: GPIO4 # Free GPIO pin | |
keys: "123456" | |
has_diodes: false | |
# Binary sensors for each key | |
binary_sensor: | |
- platform: matrix_keypad | |
keypad_id: mykeypad | |
id: key1 | |
row: 0 | |
col: 0 | |
name: "Key 1" | |
on_press: | |
then: | |
- switch.toggle: key1_switch | |
- platform: matrix_keypad | |
keypad_id: mykeypad | |
id: key2 | |
row: 0 | |
col: 1 | |
name: "Key 2" | |
on_press: | |
then: | |
- switch.toggle: key2_switch | |
- platform: matrix_keypad | |
keypad_id: mykeypad | |
id: key3 | |
row: 0 | |
col: 2 | |
name: "Key 3" | |
on_press: | |
then: | |
- switch.toggle: key3_switch | |
- platform: matrix_keypad | |
keypad_id: mykeypad | |
id: key4 | |
row: 1 | |
col: 0 | |
name: "Key 4" | |
on_press: | |
then: | |
- switch.toggle: key4_switch | |
- platform: matrix_keypad | |
keypad_id: mykeypad | |
id: key5 | |
row: 1 | |
col: 1 | |
name: "Key 5" | |
on_press: | |
then: | |
- switch.toggle: key5_switch | |
- platform: matrix_keypad | |
keypad_id: mykeypad | |
id: key6 | |
row: 1 | |
col: 2 | |
name: "Key 6" | |
on_press: | |
then: | |
- switch.toggle: key6_switch | |
# Create template switches for each key | |
switch: | |
- platform: template | |
name: "Key 1 Switch" | |
id: key1_switch | |
optimistic: true | |
restore_mode: ALWAYS_OFF | |
turn_off_action: | |
- logger.log: "Key 1 turned off" | |
turn_on_action: | |
- logger.log: "Key 1 turned on" | |
- platform: template | |
name: "Key 2 Switch" | |
id: key2_switch | |
optimistic: true | |
restore_mode: ALWAYS_OFF | |
turn_off_action: | |
- logger.log: "Key 2 turned off" | |
turn_on_action: | |
- logger.log: "Key 2 turned on" | |
- platform: template | |
name: "Key 3 Switch" | |
id: key3_switch | |
optimistic: true | |
restore_mode: ALWAYS_OFF | |
turn_off_action: | |
- logger.log: "Key 3 turned off" | |
turn_on_action: | |
- logger.log: "Key 3 turned on" | |
- platform: template | |
name: "Key 4 Switch" | |
id: key4_switch | |
optimistic: true | |
restore_mode: ALWAYS_OFF | |
turn_off_action: | |
- logger.log: "Key 4 turned off" | |
turn_on_action: | |
- logger.log: "Key 4 turned on" | |
- platform: template | |
name: "Key 5 Switch" | |
id: key5_switch | |
optimistic: true | |
restore_mode: ALWAYS_OFF | |
turn_off_action: | |
- logger.log: "Key 5 turned off" | |
turn_on_action: | |
- logger.log: "Key 5 turned on" | |
- platform: template | |
name: "Key 6 Switch" | |
id: key6_switch | |
optimistic: true | |
restore_mode: ALWAYS_OFF | |
turn_off_action: | |
- logger.log: "Key 6 turned off" | |
turn_on_action: | |
- logger.log: "Key 6 turned on" | |
# System sensors | |
sensor: | |
# WiFi signal strength sensor | |
- platform: wifi_signal | |
name: "WiFi Signal Strength" | |
update_interval: 60s | |
# Uptime sensor | |
- platform: uptime | |
name: "Uptime" | |
update_interval: 60s | |
# Button to trigger actions (optional) | |
button: | |
- platform: restart | |
name: "Restart Device" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment