Retain zwave_js legacy network_key config option (#2205)

This commit is contained in:
Martin Hjelmare
2021-09-30 07:07:38 +02:00
committed by GitHub
parent e1e6efe577
commit e3e2ac285e
3 changed files with 9 additions and 6 deletions

View File

@@ -1,5 +1,9 @@
# Changelog # Changelog
## 0.1.42
- Retain legacy network_key config option to stay backwards compatible.
## 0.1.41 ## 0.1.41
- Bump Z-Wave JS Server to 1.10.5 - Bump Z-Wave JS Server to 1.10.5

View File

@@ -1,6 +1,6 @@
{ {
"name": "Z-Wave JS", "name": "Z-Wave JS",
"version": "0.1.41", "version": "0.1.42",
"slug": "zwave_js", "slug": "zwave_js",
"description": "Control a ZWave network with Home Assistant Z-Wave JS", "description": "Control a ZWave network with Home Assistant Z-Wave JS",
"arch": ["amd64", "i386", "armhf", "armv7", "aarch64"], "arch": ["amd64", "i386", "armhf", "armv7", "aarch64"],
@@ -22,7 +22,8 @@
"s2_access_control_key": "", "s2_access_control_key": "",
"s2_authenticated_key": "", "s2_authenticated_key": "",
"s2_unauthenticated_key": "", "s2_unauthenticated_key": "",
"log_level": "info" "log_level": "info",
"network_key": ""
}, },
"schema": { "schema": {
"device": "device(subsystem=tty)", "device": "device(subsystem=tty)",

View File

@@ -12,11 +12,10 @@ readonly DOCS_EXAMPLE_KEY_4="CF338FE0CB99549F7C0EA96308E5A403"
if bashio::config.has_value 'network_key'; then if bashio::config.has_value 'network_key'; then
# If both 'network_key' and 's0_legacy_key' are set and keys don't match, # If both 'network_key' and 's0_legacy_key' are set and keys don't match,
# we don't know which one to pick so we have to exit. If they are both set # we don't know which one to pick so we have to exit. If they are both set
# and do match, we will drop 'network_key' # and do match, we don't need to do anything
if bashio::config.has_value 's0_legacy_key'; then if bashio::config.has_value 's0_legacy_key'; then
if bashio::config.equals 's0_legacy_key' "$(bashio::config \"network_key\")"; then if bashio::config.equals 's0_legacy_key' "$(bashio::config \"network_key\")"; then
bashio::log.info "Both 'network_key' and 's0_legacy_key' are set and match. Dropping 'network_key' value..." bashio::log.info "Both 'network_key' and 's0_legacy_key' are set and match. All ok."
bashio::addon.option network_key
else else
bashio::log.fatal "Both 'network_key' and 's0_legacy_key' are set to different values " bashio::log.fatal "Both 'network_key' and 's0_legacy_key' are set to different values "
bashio::log.fatal "so we are unsure which one to use. One needs to be removed from the " bashio::log.fatal "so we are unsure which one to use. One needs to be removed from the "
@@ -29,7 +28,6 @@ if bashio::config.has_value 'network_key'; then
bashio::log.info "Migrating \"network_key\" option to \"s0_legacy_key\"..." bashio::log.info "Migrating \"network_key\" option to \"s0_legacy_key\"..."
network_key=$(bashio::string.upper "$(bashio::config 'network_key')") network_key=$(bashio::string.upper "$(bashio::config 'network_key')")
bashio::addon.option s0_legacy_key "${network_key}" bashio::addon.option s0_legacy_key "${network_key}"
bashio::addon.option network_key
bashio::log.info "Flushing config to disk due to key migration..." bashio::log.info "Flushing config to disk due to key migration..."
bashio::addon.options > "/data/options.json" bashio::addon.options > "/data/options.json"
fi fi