forked from home-assistant/addons
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
silabs_flasher: Initial version (home-assistant#2940)
- Loading branch information
Showing
20 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Changelog | ||
|
||
## 0.1.0 | ||
|
||
- initial version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Home Assistant Add-on: Silicon Labs Flasher Add-on | ||
|
||
## Installation | ||
|
||
Follow these steps to get the add-on installed on your system: | ||
|
||
1. Navigate in your Home Assistant frontend to **Settings** -> **Add-ons, Backup & Supervisor** -> **Add-on Store**. | ||
2. Find the "Silicon Labs Flasher" add-on and click it. | ||
3. Click on the "INSTALL" button. | ||
|
||
## How to use | ||
|
||
The add-on needs a Silicon Labs based wireless module accessible through a | ||
serial port (like the module on Home Assistant Yellow, Home Assistant | ||
SkyConnect or other USB based wireless adapters). | ||
|
||
1. Select the correct `device` in the add-on configuration tab and press `Save`. | ||
2. Start the add-on. | ||
|
||
## Configuration | ||
|
||
Add-on configuration: | ||
|
||
| Configuration | Description | | ||
|--------------------|--------------------------------------------------------| | ||
| device (mandatory) | Serial service where the Silicon Labs radio is attached | | ||
| baudrate | Serial port baudrate (depends on firmware) | | ||
| flow_control | If hardware flow control should be enabled (depends on firmware) | | ||
| firmware_url | Custom URL to flash firmware from | | ||
|
||
## Support | ||
|
||
Got questions? | ||
|
||
You have several options to get them answered: | ||
|
||
- The [Home Assistant Discord Chat Server][discord]. | ||
- The Home Assistant [Community Forum][forum]. | ||
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit] | ||
|
||
In case you've found a bug, please [open an issue on our GitHub][issue]. | ||
|
||
[discord]: https://discord.gg/c5DvZ4e | ||
[forum]: https://community.home-assistant.io | ||
[reddit]: https://reddit.com/r/homeassistant | ||
[issue]: https://github.com/home-assistant/addons/issues |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
ARG BUILD_FROM | ||
ARG BUILD_ARCH | ||
|
||
FROM $BUILD_FROM | ||
|
||
ARG UNIVERSAL_SILABS_FLASHER | ||
|
||
RUN \ | ||
set -x \ | ||
&& apk add --no-cache \ | ||
py3-pip \ | ||
python3 \ | ||
&& pip3 install \ | ||
--no-cache-dir \ | ||
--prefer-binary \ | ||
--find-links "https://wheels.home-assistant.io/musllinux/${BUILD_ARCH}/" \ | ||
universal-silabs-flasher=="${UNIVERSAL_SILABS_FLASHER}" | ||
|
||
COPY rootfs / | ||
|
||
# use s6-overlay as init system | ||
WORKDIR / | ||
ENTRYPOINT ["/init"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Home Assistant Add-on: Silicon Labs Flasher Add-on | ||
|
||
Silicon Labs Flasher add-on to flash Silicon Labs based radios. | ||
|
||
By default this add-on flashes the firmware to use Zigbee (Silicon | ||
Labs EmberZNet Zigbee stack). | ||
|
||
**NOTE:** Make sure no other add-on or integration is using the radio. In | ||
particular disable the Zigbee Home Automation integration and the Silicon Labs | ||
Multiprotocol add-on. | ||
|
||
![Supports aarch64 Architecture][aarch64-shield] | ||
![Supports amd64 Architecture][amd64-shield] | ||
![Supports armhf Architecture][armhf-shield] | ||
![Supports armv7 Architecture][armv7-shield] | ||
![Supports i386 Architecture][i386-shield] | ||
|
||
## About | ||
|
||
This add-on allows you to flash firmwares using the Gecko Bootloader file format | ||
(gbl). By default it comes with firmware for Home Assistant SkyConnect and | ||
Home Assistant Yellow to flash Zigbee. | ||
|
||
[aarch64-shield]: https://img.shields.io/badge/aarch64-yes-green.svg | ||
[amd64-shield]: https://img.shields.io/badge/amd64-yes-green.svg | ||
[armhf-shield]: https://img.shields.io/badge/armhf-yes-green.svg | ||
[armv7-shield]: https://img.shields.io/badge/armv7-yes-green.svg | ||
[i386-shield]: https://img.shields.io/badge/i386-yes-green.svg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
build_from: | ||
aarch64: ghcr.io/home-assistant/aarch64-base:3.16 | ||
amd64: ghcr.io/home-assistant/amd64-base:3.16 | ||
armhf: ghcr.io/home-assistant/armhf-base:3.16 | ||
armv7: ghcr.io/home-assistant/armv7-base:3.16 | ||
i386: ghcr.io/home-assistant/i386-base:3.16 | ||
args: | ||
UNIVERSAL_SILABS_FLASHER: 0.0.12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
version: 0.1.0 | ||
slug: silabs_flasher | ||
name: Silicon Labs Flasher | ||
description: Silicon Labs firmware flasher add-on | ||
url: > | ||
https://github.com/home-assistant/addons/tree/master/silabs_flasher | ||
arch: | ||
- aarch64 | ||
- amd64 | ||
- armhf | ||
- armv7 | ||
- i386 | ||
gpio: true | ||
hassio_api: true | ||
image: homeassistant/{arch}-addon-silabs-flasher | ||
init: false | ||
options: | ||
device: null | ||
bootloader_baudrate: "115200" | ||
flow_control: true | ||
schema: | ||
device: device(subsystem=tty)? | ||
bootloader_baudrate: list(57600|115200|230400|460800|921600) | ||
flow_control: bool? | ||
firmware_url: str? | ||
stage: experimental | ||
startup: once | ||
boot: manual |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/scripts/banner.sh |
Empty file.
1 change: 1 addition & 0 deletions
1
silabs_flasher/rootfs/etc/s6-overlay/s6-rc.d/universal-silabs-flasher/type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
oneshot |
1 change: 1 addition & 0 deletions
1
silabs_flasher/rootfs/etc/s6-overlay/s6-rc.d/universal-silabs-flasher/up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/etc/s6-overlay/scripts/universal-silabs-flasher-up |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Home Assistant Community Add-on: Base Images | ||
# Displays a simple add-on banner on startup | ||
# ============================================================================== | ||
if bashio::supervisor.ping; then | ||
bashio::log.blue \ | ||
'-----------------------------------------------------------' | ||
bashio::log.blue " Add-on: $(bashio::addon.name)" | ||
bashio::log.blue " $(bashio::addon.description)" | ||
bashio::log.blue \ | ||
'-----------------------------------------------------------' | ||
|
||
bashio::log.blue " Add-on version: $(bashio::addon.version)" | ||
if bashio::var.true "$(bashio::addon.update_available)"; then | ||
bashio::log.magenta ' There is an update available for this add-on!' | ||
bashio::log.magenta \ | ||
" Latest add-on version: $(bashio::addon.version_latest)" | ||
bashio::log.magenta ' Please consider upgrading as soon as possible.' | ||
else | ||
bashio::log.green ' You are running the latest version of this add-on.' | ||
fi | ||
|
||
bashio::log.blue " System: $(bashio::info.operating_system)" \ | ||
" ($(bashio::info.arch) / $(bashio::info.machine))" | ||
bashio::log.blue " Home Assistant Core: $(bashio::info.homeassistant)" | ||
bashio::log.blue " Home Assistant Supervisor: $(bashio::info.supervisor)" | ||
|
||
bashio::log.blue \ | ||
'-----------------------------------------------------------' | ||
bashio::log.blue \ | ||
' Please, share the above information when looking for help' | ||
bashio::log.blue \ | ||
' or support in, e.g., GitHub, forums or the Discord chat.' | ||
bashio::log.blue \ | ||
'-----------------------------------------------------------' | ||
fi |
71 changes: 71 additions & 0 deletions
71
silabs_flasher/rootfs/etc/s6-overlay/scripts/universal-silabs-flasher-up
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Start universal-silabs-flasher | ||
# ============================================================================== | ||
|
||
declare autoflash_firmware | ||
declare device | ||
declare bootloader_baudrate | ||
declare firmware | ||
declare usb_device_path | ||
declare usb_manufacturer | ||
declare usb_product | ||
declare gpio_reset_flag | ||
|
||
function exit_no_firmware { | ||
bashio::log.warning "No firmware found for the selected device, assuming firmware is installed." | ||
exit 0 | ||
} | ||
|
||
device=$(bashio::config 'device') | ||
bootloader_baudrate=$(bashio::config 'bootloader_baudrate') | ||
|
||
if [ -d /sys/devices/platform/soc/fe201800.serial/tty/ttyAMA1 ] && [ "${device}" == "/dev/ttyAMA1" ]; then | ||
bashio::log.info "Detected Home Assistant Yellow" | ||
gpio_reset_flag="--yellow-gpio-reset" | ||
else | ||
gpio_reset_flag="" | ||
fi | ||
|
||
if bashio::config.has_value 'firmware_url'; then | ||
curl -L -o "firmware.gbl" "$(bashio::config 'firmware_url')" | ||
if [ ! -f "firmware.gbl" ]; then | ||
bashio::log.warning "Downloading firmware failed" | ||
exit 0 | ||
fi | ||
|
||
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 | ||
firmware="NabuCasa_Yellow_EZSP_v7.2.2.0_PA32_ncp-uart-hw_115200.gbl" | ||
else | ||
# Check device manufacturer/product information | ||
usb_device_path=$(realpath /sys/class/tty/$(readlink /sys/class/tty/$(basename ${device}))/../../../../) | ||
if [ ! -f "${usb_device_path}/idProduct" ]; then | ||
bashio::log.info "The selected serial port is not a USB device." | ||
exit_no_firmware | ||
fi | ||
|
||
if [ ! -f "${usb_device_path}/manufacturer" ] || [ ! -f "${usb_device_path}/product" ]; then | ||
bashio::log.info "USB device is missing manufacturer or product name." | ||
exit_no_firmware | ||
fi | ||
|
||
usb_manufacturer=$(cat "${usb_device_path}/manufacturer") | ||
usb_product=$(cat "${usb_device_path}/product") | ||
|
||
bashio::log.info "Checking ${device} identifying ${usb_product} from ${usb_manufacturer}." | ||
if [[ "${usb_manufacturer}" == "Nabu Casa" && "${usb_product}" == "SkyConnect"* ]]; then | ||
firmware="NabuCasa_SkyConnect_EZSP_v7.2.2.0_ncp-uart-hw_115200.gbl" | ||
else | ||
exit_no_firmware | ||
fi | ||
gpio_reset_flag="" | ||
fi | ||
fi | ||
|
||
bashio::log.info "Starting universal-silabs-flasher with ${device} (bootloader baudrate ${bootloader_baudrate})" | ||
exec universal-silabs-flasher --device ${device} \ | ||
--bootloader-baudrate "${bootloader_baudrate}" \ | ||
flash ${gpio_reset_flag} --force --firmware "/root/${firmware}" |
Binary file added
BIN
+222 KB
silabs_flasher/rootfs/root/NabuCasa_SkyConnect_EZSP_v7.2.2.0_ncp-uart-hw_115200.gbl
Binary file not shown.
Binary file added
BIN
+223 KB
silabs_flasher/rootfs/root/NabuCasa_Yellow_EZSP_v7.2.2.0_PA32_ncp-uart-hw_115200.gbl
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
--- | ||
configuration: | ||
device: | ||
name: Device | ||
description: The serial port where the Silicon Labs radio is connected to. | ||
bootloader_baudrate: | ||
name: Bootloader Baudrate | ||
description: >- | ||
The serial port baudrate used to communicate with the Silicon Labs radio | ||
in bootloader mode. | ||
flow_control: | ||
name: Hardware flow control | ||
description: Enable hardware flow control for serial port. | ||
firmware_url: | ||
name: Firmware URL | ||
description: >- | ||
Flash Custom firmware downloaded from URL. |