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
+25 -7
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,35 +102,53 @@ questions:
additional_attrs: true additional_attrs: true
type: dict type: dict
attrs: attrs:
- variable: USE_CUSTOM_CONFIG_FILE
label: "ADVANCED: Use custom config file (Placed in /data)"
description: ""
schema:
type: boolean
default: false
show_subquestions_if: false
subquestions:
- variable: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN - variable: ZIGBEE2MQTT_CONFIG_PERMIT_JOIN
label: "ZIGBEE2MQTT_CONFIG_PERMIT_JOIN" label: "ZIGBEE2MQTT_CONFIG_PERMIT_JOIN"
description: "This overrides config file" 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: schema:
type: boolean type: boolean
default: true default: true
- variable: ZIGBEE2MQTT_CONFIG_MQTT_SERVER - variable: ZIGBEE2MQTT_CONFIG_MQTT_SERVER
label: "MQTT Server" label: "MQTT Server"
description: "This overrides config file" description: "This will override the specific value of config file"
schema: schema:
type: string type: string
required: true
default: "mqtt://mqtt.ix-mqtt.svc.cluster.local" default: "mqtt://mqtt.ix-mqtt.svc.cluster.local"
- variable: ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC - variable: ZIGBEE2MQTT_CONFIG_MQTT_BASE_TOPIC
label: "MQTT Base Topic" label: "MQTT Base Topic"
description: "This overrides config file" description: "This will override the specific value of config file"
schema: schema:
type: string type: string
required: true
default: "zigbee2mqtt" default: "zigbee2mqtt"
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_PORT - variable: ZIGBEE2MQTT_CONFIG_SERIAL_PORT
label: "ZIGBEE2MQTT_CONFIG_SERIAL_PORT" label: "ZIGBEE2MQTT_CONFIG_SERIAL_PORT"
description: "This overrides config file" description: "This will override the specific value of config file"
schema: schema:
type: string type: string
required: true
default: "/dev/ttyUSB0" default: "/dev/ttyUSB0"
- variable: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER - variable: ZIGBEE2MQTT_CONFIG_SERIAL_ADAPTER
label: "Serial Adapter Type" label: "Serial Adapter Type"
description: "This overrides config file" description: "This will override the specific value of config file"
schema: schema:
type: string type: string
required: true
default: "auto" default: "auto"
enum: enum:
- value: "auto" - value: "auto"
+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;