Compare commits

...

6 Commits

16 changed files with 352 additions and 100 deletions

View File

@ -1 +1 @@
2024.10.2
2025.1.0

View File

@ -68,29 +68,28 @@
- id: '1623673821789'
alias: Gute Nacht!
description: Schalte alles (außer Schlafzimmer) aus, sobald das Schlaftracking startet.
trigger:
- platform: state
entity_id: input_text.sleep_as_android
triggers:
- entity_id: input_text.sleep_as_android
to: sleep_tracking_started
condition: []
action:
- service: light.turn_off
target:
trigger: state
conditions: []
actions:
- target:
area_id:
- wohnzimmer
- kuche
- schlafzimmer
- kinderzimmer
data: {}
action: light.turn_off
- type: turn_off
device_id: 6d1be741876624a70ab5b01b54c6fd6f
entity_id: switch.kuche_musik
domain: switch
- service: notify.mobile_app_le2123
data:
- data:
message: Gute Nacht!
- service: media_player.play_media
target:
action: notify.mobile_app_le2123
- target:
entity_id: media_player.raspiaudio_muse_luxe
data:
media_content_id: media-source://tts/tts.piper?message=Gute+Nacht%2C+schlaf+gut.
@ -106,15 +105,20 @@
media_content_id: media-source://tts
- media_content_type: provider
media_content_id: media-source://tts/tts.piper?message=Gute+Nacht%2C+schlaf+gut.
- type: turn_off
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
- service: media_player.turn_off
target:
action: media_player.play_media
- target:
area_id:
- wohnzimmer
data: {}
action: media_player.turn_off
- action: switch.turn_off
metadata: {}
data: {}
target:
device_id:
- 1f3c4b5de4aea99bac83688ceb22293b
- 48dafb7f4a8ed6ccbb046758cb660c23
- c4ead7f6227e2ee4c43c4b0df829cd84
mode: single
- id: '1623868115464'
alias: 420!
@ -741,31 +745,34 @@
- id: '1700482951854'
alias: Licht bei Sonnenuntergang einschalten (XMas)
description: ''
trigger:
- platform: sun
event: sunset
triggers:
- event: sunset
offset: '-1:00'
condition:
trigger: sun
conditions:
- condition: state
entity_id: person.marcus_scholz
state: home
action:
actions:
- data: {}
action: script.moodlight_xmas
- type: turn_on
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
- action: switch.turn_on
metadata: {}
data: {}
target:
device_id:
- 1f3c4b5de4aea99bac83688ceb22293b
- 48dafb7f4a8ed6ccbb046758cb660c23
mode: single
- id: '1700483035319'
alias: Licht bei Sonnenaufgang ausschalten (XMas)
description: ''
trigger:
- platform: sun
event: sunrise
triggers:
- event: sunrise
offset: '+1:00'
condition: []
action:
trigger: sun
conditions: []
actions:
- target:
area_id:
- schlafzimmer
@ -782,11 +789,13 @@
data:
transition: 2
action: light.turn_off
- type: turn_off
device_id: c4ead7f6227e2ee4c43c4b0df829cd84
entity_id: 7f7284b11f2bf50ae2f0ebeeb35411c0
domain: switch
enabled: true
- action: switch.turn_off
metadata: {}
data: {}
target:
device_id:
- 1f3c4b5de4aea99bac83688ceb22293b
- 48dafb7f4a8ed6ccbb046758cb660c23
mode: single
- id: '1701774106609'
alias: IKEA STYRBAR Wohnzimmer

View File

@ -0,0 +1,27 @@
blueprint:
name: Invert a binary sensor
description: Creates a binary_sensor which holds the inverted value of a reference binary_sensor
domain: template
source_url: https://github.com/home-assistant/core/blob/dev/homeassistant/components/template/blueprints/inverted_binary_sensor.yaml
input:
reference_entity:
name: Binary sensor to be inverted
description: The binary_sensor which needs to have its value inverted
selector:
entity:
domain: binary_sensor
variables:
reference_entity: !input reference_entity
binary_sensor:
state: >
{% if states(reference_entity) == 'on' %}
off
{% elif states(reference_entity) == 'off' %}
on
{% else %}
{{ states(reference_entity) }}
{% endif %}
# delay_on: not_used in this example
# delay_off: not_used in this example
# auto_off: not_used in this example
availability: "{{ states(reference_entity) not in ('unknown', 'unavailable') }}"

View File

@ -42,16 +42,34 @@ ota:
platform: esphome
password: !secret ota
# Initialize I²C
i2c:
- id: bus_a
sda: 6
scl: 7
scan: true
# DHT22 sensor
sensor:
- platform: dht
model: dht22
pin: 4
temperature:
name: "Badezimmer Temperatur DHT"
humidity:
name: "Badezimmer Luftfeuchtigkeit DHT"
update_interval: 60s
- platform: sht3xd
temperature:
name: "Badezimmer Temperatur"
filters:
- offset: -4.4
humidity:
name: "Badezimmer Luftfeuchtigkeit"
address: 0x44
heater_enabled: True
update_interval: 60s
# WiFi signal strength
- platform: wifi_signal
name: "WiFi Signalstärke"

View File

@ -7,14 +7,14 @@ esphome:
friendly_name: ${friendly_name}
name_add_mac_suffix: False
project:
name: m5stack.atom-echo
version: "1.0"
min_version: 2023.5.0
name: m5stack.atom-echo-voice-assistant
version: "24.7.24"
min_version: 2024.9.0
esp32:
board: m5stack-atom
framework:
type: arduino
type: esp-idf
# Enable Home Assistant API
api:
@ -22,10 +22,26 @@ api:
key: !secret apikey
ota:
platform: esphome
password: !secret ota
- platform: esphome
password: !secret ota
id: ota_esphome
- platform: http_request
id: ota_http_request
update:
- platform: http_request
id: update_http_request
name: Firmware
source: https://firmware.esphome.io/voice-assistant/m5stack-atom-echo/manifest.json
http_request:
wifi:
on_connect:
- delay: 5s # Gives time for improv results to be transmitted
- ble.disable:
on_disconnect:
- ble.enable:
ssid: Voltage-legacy
password: !secret voltage_legacy_psk
use_address: ${name}.home
@ -36,18 +52,30 @@ wifi:
ssid: "Raspiaudio Fallback Hotspot"
password: !secret fallback_psk
improv_serial:
esp32_improv:
authorizer: none
logger:
dashboard_import:
package_import_url: github://esphome/media-players/m5stack-atom-echo.yaml@main
package_import_url: github://esphome/firmware/voice-assistant/m5stack-atom-echo.adopted.yaml@main
captive_portal:
improv_serial:
button:
- platform: safe_mode
id: button_safe_mode
name: Safe Mode Boot
- platform: factory_reset
id: factory_reset_btn
name: Factory reset
i2s_audio:
i2s_lrclk_pin: GPIO33
i2s_bclk_pin: GPIO19
- id: i2s_audio_bus
i2s_lrclk_pin: GPIO33
i2s_bclk_pin: GPIO19
microphone:
- platform: i2s_audio
@ -56,45 +84,103 @@ microphone:
adc_type: external
pdm: true
speaker:
- platform: i2s_audio
id: echo_speaker
i2s_dout_pin: GPIO22
dac_type: external
channel: mono
voice_assistant:
id: va
microphone: echo_microphone
on_start:
speaker: echo_speaker
noise_suppression_level: 2
auto_gain: 31dBFS
volume_multiplier: 2.0
vad_threshold: 3
on_listening:
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
effect: none
effect: "Slow Pulse"
on_stt_vad_end:
- light.turn_on:
id: led
blue: 100%
red: 0%
green: 0%
effect: "Fast Pulse"
on_tts_start:
- light.turn_on:
id: led
blue: 0%
blue: 100%
red: 0%
green: 100%
green: 0%
brightness: 100%
effect: none
on_tts_end:
- media_player.play_media: !lambda return x;
- light.turn_on:
id: led
blue: 0%
red: 0%
green: 100%
effect: pulse
on_end:
- delay: 1s
- delay: 100ms
- wait_until:
not:
media_player.is_playing: media_out
- light.turn_off: led
speaker.is_playing:
- script.execute: reset_led
on_error:
- light.turn_on:
id: led
blue: 0%
red: 100%
green: 0%
blue: 0%
brightness: 100%
effect: none
- delay: 1s
- script.execute: reset_led
on_client_connected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
- script.execute: reset_led
on_client_disconnected:
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.stop:
- light.turn_off: led
on_timer_finished:
- voice_assistant.stop:
- switch.turn_on: timer_ringing
- wait_until:
not:
microphone.is_capturing:
- light.turn_on:
id: led
red: 0%
green: 100%
blue: 0%
brightness: 100%
effect: "Fast Pulse"
- while:
condition:
switch.is_on: timer_ringing
then:
- lambda: id(echo_speaker).play(id(timer_finished_wave_file), sizeof(id(timer_finished_wave_file)));
- delay: 1s
- wait_until:
not:
speaker.is_playing:
- light.turn_off: led
- switch.turn_off: timer_ringing
- if:
condition:
switch.is_on: use_wake_word
then:
- voice_assistant.start_continuous:
- script.execute: reset_led
binary_sensor:
- platform: gpio
@ -102,35 +188,48 @@ binary_sensor:
number: GPIO39
inverted: true
name: Button
disabled_by_default: true
entity_category: diagnostic
id: echo_button
on_multi_click:
- timing:
- ON FOR AT MOST 350ms
- OFF FOR AT LEAST 10ms
- ON for at least 50ms
- OFF for at least 50ms
then:
- media_player.toggle: media_out
- if:
condition:
switch.is_on: timer_ringing
then:
- switch.turn_off: timer_ringing
else:
- if:
condition:
switch.is_off: use_wake_word
then:
- if:
condition: voice_assistant.is_running
then:
- voice_assistant.stop:
- script.execute: reset_led
else:
- voice_assistant.start:
else:
- voice_assistant.stop
- delay: 1s
- script.execute: reset_led
- script.wait: reset_led
- voice_assistant.start_continuous:
- timing:
- ON FOR AT LEAST 350ms
- ON for at least 10s
then:
- voice_assistant.start:
- timing:
- ON FOR AT LEAST 350ms
- OFF FOR AT LEAST 10ms
then:
- voice_assistant.stop:
media_player:
- platform: i2s_audio
id: media_out
name: None
dac_type: external
i2s_dout_pin: GPIO22
mode: mono
- button.press: factory_reset_btn
light:
- platform: esp32_rmt_led_strip
id: led
name: None
disabled_by_default: true
entity_category: config
pin: GPIO27
default_transition_length: 0s
chipset: SK6812
@ -139,5 +238,89 @@ light:
rmt_channel: 0
effects:
- pulse:
name: "Slow Pulse"
transition_length: 250ms
update_interval: 250ms
update_interval: 250ms
min_brightness: 50%
max_brightness: 100%
- pulse:
name: "Fast Pulse"
transition_length: 100ms
update_interval: 100ms
min_brightness: 50%
max_brightness: 100%
script:
- id: reset_led
then:
- if:
condition:
- switch.is_on: use_wake_word
- switch.is_on: use_listen_light
then:
- light.turn_on:
id: led
red: 100%
green: 89%
blue: 71%
brightness: 60%
effect: none
else:
- light.turn_off: led
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(va).set_use_wake_word(true);
- if:
condition:
not:
- voice_assistant.is_running
then:
- voice_assistant.start_continuous
- script.execute: reset_led
on_turn_off:
- voice_assistant.stop
- lambda: id(va).set_use_wake_word(false);
- script.execute: reset_led
- platform: template
name: Use listen light
id: use_listen_light
optimistic: true
restore_mode: RESTORE_DEFAULT_ON
entity_category: config
on_turn_on:
- script.execute: reset_led
on_turn_off:
- script.execute: reset_led
- platform: template
id: timer_ringing
optimistic: true
internal: true
restore_mode: ALWAYS_OFF
on_turn_on:
- delay: 15min
- switch.turn_off: timer_ringing
external_components:
- source: github://pr#5230
components:
- esp_adf
refresh: 0s
- source:
type: git
url: https://github.com/jesserockz/esphome-components
ref: main
components: [file]
refresh: 0s
esp_adf:
file:
- id: timer_finished_wave_file
file: https://github.com/esphome/firmware/raw/main/voice-assistant/sounds/timer_finished.wav

View File

@ -8,8 +8,9 @@ api:
key: !secret apikey
ota:
platform: esphome
password: !secret ota
- platform: esphome
id: ota_esphome
password: !secret ota
wifi:
ssid: Voltage-legacy
@ -29,7 +30,7 @@ esphome:
project:
name: raspiaudio.muse-luxe
version: "1.0"
min_version: 2023.5.0
min_version: 2024.6.0
on_boot:
then:
- media_player.volume_set:
@ -44,25 +45,25 @@ esp32:
logger:
i2c:
sda: GPIO18
scl: GPIO23
- id: i2c_bus
sda: GPIO18
scl: GPIO23
dashboard_import:
package_import_url: github://esphome/media-players/raspiaudio-muse-luxe.yaml@main
captive_portal:
improv_serial:
external_components:
- source: github://pr#3552 # DAC support https://github.com/esphome/esphome/pull/3552
- source: github://pr#3552 # DAC support https://github.com/esphome/esphome/pull/3552
components: [es8388]
refresh: 0s
es8388:
i2s_audio:
- i2s_lrclk_pin: GPIO25
- id: i2s_audio_bus
i2s_lrclk_pin: GPIO25
i2s_bclk_pin: GPIO5
media_player:
@ -125,6 +126,7 @@ voice_assistant:
sensor:
- platform: adc
id: battery_sensor
pin: GPIO33
name: Battery
icon: "mdi:battery-outline"
@ -137,12 +139,13 @@ sensor:
attenuation: 11db
raw: true
filters:
- multiply: 0.00173913 # 2300 -> 4, for attenuation 11db, based on Olivier's code
- multiply: 0.00173913 # 2300 -> 4, for attenuation 11db, based on Olivier's code
- exponential_moving_average:
alpha: 0.2
send_every: 2
- delta: 0.002
binary_sensor:
- platform: gpio
pin:
@ -152,6 +155,7 @@ binary_sensor:
input: true
pullup: true
name: Volume Up
id: volume_up
on_click:
- media_player.volume_up: luxe_out
- platform: gpio
@ -162,6 +166,7 @@ binary_sensor:
input: true
pullup: true
name: Volume Down
id: volume_down
on_click:
- media_player.volume_down: luxe_out
- platform: gpio
@ -172,6 +177,7 @@ binary_sensor:
input: true
pullup: true
name: Action
id: action_button
on_multi_click:
- timing:
- ON FOR AT MOST 350ms
@ -200,4 +206,13 @@ light:
effects:
- pulse:
transition_length: 250ms
update_interval: 250ms
update_interval: 250ms
button:
- platform: safe_mode
id: button_safe_mode
name: Safe Mode Boot
- platform: factory_reset
id: factory_reset_btn
name: Factory reset

View File

@ -77,30 +77,30 @@ moodlight_orange_plasma:
moodlight_xmas:
alias: Moodlight XMas
sequence:
- service: light.turn_on
data:
- data:
brightness_pct: 20
transition: 2
effect: Plasma
effect: Glitter
target:
device_id:
- 6dcbd87b459412144bddc42af3ae8b83
- 4edd9b9df7d1f6f2fe7dcc2e5c0eb968
- c64e7c3dcda7f1c23e456959f2c60f39
- service: select.select_option
target:
action: light.turn_on
- target:
entity_id: select.wohnzimmer_hinten_color_palette, select.wohnzimmer_vorne_color_palette,
select.kuche_color_palette
data:
option: Orangery
action: select.select_option
- condition: state
state: 'on'
entity_id: media_player.lg_webos_smart_tv
- service: light.turn_off
target:
- target:
device_id: 6dcbd87b459412144bddc42af3ae8b83
data:
transition: 2
action: light.turn_off
mode: single
icon: mdi:lightbulb-on
wled_wohnzimmer_nachster_effekt: