[zigbee2mqtt] Version 1.15, new UI (#80)

This commit is contained in:
Piotr Maksymiuk 2020-10-04 19:23:07 +02:00 committed by GitHub
parent e19708e37d
commit e60063a352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 109 additions and 163 deletions

View File

@ -2,8 +2,8 @@ apiVersion: v2
name: zigbee2mqtt name: zigbee2mqtt
type: application type: application
description: Bridges events and allows you to control your Zigbee devices via MQTT description: Bridges events and allows you to control your Zigbee devices via MQTT
appVersion: 1.14.1 appVersion: 1.15.0
version: 1.0.0 version: 2.0.0
keywords: keywords:
- zigbee - zigbee
- mqtt - mqtt

View File

@ -64,3 +64,21 @@ Alternatively, a YAML file that specifies the values for the above parameters ca
```console ```console
helm install --name my-release -f values.yaml k8s-at-home/zigbee2mqtt helm install --name my-release -f values.yaml k8s-at-home/zigbee2mqtt
``` ```
## Upgrading an existing Release to a new major version
A major chart version change (like 1.0.0 -> 2.0.0) indicates that there is an
incompatible breaking change needing manual actions.
### Upgrading from 1.x.x to 2.x.x
Zigbee2MQTT has gained a native full-feature WebUI. Because of this, Zigbee2MQTTAssistant was dropped from the chart
You should delete the assistant config from your values.yaml. If you wish to use the new UI, make sure you have
```
frontend:
port: 8080
experimental:
new_api: true
```
in the config section, and enable the ingress in values.yaml. Because of the way this chart works, you'll need to add this section to your configuration.yaml in zigbee2mqtt manually if you want to upgrade in-place

View File

@ -7,24 +7,26 @@ WARNING: You have not set a network key, which makes zigbee2mqtt run with a well
Please read https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html Please read https://www.zigbee2mqtt.io/how_tos/how_to_secure_network.html
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- if .Values.assistant.enabled }} {{- if and .Values.config.frontend .Values.config.experimental }}
Get the Z2MA URL by running these commands: {{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
{{- if .Values.assistant.ingress.enabled }} Get the Zigbee2MQTT WebUI URL by running these commands:
{{- range .Values.assistant.ingress.hosts }} {{- if .Values.ingress.enabled }}
http{{ if $.Values.assistant.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.assistant.ingress.path }} {{- range .Values.ingress.hosts }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }}
{{- end }} {{- end }}
{{- else if contains "NodePort" .Values.assistant.service.type }} {{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "zigbee2mqtt.fullname" . }}) export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "zigbee2mqtt.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.assistant.service.type }} {{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available. NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ include "zigbee2mqtt.fullname" . }}' You can watch the status of by running 'kubectl get svc -w {{ include "zigbee2mqtt.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "zigbee2mqtt.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "zigbee2mqtt.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.assistant.service.port }} echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.assistant.service.type }} {{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "zigbee2mqtt.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "zigbee2mqtt.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:5000 to use your application" echo "Visit http://127.0.0.1:5000 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 5000:80 kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 5000:80
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}

View File

@ -9,40 +9,3 @@ data:
{{- with .Values.config }} {{- with .Values.config }}
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
---
{{- if .Values.assistant.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "zigbee2mqtt.fullname" . }}assistant
labels:
{{ include "zigbee2mqtt.labels" . | indent 4 }}
data:
TZ: {{ .Values.timezone | quote }}
{{- $server := default "mqtt://localhost:1883" .Values.config.mqtt.server }}
{{- $protocol := (split "://" $server)._0 }}
{{- $host := (split ":" (split "://" $server)._1)._0 }}
{{- $port := (split ":" $server)._2 }}
Z2MA_SETTINGS__MQTTSERVER: {{ $host }}
{{- if eq $protocol "mqtts"}}
Z2MA_SETTINGS__MQTTSECURE: "true"
{{- end }}
{{- if $port }}
Z2MA_SETTINGS__MQTTPORT: {{ $port }}
{{- end }}
{{- if .Values.config.mqtt.user }}
Z2MA_SETTINGS__MQTTUSERNAME: {{ .Values.config.mqtt.user }}
{{- end }}
{{- if .Values.config.mqtt.password }}
Z2MA_SETTINGS__MQTTPASSWORD: {{ .Values.config.mqtt.password }}
{{- end }}
{{- if .Values.config.mqtt.base_topic }}
Z2MA_SETTINGS__BASETOPIC: {{ .Values.config.mqtt.base_topic }}
{{- end }}
{{- if and .Values.config.homeassistant .Values.config.advanced.homeassistant_discovery_topic }}
Z2MA_SETTINGS__HOMEASSISTANTDISCOVERYBASETOPIC: {{ .Values.config.advanced.homeassistant_discovery_topic }}
{{- end }}
{{- range $key, $val := .Values.assistant.config }}
Z2MA_SETTINGS__{{ $key | upper }}: {{ $val | quote }}
{{- end }}
{{- end }}

View File

@ -1,20 +1,21 @@
{{- if and .Values.assistant.enabled .Values.assistant.ingress.enabled -}} {{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
{{- $fullName := include "zigbee2mqtt.fullname" . -}} {{- $fullName := include "zigbee2mqtt.fullname" . -}}
{{- $ingressPath := .Values.assistant.ingress.path -}} {{- $ingressPath := .Values.ingress.path -}}
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
metadata: metadata:
name: {{ $fullName }} name: {{ $fullName }}
labels: labels:
{{ include "zigbee2mqtt.labels" . | indent 4 }} {{ include "zigbee2mqtt.labels" . | indent 4 }}
{{- with .Values.assistant.ingress.annotations }} {{- with .Values.ingress.annotations }}
annotations: annotations:
{{- toYaml . | nindent 4 }} {{- toYaml . | nindent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if .Values.assistant.ingress.tls }} {{- if .Values.ingress.tls }}
tls: tls:
{{- range .Values.assistant.ingress.tls }} {{- range .Values.ingress.tls }}
- hosts: - hosts:
{{- range .hosts }} {{- range .hosts }}
- {{ . | quote }} - {{ . | quote }}
@ -23,7 +24,7 @@ spec:
{{- end }} {{- end }}
{{- end }} {{- end }}
rules: rules:
{{- range .Values.assistant.ingress.hosts }} {{- range .Values.ingress.hosts }}
- host: {{ . | quote }} - host: {{ . | quote }}
http: http:
paths: paths:
@ -33,3 +34,4 @@ spec:
servicePort: http servicePort: http
{{- end }} {{- end }}
{{- end }} {{- end }}
{{- end }}

View File

@ -1,50 +1,52 @@
{{- if .Values.assistant.enabled -}} {{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
name: {{ template "zigbee2mqtt.fullname" . }} name: {{ template "zigbee2mqtt.fullname" . }}
labels: labels:
{{ include "zigbee2mqtt.labels" . | indent 4 }} {{ include "zigbee2mqtt.labels" . | indent 4 }}
{{- if .Values.assistant.service.labels }} {{- if .Values.service.labels }}
{{ toYaml .Values.assistant.service.labels | indent 4 }} {{ toYaml .Values.service.labels | indent 4 }}
{{- end }} {{- end }}
{{- with .Values.assistant.service.annotations }} {{- with .Values.service.annotations }}
annotations: annotations:
{{ toYaml . | indent 4 }} {{ toYaml . | indent 4 }}
{{- end }} {{- end }}
spec: spec:
{{- if (or (eq .Values.assistant.service.type "ClusterIP") (empty .Values.assistant.service.type)) }} {{- if (or (eq .Values.service.type "ClusterIP") (empty .Values.service.type)) }}
type: ClusterIP type: ClusterIP
{{- if .Values.assistant.service.clusterIP }} {{- if .Values.service.clusterIP }}
clusterIP: {{ .Values.assistant.service.clusterIP }} clusterIP: {{ .Values.service.clusterIP }}
{{end}} {{end}}
{{- else if eq .Values.assistant.service.type "LoadBalancer" }} {{- else if eq .Values.service.type "LoadBalancer" }}
type: {{ .Values.assistant.service.type }} type: {{ .Values.service.type }}
{{- if .Values.assistant.service.loadBalancerIP }} {{- if .Values.service.loadBalancerIP }}
loadBalancerIP: {{ .Values.assistant.service.loadBalancerIP }} loadBalancerIP: {{ .Values.service.loadBalancerIP }}
{{- end }} {{- end }}
{{- if .Values.assistant.service.loadBalancerSourceRanges }} {{- if .Values.service.loadBalancerSourceRanges }}
loadBalancerSourceRanges: loadBalancerSourceRanges:
{{ toYaml .Values.assistant.service.loadBalancerSourceRanges | indent 4 }} {{ toYaml .Values.service.loadBalancerSourceRanges | indent 4 }}
{{- end -}} {{- end -}}
{{- else }} {{- else }}
type: {{ .Values.assistant.service.type }} type: {{ .Values.service.type }}
{{- end }} {{- end }}
{{- if .Values.assistant.service.externalIPs }} {{- if .Values.service.externalIPs }}
externalIPs: externalIPs:
{{ toYaml .Values.assistant.service.externalIPs | indent 4 }} {{ toYaml .Values.service.externalIPs | indent 4 }}
{{- end }} {{- end }}
{{- if .Values.assistant.service.externalTrafficPolicy }} {{- if .Values.service.externalTrafficPolicy }}
externalTrafficPolicy: {{ .Values.assistant.service.externalTrafficPolicy }} externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy }}
{{- end }} {{- end }}
ports: ports:
- name: http - name: http
port: {{ .Values.assistant.service.port }} port: {{ .Values.service.port }}
protocol: TCP protocol: TCP
targetPort: http targetPort: http
{{ if (and (eq .Values.assistant.service.type "NodePort") (not (empty .Values.assistant.service.nodePort))) }} {{ if (and (eq .Values.service.type "NodePort") (not (empty .Values.service.nodePort))) }}
nodePort: {{.Values.assistant.service.nodePort}} nodePort: {{.Values.service.nodePort}}
{{ end }} {{ end }}
selector: selector:
{{- include "zigbee2mqtt.selectorLabels" . | nindent 4 }} {{- include "zigbee2mqtt.selectorLabels" . | nindent 4 }}
{{- end }} {{- end }}
{{- end }}

View File

@ -41,6 +41,14 @@ spec:
- name: DEBUG - name: DEBUG
value: {{ .Values.debug }} value: {{ .Values.debug }}
{{- end }} {{- end }}
{{- if and .Values.config.frontend .Values.config.experimental }}
{{- if and .Values.config.frontend.port .Values.config.experimental.new_api }}
ports:
- name: http
containerPort: {{ .Values.config.frontend.port }}
protocol: TCP
{{- end }}
{{- end }}
resources: resources:
{{- toYaml .Values.resources | nindent 12 }} {{- toYaml .Values.resources | nindent 12 }}
volumeMounts: volumeMounts:
@ -51,34 +59,6 @@ spec:
mountPath: /data mountPath: /data
- name: sniffer - name: sniffer
mountPath: {{ .Values.config.serial.port }} mountPath: {{ .Values.config.serial.port }}
{{- if .Values.assistant.enabled }}
- name: {{ .Chart.Name }}assistant
image: "{{ .Values.assistant.image.repository }}:{{ .Values.assistant.image.tag | default "latest" }}"
imagePullPolicy: {{ .Values.assistant.image.pullPolicy }}
ports:
- name: http
containerPort: 80
protocol: TCP
livenessProbe:
httpGet:
path: /
port: http
scheme: HTTP
initialDelaySeconds: {{ .Values.assistant.probes.liveness.initialDelaySeconds }}
failureThreshold: {{ .Values.assistant.probes.liveness.failureThreshold }}
timeoutSeconds: {{ .Values.assistant.probes.liveness.timeoutSeconds }}
readinessProbe:
httpGet:
path: /
port: http
scheme: HTTP
initialDelaySeconds: {{ .Values.assistant.probes.readiness.initialDelaySeconds }}
failureThreshold: {{ .Values.assistant.probes.readiness.failureThreshold }}
timeoutSeconds: {{ .Values.assistant.probes.readiness.timeoutSeconds }}
envFrom:
- configMapRef:
name: {{ include "zigbee2mqtt.fullname" . }}assistant
{{- end }}
volumes: volumes:
- name: zigbee2mqtt - name: zigbee2mqtt
configMap: configMap:

View File

@ -39,66 +39,45 @@ config:
log_output: log_output:
- console - console
assistant: # Both of these need to be enabled for the webui
enabled: true frontend:
image: port: 8080
repository: carldebilly/zigbee2mqttassistant experimental:
pullPolicy: IfNotPresent new_api: true
# Overrides the image tag whose default is latest.
tag: ""
# Config values from https://github.com/yllibed/Zigbee2MqttAssistant
# MQTT (connection or topic) parameters are retrieved from general config, but they can be overriden.
# All of them are case insensitive.
config:
lowBatteryThreshold: 30
allowJoinTimeout: 20
autosetLastSeen: false
devicesPollingSchedule: "*/12 * * * *"
networkScanSchedule: "0 */3 * * *"
probes: service:
liveness: type: ClusterIP
initialDelaySeconds: 30 port: 8080
failureThreshold: 5 ## Specify the nodePort value for the LoadBalancer and NodePort service types.
timeoutSeconds: 10 ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
readiness: ##
initialDelaySeconds: 30 # nodePort:
failureThreshold: 5 ## Provide any additional annotations which may be required. This can be used to
timeoutSeconds: 10 ## set the LoadBalancer service type to internal only.
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer
##
annotations: {}
labels: {}
## Use loadBalancerIP to request a specific static IP,
## otherwise leave blank
##
loadBalancerIP:
# loadBalancerSourceRanges: []
## Set the externalTrafficPolicy in the Service to either Cluster or Local
# externalTrafficPolicy: Cluster
service: ingress:
type: ClusterIP enabled: false
port: 8091 annotations: {}
## Specify the nodePort value for the LoadBalancer and NodePort service types. # kubernetes.io/ingress.class: nginx
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport # kubernetes.io/tls-acme: "true"
## path: /
# nodePort: hosts:
## Provide any additional annotations which may be required. This can be used to - chart-example.local
## set the LoadBalancer service type to internal only. tls: []
## ref: https://kubernetes.io/docs/concepts/services-networking/service/#internal-load-balancer # - secretName: chart-example-tls
## # hosts:
annotations: {} # - chart-example.local
labels: {}
## Use loadBalancerIP to request a specific static IP,
## otherwise leave blank
##
loadBalancerIP:
# loadBalancerSourceRanges: []
## Set the externalTrafficPolicy in the Service to either Cluster or Local
# externalTrafficPolicy: Cluster
ingress:
enabled: false
annotations: {}
# kubernetes.io/ingress.class: nginx
# kubernetes.io/tls-acme: "true"
path: /
hosts:
- chart-example.local
tls: []
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
persistence: persistence:
enabled: false enabled: false