From 5f767bd3a7377b5d5c470c39dfb09e65ac3df85c Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Tue, 3 Dec 2024 18:12:04 +0100 Subject: [PATCH] silabs-flasher: Support Yellow with CM5 Support flashing the internal radio on Home Assistant Yellow with CM5. --- silabs_flasher/CHANGELOG.md | 4 ++++ silabs_flasher/config.yaml | 2 +- .../scripts/universal-silabs-flasher-up | 24 +++++++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/silabs_flasher/CHANGELOG.md b/silabs_flasher/CHANGELOG.md index 48fed29abaa..22b7b305c04 100644 --- a/silabs_flasher/CHANGELOG.md +++ b/silabs_flasher/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## 0.3.2 + +- Update flasher script to work with Home Assistant Yellow with CM5 + ## 0.3.1 - Update firmwares to EmberZNet 7.4.4 - Update universal-silabs-flasher to v0.0.25 diff --git a/silabs_flasher/config.yaml b/silabs_flasher/config.yaml index e1a1b405734..a9f33694b5d 100644 --- a/silabs_flasher/config.yaml +++ b/silabs_flasher/config.yaml @@ -1,5 +1,5 @@ --- -version: 0.3.1 +version: 0.3.2 slug: silabs_flasher name: Silicon Labs Flasher description: Silicon Labs firmware flasher add-on diff --git a/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up b/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up index c97b0a5ee8c..e394924d001 100755 --- a/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up +++ b/silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up @@ -30,10 +30,30 @@ function exit_no_firmware { exit 0 } +# Function to check if the device is Home Assistant Yellow +function is_home_assistant_yellow { + # First, ensure the device is /dev/ttyAMA1 + if [ "${device}" != "/dev/ttyAMA1" ]; then + return 1 + fi + + # Check the known paths for Home Assistant Yellow + local paths=( + "/sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1" + "/sys/devices/platform/axi/1000120000.pcie/1f0003c000.serial/tty/ttyAMA1" + ) + for path in "${paths[@]}"; do + if [ -d "${path}" ]; then + return 0 + fi + done + return 1 +} + device=$(bashio::config 'device') bootloader_baudrate=$(bashio::config 'bootloader_baudrate') -if [ -d /sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1 ] && [ "${device}" == "/dev/ttyAMA1" ]; then +if is_home_assistant_yellow; then bashio::log.info "Detected Home Assistant Yellow" gpio_reset_flag="--bootloader-reset yellow" else @@ -50,7 +70,7 @@ if bashio::config.has_value 'firmware_url'; then firmware="firmware.gbl" else # Assume to run on Yellow if UART4 is mapped to ttyAMA1 - if [ -d /sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1 ] && [ "${device}" == "/dev/ttyAMA1" ]; then + if is_home_assistant_yellow; then firmware="yellow_zigbee_ncp_7.4.4.0.gbl" else # Check device manufacturer/product information