Add initial support for ZWave JS (#1766)

* Add initial support for ZWave JS

* fix version

* fix lint

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Charles Garwood <cgarwood@gmail.com>

* Apply suggestions from code review

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>

* Update zwave_js/config.json

Co-authored-by: Franck Nijhof <git@frenck.dev>

* Address comments

* Fix install for all archs

* make lint happy

* Fix build

* fix comment

* Fix and clean zwave_js add-on (#1780)

* Use new bashio feature

* address ozw

* update docs

* Add debug support

* fix template

* Fix lint

Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
Co-authored-by: Charles Garwood <cgarwood@gmail.com>
Co-authored-by: Franck Nijhof <git@frenck.dev>
This commit is contained in:
Pascal Vizeli
2021-01-25 20:20:12 +01:00
committed by GitHub
parent 1caa587fb4
commit c6fe889e32
17 changed files with 401 additions and 110 deletions

View File

@@ -0,0 +1,40 @@
#!/usr/bin/with-contenv bashio
# ==============================================================================
# Generate Z-Wave JS config file
# ==============================================================================
declare network_key
readonly DOCS_EXAMPLE_KEY="2232666D100F795E5BB17F0A1BB7A146"
if [[ "${DOCS_EXAMPLE_KEY}" == "$(bashio::config 'network_key')" ]]; then
bashio::log.fatal
bashio::log.fatal 'The add-on detected that the Z-Wave network key used'
bashio::log.fatal 'is from the documented example.'
bashio::log.fatal
bashio::log.fatal 'Using this key is insecure, because it is publicly'
bashio::log.fatal 'listed in the documentation.'
bashio::log.fatal
bashio::log.fatal 'Please check the add-on documentation on how to'
bashio::log.fatal 'create your own, secret, "network_key" and replace'
bashio::log.fatal 'the one you have configured.'
bashio::log.fatal
bashio::log.fatal 'Click on the "Documentation" tab in the Z-Wave JS'
bashio::log.fatal 'add-on panel for more information.'
bashio::log.fatal
bashio::exit.nok
elif ! bashio::config.has_value 'network_key'; then
bashio::log.info "No Network Key is set, generate one..."
network_key=$(hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/random)
bashio::addon.option network_key "${network_key}"
else
network_key=$(bashio::config 'network_key')
fi
# Generate config
bashio::var.json \
network_key "${network_key}" \
logging "$(bashio::info.logging)" \
| tempio \
-template /usr/share/tempio/zwave_config.conf \
-out /etc/zwave_config.json