Expose log level as a configuration option for zwave_js (#1950)

This commit is contained in:
Raman Gupta
2021-04-15 16:43:09 -04:00
committed by GitHub
parent c2d2a77a2b
commit de82bb041c
4 changed files with 27 additions and 3 deletions

View File

@@ -83,6 +83,20 @@ don't have a backup of this key, you won't be able to reconnect to any securely
included devices. This may mean you have to do a factory reset on those devices included devices. This may mean you have to do a factory reset on those devices
and your controller, before rebuilding your Z-Wave network. and your controller, before rebuilding your Z-Wave network.
### Option `log_level` (optional)
This option sets the log level of Z-Wave JS. Valid options are:
- silly
- debug
- verbose
- http
- info
- warn
- error
If no `log_level` is specified, the log level will be set to the level set in
the Supervisor.
### Option `emulate_hardware` (optional) ### Option `emulate_hardware` (optional)
If you don't have a USB stick, you can use a fake stick for testing purposes. If you don't have a USB stick, you can use a fake stick for testing purposes.

View File

@@ -18,11 +18,13 @@
"discovery": ["zwave_js"], "discovery": ["zwave_js"],
"options": { "options": {
"device": null, "device": null,
"network_key": "" "network_key": "",
"log_level": "info"
}, },
"schema": { "schema": {
"device": "device(subsystem=tty)", "device": "device(subsystem=tty)",
"network_key": "match(|[0-9a-fA-F]{32,32})", "network_key": "match(|[0-9a-fA-F]{32,32})",
"log_level": "list(silly|debug|verbose|http|info|warn|error)?",
"emulate_hardware": "bool?" "emulate_hardware": "bool?"
}, },
"image": "homeassistant/{arch}-addon-zwave_js" "image": "homeassistant/{arch}-addon-zwave_js"

View File

@@ -30,11 +30,19 @@ else
network_key=$(bashio::config 'network_key') network_key=$(bashio::config 'network_key')
fi fi
if ! bashio::config.has_value 'log_level'; then
log_level=$(bashio::info.logging)
bashio::log.info "No log level specified, falling back to Supervisor"
bashio::log.info "log level (${log_level})..."
else
log_level=$(bashio::config 'log_level')
fi
# Generate config # Generate config
bashio::var.json \ bashio::var.json \
network_key "${network_key}" \ network_key "${network_key}" \
logging "$(bashio::info.logging)" \ log_level "${log_level}" \
| tempio \ | tempio \
-template /usr/share/tempio/zwave_config.conf \ -template /usr/share/tempio/zwave_config.conf \
-out /etc/zwave_config.json -out /etc/zwave_config.json

View File

@@ -1,7 +1,7 @@
{ {
"logConfig": { "logConfig": {
"enabled": true, "enabled": true,
"level": {{ if eq .logging "debug" }}5{{ else }}2{{ end }}, "level": "{{ .log_level }}",
"forceConsole": true "forceConsole": true
}, },
"storage": { "storage": {