The basic goal is to add an action in the middle of the voice_assistant on_end event. voice_assistant is a dict with no ids where each event in the dict is an array of actions. Here’s a snippet of it:
voice_assistant:
on_tts_start:
- some_action:
- some_action:
on_end:
- some_action:
- some_action:
I can use !remove to remove the on_end item:
voice_assistant:
on_end: !remove
But there doesn’t seem to be a way to get my modified version back in again.
voice_assistant:
on_end: !remove
on_end:
- some_action:
Results in duplicate keys.
So I tried placing the remove and add in different files…
# remove_pn_end.yaml
voice_assistant:
on_end: !remove
# device_specific.yaml
packages:
Espressif.ESP32-S3-Box-3: github://esphome/wake-word-voice-assistants/esp32-s3-box-3/esp32-s3-box-3.yaml
remove_on_end: !include remove_on_end.yaml
voice_assistant:
on_end:
- some_action:
- some_action:
This validates but the result is that my two actions simply get appended to the original contents from ESP32-S3-Box-3:
voice_assistant:
on_end:
- original_action:
- original_action:
- some_action:
- some_action:
Oddly enough, if I don’t add my stuff back in again, the final result is that the on_end items IS removed from voice_assistant.
I’ve also tried using <<: !include remove_on_end.yaml but the result is the same.
So the only two ways I can find that work are…
- Make a local copy of the full config from GitHub and modify it. This isn’t ideal because I won’t pick up changes from the repo.
- Create a script that grabs the latest yaml from the GitHub repo and runs
yq 'del(.voice_assistant.on_end)' esp32-s3-box-3.yaml > esp32-s3-box-3-no-on_end.yamlto remove the voice_assistant.on_end item and change the package in my device-specific yaml to point to the local copy instead of the GitHub version. Then have the script callesphome run. While this works, it’s a bit awkward.
Anyone got any other ideas?