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 name: zigbee2mqtt
sources: sources:
- https://github.com/Koenkk/zigbee2mqtt - https://github.com/Koenkk/zigbee2mqtt
version: 2.0.14 version: 3.0.0
annotations: annotations:
truecharts.org/catagories: | truecharts.org/catagories: |
- media - media
+57 -39
View File
@@ -83,13 +83,13 @@ questions:
attrs: attrs:
- variable: ZIGBEE2MQTT_CONFIG_MQTT_USER - variable: ZIGBEE2MQTT_CONFIG_MQTT_USER
label: "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: schema:
type: string type: string
default: "" default: ""
- variable: ZIGBEE2MQTT_CONFIG_MQTT_PASSWORD - variable: ZIGBEE2MQTT_CONFIG_MQTT_PASSWORD
label: "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: schema:
type: string type: string
private: true private: true
@@ -102,45 +102,63 @@ questions:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN - variable: USE_CUSTOM_CONFIG_FILE
label: "ZIGBEE2MQTT_CONFIG_PERMIT_JOIN" label: "ADVANCED: Use custom config file (Placed in /data)"
description: "This overrides config file" description: ""
schema: schema:
type: boolean type: boolean
default: true default: false
- variable: ZIGBEE2MQTT_CONFIG_MQTT_SERVER show_subquestions_if: false
label: "MQTT Server" subquestions:
description: "This overrides config file" - variable: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN
schema: label: "ZIGBEE2MQTT_CONFIG_PERMIT_JOIN"
type: string description: "This will override the specific value of config file"
default: "mqtt://mqtt.ix-mqtt.svc.cluster.local" schema:
- variable: ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC type: boolean
label: "MQTT Base Topic" default: true
description: "This overrides config file" - variable: ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API
schema: label: "ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API"
type: string description: "This will override the specific value of config file"
default: "zigbee2mqtt" schema:
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_PORT type: boolean
label: "ZIGBEE2MQTT_CONFIG_SERIAL_PORT" default: true
description: "This overrides config file" - variable: ZIGBEE2MQTT_CONFIG_MQTT_SERVER
schema: label: "MQTT Server"
type: string description: "This will override the specific value of config file"
default: "/dev/ttyUSB0" schema:
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER type: string
label: "Serial Adapter Type" required: true
description: "This overrides config file" default: "mqtt://mqtt.ix-mqtt.svc.cluster.local"
schema: - variable: ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC
type: string label: "MQTT Base Topic"
default: "auto" description: "This will override the specific value of config file"
enum: schema:
- value: "auto" type: string
description: "auto" required: true
- value: "deconz" default: "zigbee2mqtt"
description: "deconz" - variable: ZIGBEE2MQTT_CONFIG_SERIAL_PORT
- value: "ezsp" label: "ZIGBEE2MQTT_CONFIG_SERIAL_PORT"
description: "ezsp" description: "This will override the specific value of config file"
- value: "zstack" schema:
description: "zstack" 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} # Include{containerConfig}
+13 -8
View File
@@ -10,13 +10,15 @@ secret:
env: env:
ZIGBEE2MQTT_DATA: "/data" ZIGBEE2MQTT_DATA: "/data"
ZIGBEE2MQTT_CONFIG_FRONTEND_PORT: "{{ .Values.service.main.ports.main.port }}" ZIGBEE2MQTT_CONFIG_FRONTEND_PORT: "{{ .Values.service.main.ports.main.port }}"
ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API: true
# User defined # User defined
ZIGBEE2MQTT_CONFIG_PERMIT_JOIN: true USE_CUSTOM_CONFIG_FILE: false
ZIGBEE2MQTT_CONFIG_MQTT_SERVER: "mqtt://localhost" # This values are required for the autogenerated file to work.
ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC: "zigbee2mqtt" # ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API: true
ZIGBEE2MQTT_CONFIG_SERIAL_PORT: "/dev/ttyUSB0" # ZIGBEE2MQTT_CONFIG_PERMIT_JOIN: true
ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER: "auto" # ZIGBEE2MQTT_CONFIG_MQTT_SERVER: "mqtt://localhost"
# ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC: "zigbee2mqtt"
# ZIGBEE2MQTT_CONFIG_SERIAL_PORT: "/dev/ttyUSB0"
# ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER: "auto"
securityContext: securityContext:
runAsNonRoot: false runAsNonRoot: false
@@ -64,18 +66,21 @@ initContainers:
value: "{{ .Values.env.ZIGBEE2MQTT_CONFIG_SERIAL_PORT }}" value: "{{ .Values.env.ZIGBEE2MQTT_CONFIG_SERIAL_PORT }}"
- name: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER - name: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER
value: "{{ .Values.env.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"] command: ["/bin/sh", "-c"]
args: args:
- > - >
if [ -f /data/configuration.yaml ]; if [ -f /data/configuration.yaml ] || [ ${USE_CUSTOM_CONFIG_FILE} == true ];
then then
echo "Initial configuration exists. Skipping"; echo "Initial configuration exists or User selected to use custom configuration file. Skipping...";
else else
echo "Creating initial configuration"; echo "Creating initial configuration";
touch /data/configuration.yaml; touch /data/configuration.yaml;
echo "# Configuration bellow will be always be overridden" >> /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 "# 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 "# 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 "##########################################################" >> /data/configuration.yaml;
echo "experimental:" >> /data/configuration.yaml; echo "experimental:" >> /data/configuration.yaml;
echo " new_api: $ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API" >> /data/configuration.yaml; echo " new_api: $ZIGBEE2MQTT_CONFIG_EXPIRIMENTAL_NEW_API" >> /data/configuration.yaml;