Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- substitutions:
- device_name: "archerintercom2"
- short_name: "Archer Intercom 2"
- # ESP32 Pin Allocations
- rgb_led_pin: "GPIO33" # WS2811 addressable RGB LED
- pot_power_pin: "GPIO19" # Amplifier Button (inverted)
- talk_button_pin: "GPIO23" # Amplifier Button (inverted)
- pot_pin: "GPIO39" # Pin "SVN" aka GPIO39 - wiper of 10k pot tween 3.3v and gnd
- led1_pin: "GPIO2" # Blue LED internal (inverted)
- gain_pin: "GPIO25" # used to adjust the gain of the player
- i2s_out_lrclk_pin: "GPIO21" # \
- i2s_out_bclk_pin: "GPIO22" # | I2S out (speaker)
- i2s_dout_audio: "GPIO27" # /
- i2s_in_lrclk_pin: "GPIO16" # \ WS
- i2s_in_bclk_pin: "GPIO17" # | CLK INMP441 I2S in (mic)
- i2s_din_audio: "GPIO35" # / SD
- # IP info
- use_this_ip: "192.168.xxx.xxx"
- use_this_gateway: "192.168.xxx.xxx"
- use_this_subnet: "255.255.255.0"
- use_this_dns1: "8.8.8.8"
- esphome:
- # Code to reset the auth password on device
- # on_boot:
- # - lambda: |-
- # id(my_ota).set_auth_password("31fbaa7c32760017dceb3b922c92d4de");
- name: "${device_name}"
- friendly_name: "${short_name}"
- esp32:
- board: esp32dev
- framework:
- type: arduino
- # Enable logging
- logger:
- logs:
- # levels include NONE, ERROR, WARN, INFO, DEBUG
- component: ERROR
- # Enable Home Assistant API
- api:
- encryption:
- key: !secret esphome_encryption_key
- ota:
- - platform: esphome
- password: !secret esphome_ota_password
- id: my_ota
- wifi:
- networks:
- - ssid: !secret graner_ssid
- password: !secret graner_password
- - ssid: !secret aca_ssid
- password: !secret aca_password
- power_save_mode: NONE
- # Enable fallback hotspot (captive portal) in case wifi connection fails
- ap:
- ssid: "${device_name} FB"
- password: !secret esphome_fallback_password
- # manual_ip:
- # static_ip: "${use_this_ip}"
- # gateway: "${use_this_gateway}"
- # subnet: "${use_this_subnet}"
- # dns1: "${use_this_dns1}"
- # setup a web page for quick control this eats a LOT of memory. Best to use only for debug
- web_server:
- port: 80
- version: 3
- captive_portal:
- button:
- - platform: restart
- icon: mdi:power-cycle
- name: "ESP Reboot"
- switch:
- - platform: gpio
- id: gain_boost
- name: "Gain Boost"
- inverted: True
- pin: "${gain_pin}"
- restore_mode: ALWAYS_ON
- sensor:
- - platform: adc
- pin:
- number: "${pot_pin}"
- mode:
- input: true
- pullup: False
- name: "Volume Pot"
- id: my_sensor
- attenuation: auto
- update_interval: 15s
- # Reports internal temperature of the ESP32
- - platform: internal_temperature
- name: "Internal Temperature"
- entity_category: "diagnostic"
- update_interval: 30s
- # Reports uptime
- - platform: uptime
- name: Uptime
- entity_category: "diagnostic"
- update_interval: 300s
- # Reports WiFi signal strength
- - platform: wifi_signal
- name: "WiFi Signal"
- accuracy_decimals: 1
- entity_category: "diagnostic"
- update_interval: 5s
- binary_sensor:
- # Button section normally open closed to ground as ESP pins have weak pull-up power
- - platform: gpio
- name: Power Switch
- pin:
- number: "${pot_power_pin}"
- mode:
- input: true
- pullup: true
- inverted: true
- filters:
- - delayed_off: 20ms
- on_press:
- - logger.log: Knob Power ON
- # - display.page.show_next: oled_display
- # - component.update: oled_display
- - platform: gpio
- name: Talk Button
- pin:
- number: "${talk_button_pin}"
- mode:
- input: true
- pullup: true
- inverted: true
- filters:
- - delayed_off: 20ms
- on_press:
- - logger.log: Talk Button Pressed
- # - display.page.show_next: oled_display
- # - component.update: oled_display
- on_release:
- - logger.log: Talk Button Released
- # Update LED status based on alarm loop state
- - platform: homeassistant
- name: "Loop Status"
- id: loop1_status
- entity_id: binary_sensor.alarm_house_door_window_sensors
- publish_initial_state: True
- on_state:
- then:
- script.execute: update_led
- # System status report for ONLINE or OFFLINE display
- - platform: status
- name: "Node Status"
- id: system_status
- publish_initial_state: True
- on_state:
- then:
- - script.execute: update_led
- # Example configuration entry
- script:
- - id: update_led
- then:
- - lambda: |-
- if (!id(system_status).state)
- id(alert_light).turn_on().set_rgb(0, 0, 1).set_brightness(0.5).set_effect("Fast Pulse").perform();
- else if (!id(loop1_status).state)
- id(alert_light).turn_on().set_rgb(0, 1, 0).set_brightness(0.25).set_effect("None").perform();
- else
- id(alert_light).turn_off().perform();
- # Single Neopixel LED
- light:
- - platform: neopixelbus
- type: GRB
- variant: WS2811
- pin: "${rgb_led_pin}"
- num_leds: 1
- name: "Alert Light"
- id: alert_light
- default_transition_length: 0s
- effects:
- - pulse:
- name: "Slow Pulse"
- transition_length:
- on_length: 500ms
- off_length: 500ms
- update_interval: 1s
- - pulse:
- name: "Fast Pulse"
- transition_length:
- on_length: 250ms
- off_length: 250ms
- update_interval: 500ms
- # This allows the on-board blue LED to indicate conneciton and other status
- status_led:
- pin:
- number: "${led1_pin}"
- inverted: False
- # I2S pin config
- i2s_audio:
- - id: i2s_out
- i2s_lrclk_pin: "${i2s_out_lrclk_pin}"
- i2s_bclk_pin: "${i2s_out_bclk_pin}"
- - id: i2s_in
- i2s_lrclk_pin: "${i2s_in_lrclk_pin}" # WS
- i2s_bclk_pin: "${i2s_in_bclk_pin}" # CLK
- # Media player configuration
- media_player:
- - platform: i2s_audio
- name: ESPHome I2S Media Player
- dac_type: external
- i2s_audio_id: i2s_out
- i2s_dout_pin: "${i2s_dout_audio}"
- mode: mono
- on_pause:
- - media_player.stop
- # Microphone configuration
- microphone:
- - platform: i2s_audio
- i2s_audio_id: i2s_in
- i2s_din_pin: "${i2s_din_audio}" # SD
- adc_type: external
- id: mic_i2s
- pdm: false
- # Voice assistant configuration
- voice_assistant:
- microphone: mic_i2s
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement