feat(zigbee2mqtt): allow use of custom config file BREAKING CHANGE (#2395)

* feat(zigbee2mqtt): allow use of custom config file

* fix script

* test file generation

* dont preset values, in case use select to use custom config

* cosmetic

* cosmetic

* whoops

* test not generate

* default to false

* adjust UI

* UI
This commit is contained in:
Stavros Kois
2022-04-03 17:20:30 +02:00
committed by GitHub
parent aa1935abc7
commit b6890a2e17
3 changed files with 71 additions and 48 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ maintainers:
name: zigbee2mqtt
sources:
- https://github.com/Koenkk/zigbee2mqtt
version: 2.0.14
version: 3.0.0
annotations:
truecharts.org/catagories: |
- media
+57 -39
View File
@@ -83,13 +83,13 @@ questions:
attrs:
- variable: ZIGBEE2MQTT_CONFIG_MQTT_USER
label: "MQTT User"
description: "This overrides config file"
description: "This will override the specific value of config file. Leave empty if you plan to use custom config or you don't have set a user on your MQTT broker."
schema:
type: string
default: ""
- variable: ZIGBEE2MQTT_CONFIG_MQTT_PASSWORD
label: "MQTT Password"
description: "This overrides config file"
description: "This will override the specific value of config file. Leave empty if you plan to use custom config or you don't have set a password on your MQTT broker."
schema:
type: string
private: true
@@ -102,45 +102,63 @@ questions:
additional_attrs: true
type: dict
attrs:
- variable: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN
label: "ZIGBEE2MQTT_CONFIG_PERMIT_JOIN"
description: "This overrides config file"
- variable: USE_CUSTOM_CONFIG_FILE
label: "ADVANCED: Use custom config file (Placed in /data)"
description: ""
schema:
type: boolean
default: true
- variable: ZIGBEE2MQTT_CONFIG_MQTT_SERVER
label: "MQTT Server"
description: "This overrides config file"
schema:
type: string
default: "mqtt://mqtt.ix-mqtt.svc.cluster.local"
- variable: ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC
label: "MQTT Base Topic"
description: "This overrides config file"
schema:
type: string
default: "zigbee2mqtt"
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_PORT
label: "ZIGBEE2MQTT_CONFIG_SERIAL_PORT"
description: "This overrides config file"
schema:
type: string
default: "/dev/ttyUSB0"
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER
label: "Serial Adapter Type"
description: "This overrides config file"
schema:
type: string
default: "auto"
enum:
- value: "auto"
description: "auto"
- value: "deconz"
description: "deconz"
- value: "ezsp"
description: "ezsp"
- value: "zstack"
description: "zstack"
default: false
show_subquestions_if: false
subquestions:
- variable: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN
label: "ZIGBEE2MQTT_CONFIG_PERMIT_JOIN"
description: "This will override the specific value of config file"
schema:
type: boolean
default: true
- variable: ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API
label: "ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API"
description: "This will override the specific value of config file"
schema:
type: boolean
default: true
- variable: ZIGBEE2MQTT_CONFIG_MQTT_SERVER
label: "MQTT Server"
description: "This will override the specific value of config file"
schema:
type: string
required: true
default: "mqtt://mqtt.ix-mqtt.svc.cluster.local"
- variable: ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC
label: "MQTT Base Topic"
description: "This will override the specific value of config file"
schema:
type: string
required: true
default: "zigbee2mqtt"
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_PORT
label: "ZIGBEE2MQTT_CONFIG_SERIAL_PORT"
description: "This will override the specific value of config file"
schema:
type: string
required: true
default: "/dev/ttyUSB0"
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER
label: "Serial Adapter Type"
description: "This will override the specific value of config file"
schema:
type: string
required: true
default: "auto"
enum:
- value: "auto"
description: "auto"
- value: "deconz"
description: "deconz"
- value: "ezsp"
description: "ezsp"
- value: "zstack"
description: "zstack"
# Include{containerConfig}
+13 -8
View File
@@ -10,13 +10,15 @@ secret:
env:
ZIGBEE2MQTT_DATA: "/data"
ZIGBEE2MQTT_CONFIG_FRONTEND_PORT: "{{ .Values.service.main.ports.main.port }}"
ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API: true
# User defined
ZIGBEE2MQTT_CONFIG_PERMIT_JOIN: true
ZIGBEE2MQTT_CONFIG_MQTT_SERVER: "mqtt://localhost"
ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC: "zigbee2mqtt"
ZIGBEE2MQTT_CONFIG_SERIAL_PORT: "/dev/ttyUSB0"
ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER: "auto"
USE_CUSTOM_CONFIG_FILE: false
# This values are required for the autogenerated file to work.
# ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API: true
# ZIGBEE2MQTT_CONFIG_PERMIT_JOIN: true
# ZIGBEE2MQTT_CONFIG_MQTT_SERVER: "mqtt://localhost"
# ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC: "zigbee2mqtt"
# ZIGBEE2MQTT_CONFIG_SERIAL_PORT: "/dev/ttyUSB0"
# ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER: "auto"
securityContext:
runAsNonRoot: false
@@ -64,18 +66,21 @@ initContainers:
value: "{{ .Values.env.ZIGBEE2MQTT_CONFIG_SERIAL_PORT }}"
- name: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER
value: "{{ .Values.env.ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER }}"
- name: USE_CUSTOM_CONFIG_FILE
value: "{{ .Values.env.USE_CUSTOM_CONFIG_FILE }}"
command: ["/bin/sh", "-c"]
args:
- >
if [ -f /data/configuration.yaml ];
if [ -f /data/configuration.yaml ] || [ ${USE_CUSTOM_CONFIG_FILE} == true ];
then
echo "Initial configuration exists. Skipping";
echo "Initial configuration exists or User selected to use custom configuration file. Skipping...";
else
echo "Creating initial configuration";
touch /data/configuration.yaml;
echo "# Configuration bellow will be always be overridden" >> /data/configuration.yaml;
echo "# from environment settings on the Scale Apps UI." >> /data/configuration.yaml;
echo "# You however will not see this values change in the file." >> /data/configuration.yaml;
echo "# It's a generated file based on the values provided on initial install." >> /data/configuration.yaml;
echo "##########################################################" >> /data/configuration.yaml;
echo "experimental:" >> /data/configuration.yaml;
echo " new_api: $ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API" >> /data/configuration.yaml;