Skip to content

Commit

Permalink
add verbose logging option
Browse files Browse the repository at this point in the history
  • Loading branch information
tube0013 committed Oct 2, 2024
1 parent b1e4675 commit 360bd4d
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
3 changes: 3 additions & 0 deletions tzb-zigpy-cli-tools/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Changelog

## 0.3.1.0
- Add verbose logging option

## 0.3.0.0
- Update Builds

Expand Down
4 changes: 3 additions & 1 deletion tzb-zigpy-cli-tools/config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
version: 0.3.0.0
version: 0.3.1.0
slug: tzb-zigpy-cli-tools
name: TubesZB Zigpy-CLI Tools
description: TubesZB Zigpy-CLI Toolsadd-on
Expand Down Expand Up @@ -27,6 +27,7 @@ options:
action: null
radio_type: null
baudrate: "115200"
verbose_logging: null
schema:
device: device(subsystem=tty)?
device_type: bool?
Expand All @@ -35,6 +36,7 @@ schema:
baudrate: list(57600|115200|230400|460800|921600)
action: list(info|energy-scan|reset|form|backup|restore)
backup_filename: str?
verbose_logging: bool?
stage: stable
startup: once
boot: manual
13 changes: 11 additions & 2 deletions tzb-zigpy-cli-tools/rootfs/etc/s6-overlay/scripts/zigpy-cli-up
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ declare baudrate
declare radio_type
declare backup_filename
declare exit_status
declare zigpy_param

function cleanup() {
exit_status=$?
Expand All @@ -23,6 +24,14 @@ function cleanup() {
}
trap cleanup EXIT

if bashio::config.true 'verbose_logging'; then
zigpy_param="-vvv"
bashio::log.info
else
zigpy_param=""
bashio::log.info "No verbose logging enabled"
fi

network_device=$(bashio::config 'network_device')

# Make folder for backups
Expand Down Expand Up @@ -53,13 +62,13 @@ fi

if ((bashio::config.equals 'action' 'backup') || (bashio::config.equals 'action' 'restore')) && (bashio::config.has_value 'backup_filename'); then
bashio::log.info "Running zigpy - ${action} on ${device} to /config/tzb-zigpy-cli-tools/${backup_filename}"
zigpy radio --baudrate ${baudrate} ${radio_type} ${device} ${action} /config/tzb-zigpy-cli-tools/${backup_filename}
zigpy ${zigpy_param} radio --baudrate ${baudrate} ${radio_type} ${device} ${action} /config/tzb-zigpy-cli-tools/${backup_filename}
elif ((bashio::config.equals 'action' 'backup') || (bashio::config.equals 'action' 'restore')) && (bashio::config.is_empty 'backup_filename'); then
bashio::log.warning "Not Backup File Specified"
exit 0
elif ((bashio::config.equals 'action' 'info') || (bashio::config.equals 'action' 'energy-scan') || (bashio::config.equals 'action' 'form') || (bashio::config.equals 'action' 'reset')); then
bashio::log.info "Running zigpy - ${action} on ${device}"
zigpy radio --baudrate ${baudrate} ${radio_type} ${device} ${action}
zigpy ${zigpy_param} radio --baudrate ${baudrate} ${radio_type} ${device} ${action}
else
bashio::log.warning "No Action Specified"
exit 0
Expand Down
5 changes: 4 additions & 1 deletion tzb-zigpy-cli-tools/translations/en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,7 @@ configuration:
description: By Default the Addon will use the selected serial port, selct this option and fill in the Network device address
backup_file:
name: Backup Filename
description: Backup File name for backup option or retstore option
description: Backup File name for backup option or retstore option
verbose_logging:
name: Enable Verbose Logging
description: Enables verbose logging for zigpy-cli

0 comments on commit 360bd4d

Please sign in to comment.