20240410
This commit is contained in:
66
esphome/cfg_offline/sonofbasic-01.yaml
Normal file
66
esphome/cfg_offline/sonofbasic-01.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
substitutions:
|
||||
device_name: "sonofbasic-01"
|
||||
friendly_name: "sonofbasic-01"
|
||||
comment: "esp8266"
|
||||
location: "Tuin"
|
||||
api_password: !secret SonofBasic-01_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret SonofBasic-01_ip
|
||||
pin_status: GPIO13
|
||||
pin_relay: GPIO12
|
||||
pin_button: GPIO0
|
||||
|
||||
# GPIO0 Button (inverted)
|
||||
# GPIO1 TX pin (C1 Pin 2)
|
||||
# GPIO3 RX pin (C1 Pin 3)
|
||||
# GPIO12 Relay
|
||||
# GPIO13 Green LED (inverted)
|
||||
# GPIO14 Optional Sensor (C1 Pin 5)
|
||||
|
||||
packages:
|
||||
board: !include boards/esp8266_sonofBasic.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi_noportal.yaml
|
||||
status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: ${pin_button}
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
inverted: true
|
||||
name: "Sonoff Basic Button"
|
||||
on_press:
|
||||
- light.toggle: lamp_relay
|
||||
|
||||
# switch:
|
||||
# - platform: gpio
|
||||
# name: "Sonoff Basic Relay"
|
||||
# pin: ${pin_relay}
|
||||
# id: relay
|
||||
# device_class: light
|
||||
|
||||
output:
|
||||
- platform: gpio
|
||||
pin: ${pin_relay}
|
||||
id: relay
|
||||
|
||||
light:
|
||||
- platform: binary
|
||||
name: "Sonoff Basic"
|
||||
output: relay
|
||||
id: lamp_relay
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
|
||||
|
||||
status_led:
|
||||
pin:
|
||||
number: ${pin_status}
|
||||
inverted: yes
|
||||
83
esphome/cfg_offline/sonofbasic-02.yaml
Normal file
83
esphome/cfg_offline/sonofbasic-02.yaml
Normal file
@@ -0,0 +1,83 @@
|
||||
substitutions:
|
||||
device_name: "sonofbasic-02"
|
||||
friendly_name: "sonofbasic-02"
|
||||
comment: "esp8266"
|
||||
location: "Tuin"
|
||||
api_password: !secret SonofBasic-02_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret SonofBasic-02_ip
|
||||
pin_status: GPIO13
|
||||
pin_relay: GPIO12
|
||||
pin_button: GPIO0
|
||||
|
||||
# GPIO0 Button (inverted)
|
||||
# GPIO1 TX pin (C1 Pin 2)
|
||||
# GPIO3 RX pin (C1 Pin 3)
|
||||
# GPIO12 Relay
|
||||
# GPIO13 Green LED (inverted)
|
||||
# GPIO14 Optional Sensor (C1 Pin 5)
|
||||
|
||||
packages:
|
||||
board: !include boards/esp8266_sonofBasic.yaml
|
||||
device_base: !include common/common.yaml
|
||||
connection: !include common/wifi_noportal.yaml
|
||||
status: !include templates/status.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: ${pin_button}
|
||||
mode:
|
||||
input: true
|
||||
pullup: true
|
||||
inverted: true
|
||||
name: "Sonoff Basic Button"
|
||||
on_press:
|
||||
- switch.toggle: relay
|
||||
|
||||
switch:
|
||||
- platform: gpio
|
||||
name: "Sonoff Basic Relay"
|
||||
pin: ${pin_relay}
|
||||
id: relay
|
||||
|
||||
status_led:
|
||||
pin:
|
||||
number: ${pin_status}
|
||||
inverted: yes
|
||||
|
||||
|
||||
# esphome:
|
||||
# name: sonofbasic-02
|
||||
# friendly_name: sonofbasic-02
|
||||
|
||||
# esp8266:
|
||||
# board: esp01_1m
|
||||
|
||||
# # Enable logging
|
||||
# logger:
|
||||
|
||||
# # Enable Home Assistant API
|
||||
# api:
|
||||
# encryption:
|
||||
# key: "48SvU7npQIluo9PR6xGOmOsXoAKyr7kX1YYjLEXful8="
|
||||
|
||||
# ota:
|
||||
# password: "1900b4474c00a32b76ddc2c550857eff"
|
||||
|
||||
# wifi:
|
||||
# ssid: !secret wifi_ssid
|
||||
# password: !secret wifi_password
|
||||
|
||||
# # Enable fallback hotspot (captive portal) in case wifi connection fails
|
||||
# ap:
|
||||
# ssid: "Sonofbasic-02 Fallback Hotspot"
|
||||
# password: "aUsjAjSOix4j"
|
||||
|
||||
# captive_portal:
|
||||
|
||||
119
esphome/cfg_offline/voiceassist.yaml
Normal file
119
esphome/cfg_offline/voiceassist.yaml
Normal file
@@ -0,0 +1,119 @@
|
||||
substitutions:
|
||||
device_name: "voiceassist1"
|
||||
friendly_name: "ESP32 voice Assist 1"
|
||||
comment: "esp32, mic, dac, Btn"
|
||||
api_password: !secret voiceassist1_api
|
||||
ota_password: !secret ota_password
|
||||
wifi_ssid: !secret wifi_ssid
|
||||
wifi_password: !secret wifi_password
|
||||
gateway: !secret ip_gateway
|
||||
subnet: !secret ip_subnet
|
||||
ip: !secret voiceassist1_ip
|
||||
pin_lrclk: GPIO19
|
||||
pin_bclk: GPIO18
|
||||
pin_i2sdin: GPIO23
|
||||
pin_i2sdout: GPIO5
|
||||
pin_button: GPIO14
|
||||
pin_LEDS: GPIO27
|
||||
|
||||
packages:
|
||||
connection: !include common/wifi.yaml
|
||||
logger: !include templates/logger.yaml
|
||||
|
||||
|
||||
esphome:
|
||||
name: ${device_name}
|
||||
friendly_name: ${friendly_name}
|
||||
project:
|
||||
name: esp32.voice-assistant
|
||||
version: "1.0"
|
||||
min_version: 2023.10.0
|
||||
on_boot:
|
||||
- priority: -100
|
||||
then:
|
||||
- wait_until: api.connected
|
||||
- delay: 1s
|
||||
- if:
|
||||
condition:
|
||||
switch.is_on: use_wake_word
|
||||
then:
|
||||
- voice_assistant.start_continuous:
|
||||
|
||||
esp32:
|
||||
board: esp32dev
|
||||
framework:
|
||||
type: esp-idf
|
||||
|
||||
improv_serial:
|
||||
|
||||
i2s_audio:
|
||||
i2s_lrclk_pin: ${pin_lrclk}
|
||||
i2s_bclk_pin: ${pin_bclk}
|
||||
|
||||
microphone:
|
||||
- platform: i2s_audio
|
||||
id: mic
|
||||
i2s_din_pin: ${pin_i2sdin}
|
||||
adc_type: external
|
||||
pdm: false
|
||||
|
||||
speaker:
|
||||
- platform: i2s_audio
|
||||
id: big_speaker
|
||||
i2s_dout_pin: ${pin_i2sdout}
|
||||
dac_type: external
|
||||
mode: mono
|
||||
|
||||
voice_assistant:
|
||||
microphone: mic
|
||||
use_wake_word: false
|
||||
noise_suppression_level: 2
|
||||
auto_gain: 31dBFS
|
||||
volume_multiplier: 2.0
|
||||
speaker: big_speaker
|
||||
id: assist
|
||||
|
||||
binary_sensor:
|
||||
- platform: gpio
|
||||
pin:
|
||||
number: ${pin_button}
|
||||
inverted: true
|
||||
name: Button
|
||||
disabled_by_default: true
|
||||
entity_category: diagnostic
|
||||
id: echo_button
|
||||
on_click:
|
||||
- if:
|
||||
condition:
|
||||
switch.is_off: use_wake_word
|
||||
then:
|
||||
- if:
|
||||
condition: voice_assistant.is_running
|
||||
then:
|
||||
- voice_assistant.stop:
|
||||
else:
|
||||
- voice_assistant.start:
|
||||
else:
|
||||
- voice_assistant.stop
|
||||
- delay: 1s
|
||||
|
||||
- voice_assistant.start_continuous:
|
||||
|
||||
switch:
|
||||
- platform: template
|
||||
name: Use wake word
|
||||
id: use_wake_word
|
||||
optimistic: true
|
||||
restore_mode: RESTORE_DEFAULT_ON
|
||||
entity_category: config
|
||||
on_turn_on:
|
||||
- lambda: id(assist).set_use_wake_word(true);
|
||||
- if:
|
||||
condition:
|
||||
not:
|
||||
- voice_assistant.is_running
|
||||
then:
|
||||
- voice_assistant.start_continuous
|
||||
on_turn_off:
|
||||
- voice_assistant.stop
|
||||
- lambda: id(assist).set_use_wake_word(false);
|
||||
Reference in New Issue
Block a user