-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds new addon on for running a selection of zigpy-cli commands
- Loading branch information
Showing
19 changed files
with
256 additions
and
1 deletion.
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
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,57 @@ | ||
# TubesZB Add-on: Zigpy-CLI Tools Add-on | ||
|
||
## Installation | ||
|
||
Click on the button below: | ||
|
||
[![Open your Home Assistant instance and show the add add-on repository dialog with a specific repository URL pre-filled.](https://my.home-assistant.io/badges/supervisor_add_addon_repository.svg)](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Ftube0013%2Ftubeszb_addons) | ||
|
||
Or, in your Home Assistant, navigate to _Configuration_ > _Add-ons, Backups & Supervisor_ > _Add-on Store_ > _..._ > _Repositories_ and add `https://github.com/tube0013/tubeszb_addons` to the list. | ||
|
||
1. Navigate in your Home Assistant frontend to **Settings** -> **Add-ons, Backup & Supervisor** -> **Add-on Store**. | ||
2. Find the "TubesZB Zigpy-CLI Tools" add-on and click it. | ||
3. Click on the "INSTALL" button. | ||
|
||
## How to use | ||
|
||
*Disable/Stop ZHA or Zigbee2MQTT when using this addon* | ||
|
||
# Select yor coordinator's path | ||
Pick the serial port for your USB connected Coordinator, or Select USE Network Device and enter the IP address and Port (IP_ADDRESS:PORT) of the coordinator | ||
|
||
# Pick Radio Type and Baudrate | ||
Pick your radio type from the drop down. | ||
| Radio Type | Description | | ||
|------------|-----------------------------------------------------------------| | ||
| znp | Texas Instruments Z-Stack ZNP protocol: CC253x, CC26x2, CC13x2 | | ||
| ezsp | Silicon Labs EmberZNet protocol: Elelabs, HUSBZB-1, Telegesis | | ||
| deconz | dresden elektronik deCONZ protocol: ConBee I/II, RaspBee I/II | | ||
| xbee | Digi XBee Zigbee radios: Digi XBee Series 2, 2C, 3 | | ||
| zigate | ZiGate Zigbee radios: PiZiGate, ZiGate USB-TTL, ZiGate WiFi | | ||
| zboss | Nordic Semiconductor nRF modules | | ||
|
||
*Note some radios do not work with all the tools xbee for example* | ||
|
||
Pick the Baudrate for your radio, if you don't know it leave it at 115200 | ||
|
||
# Pick the Zigpy-CLI command to use | ||
Currently 4 commands are supported from zipy-cli | ||
* **Info** - Read the network information from the radio | ||
* **Energy Scan** - Perform an energy scan | ||
* **Form** - Form a network on a new coordinator | ||
* **Reset** - Resets the radio removing its network configuration | ||
|
||
|
||
## Configuration | ||
|
||
Add-on configuration: | ||
|
||
| Configuration | Description | | ||
|--------------------|--------------------------------------------------------| | ||
| device | Serial service where the radio is attached | | ||
| network_device | Network Serial port (IP_ADDRESS:PORT) | ||
| radio_type | Type of radio / coordinator | ||
| baudrate | Serial port baudrate (depends on firmware) | | ||
| action | zigpy-cli command to run | | ||
|
||
|
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,20 @@ | ||
ARG BUILD_FROM | ||
ARG BUILD_ARCH | ||
|
||
FROM $BUILD_FROM | ||
|
||
|
||
RUN \ | ||
set -x \ | ||
&& apk add --no-cache \ | ||
py3-pip \ | ||
python3 \ | ||
git \ | ||
&& pip3 uninstall -y setuptools \ | ||
&& pip3 install zigpy-cli | ||
|
||
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,22 @@ | ||
# TubesZB: Zigpy-CLI Tools Add-on | ||
|
||
Addon to make use of Zigpy-CLI tools easier for energy-scans and reseting coordinators | ||
|
||
**NOTE:** Make sure no other add-on or integration is using the radio. In | ||
particular disable the Zigbee Home Automation integration or Zigbee2MQTT. | ||
|
||
![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 uses [zigpy-cli](https://github.com/zigpy/zigpy-cli) | ||
|
||
[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,8 @@ | ||
--- | ||
build_from: | ||
aarch64: ghcr.io/home-assistant/aarch64-base-python:3.11-alpine3.17 | ||
amd64: ghcr.io/home-assistant/amd64-base-python:3.11-alpine3.17 | ||
armhf: ghcr.io/home-assistant/armhf-base-python:3.11-alpine3.17 | ||
armv7: ghcr.io/home-assistant/armv7-base-python:3.11-alpine3.17 | ||
i386: ghcr.io/home-assistant/i386-base-python:3.11-alpine3.17 | ||
|
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,34 @@ | ||
--- | ||
version: 0.1.0 | ||
slug: tzb-zigpy-cli-tools | ||
name: TubesZB Zigpy-CLI Tools | ||
description: TubesZB Zigpy-CLI Tools add-on | ||
url: > | ||
https://tube0013/tubeszb_addons/tree/master/tzb-zigpy-cli-tools/ | ||
arch: | ||
- aarch64 | ||
- amd64 | ||
- armhf | ||
- armv7 | ||
- i386 | ||
gpio: false | ||
hassio_api: true | ||
image: "ghcr.io/tube0013/{arch}-addon-tzb-zigpy-cli-tools" | ||
init: false | ||
options: | ||
network_device: null | ||
device: null | ||
device_type: false | ||
action: null | ||
radio_type: null | ||
baudrate: "115200" | ||
schema: | ||
device: device(subsystem=tty)? | ||
device_type: bool? | ||
network_device: str? | ||
radio_type: list(znp|ezsp|deconz|xbee|zigate|zboss) | ||
baudrate: list(57600|115200|230400|460800|921600) | ||
action: list(info|energy-scan|reset|form) | ||
stage: stable | ||
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.
Empty file.
1 change: 1 addition & 0 deletions
1
tzb-zigpy-cli-tools/rootfs/etc/s6-overlay/s6-rc.d/zigpy-cli/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 |
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/zigpy-cli-up |
37 changes: 37 additions & 0 deletions
37
tzb-zigpy-cli-tools/rootfs/etc/s6-overlay/scripts/banner.sh
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 |
42 changes: 42 additions & 0 deletions
42
tzb-zigpy-cli-tools/rootfs/etc/s6-overlay/scripts/zigpy-cli-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,42 @@ | ||
#!/usr/bin/with-contenv bashio | ||
# ============================================================================== | ||
# Start zigpy-cli-up | ||
# ============================================================================== | ||
|
||
set -e | ||
|
||
declare device | ||
declare network_device | ||
declare device_type | ||
declare action | ||
declare baudrate | ||
declare radio_type | ||
declare exit_status | ||
|
||
function cleanup() { | ||
exit_status=$? | ||
bashio::log.info "zigpy-cli-up script exited with code ${exit_status}" | ||
echo "${exit_status}" > /run/s6-linux-init-container-results/exitcode | ||
|
||
/run/s6/basedir/bin/halt | ||
} | ||
trap cleanup EXIT | ||
|
||
network_device=$(bashio::config 'network_device') | ||
|
||
if bashio::config.true 'device_type'; then | ||
device="socket://${network_device}" | ||
else | ||
device=$(bashio::config 'device') | ||
fi | ||
|
||
baudrate=$(bashio::config 'baudrate') | ||
radio_type=$(bashio::config 'radio_type') | ||
action=$(bashio::config 'action') | ||
|
||
|
||
bashio::log.info "Running zigpy - ${action} on ${device}" | ||
zigpy radio --baudrate ${baudrate} ${radio_type} ${device} ${action} | ||
exit 0 | ||
|
||
|
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,22 @@ | ||
--- | ||
configuration: | ||
device: | ||
name: Device | ||
description: The serial port where the coordinator is connected. (select one even if using a network device) | ||
network_device: | ||
name: Network Device | ||
description: The ip address and port of your network connected coordinator. IP_ADDRESS:PORT | ||
action: | ||
name: Zigpy-CLI Command | ||
description: >- | ||
Command to run - Info, Energy Scan, Form Network, Reset Coordinator | ||
baudrate: | ||
name: Baudrate | ||
description: >- | ||
The serial port baudrate used to communicate with the coordinator | ||
radio_type: | ||
name: Radio Type | ||
description: Type of radio - znp (TI CC2652), ezsp (Silicon Labs EFR32), deconz (Conbee), Xbee, zboss (Nordic NRF) | ||
device_type: | ||
name: Use Network Device | ||
description: By Default the Addon will use the selected serial port, selct this option and fill in the Network device address |