Skip to content

Commit

Permalink
Merge pull request #4 from andrenarchy/feature/zigbee2mqtt
Browse files Browse the repository at this point in the history
Add zigbee2mqtt
  • Loading branch information
andrenarchy authored Dec 2, 2023
2 parents fe50d7e + 5eb4074 commit 42c8fcb
Show file tree
Hide file tree
Showing 16 changed files with 409 additions and 6 deletions.
2 changes: 1 addition & 1 deletion charts/home-assistant/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v2
appVersion: 2023.11.3
description: Home Assistant
name: home-assistant
version: 14.2.1
version: 14.2.2
kubeVersion: ">=1.16.0-0"
keywords:
- home-assistant
Expand Down
2 changes: 1 addition & 1 deletion charts/home-assistant/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Kubernetes: `>=1.16.0-0`
## TL;DR

```console
helm repo add andrenarchy https://k8s-at-home.com/charts/
helm repo add andrenarchy https://andrenarchy.github.io/helm-charts/
helm repo update
helm install home-assistant andrenarchy/home-assistant
```
Expand Down
2 changes: 1 addition & 1 deletion charts/photoprism/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v2
appVersion: "231128"
description: PhotoPrism® is a server-based application for browsing, organizing and sharing your personal photo collection
name: photoprism
version: 8.1.0
version: 8.1.1
kubeVersion: ">=1.16.0-0"
keywords:
- photos
Expand Down
2 changes: 1 addition & 1 deletion charts/photoprism/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Kubernetes: `>=1.16.0-0`
## TL;DR

```console
helm repo add andrenarchy https://k8s-at-home.com/charts/
helm repo add andrenarchy https://andrenarchy.github.io/helm-charts/
helm repo update
helm install photoprism andrenarchy/photoprism
```
Expand Down
2 changes: 1 addition & 1 deletion charts/vaultwarden/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v2
appVersion: 1.30.1
description: Vaultwarden is a Bitwarden compatable server in Rust
name: vaultwarden
version: 6.0.2
version: 6.0.3
kubeVersion: ">=1.16.0-0"
keywords:
- Vaultwarden
Expand Down
2 changes: 1 addition & 1 deletion charts/vaultwarden/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Kubernetes: `>=1.16.0-0`
## TL;DR

```console
helm repo add andrenarchy https://k8s-at-home.com/charts/
helm repo add andrenarchy https://andrenarchy.github.io/helm-charts/
helm repo update
helm install vaultwarden andrenarchy/vaultwarden
```
Expand Down
26 changes: 26 additions & 0 deletions charts/zigbee2mqtt/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
6 changes: 6 additions & 0 deletions charts/zigbee2mqtt/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 4.5.2
digest: sha256:408d12aa9bbce6dfd4ced5c2586d92dfa518821e01823081fa9a141243b3160c
generated: "2022-12-04T22:58:52.344926901+01:00"
22 changes: 22 additions & 0 deletions charts/zigbee2mqtt/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
apiVersion: v2
appVersion: 1.33.2
description: Bridges events and allows you to control your Zigbee devices via MQTT
name: zigbee2mqtt
version: 9.4.2
kubeVersion: ">=1.16.0-0"
keywords:
- zigbee
- mqtt
- home-assistant
home: https://github.com/andrenarchy/helm-charts/tree/main/charts/zigbee2mqtt
icon: https://www.zigbee2mqtt.io/logo.png
sources:
- https://github.com/Koenkk/zigbee2mqtt
maintainers:
- name: André Gaul
email: [email protected]
dependencies:
- name: common
repository: https://library-charts.k8s-at-home.com
version: 4.5.2
127 changes: 127 additions & 0 deletions charts/zigbee2mqtt/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
# zigbee2mqtt

Bridges events and allows you to control your Zigbee devices via MQTT

Helm chart originally based on a chart from [k8s-at-home](https://github.com/k8s-at-home/charts).

## Source Code

* <https://github.com/Koenkk/zigbee2mqtt>

## Requirements

Kubernetes: `>=1.16.0-0`

## Dependencies

| Repository | Name | Version |
|------------|------|---------|
| https://library-charts.k8s-at-home.com | common | 4.5.2 |

## TL;DR

```console
helm repo add andrenarchy https://andrenarchy.github.io/helm-charts/
helm repo update
helm install zigbee2mqtt andrenarchy/zigbee2mqtt
```

## Installing the Chart

To install the chart with the release name `zigbee2mqtt`

```console
helm install zigbee2mqtt andrenarchy/zigbee2mqtt
```

## Uninstalling the Chart

To uninstall the `zigbee2mqtt` deployment

```console
helm uninstall zigbee2mqtt
```

The command removes all the Kubernetes components associated with the chart **including persistent volumes** and deletes the release.

## Configuration

Read through the [values.yaml](./values.yaml) file. It has several commented out suggested values.
Other values may be used from the [values.yaml](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common/values.yaml) from the [common library](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common).

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.

```console
helm install zigbee2mqtt \
--set env.TZ="America/New York" \
andrenarchy/zigbee2mqtt
```

Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart.

```console
helm install zigbee2mqtt andrenarchy/zigbee2mqtt -f values.yaml
```

## Custom configuration

**IMPORTANT NOTE:** a zigbee controller device must be accessible on the node where this pod runs, in order for this chart to function properly.

First, you will need to mount your zigbee device into the pod, you can do so by adding the following to your values:

```yaml
additionalVolumeMounts:
- name: usb
mountPath: /path/to/device

additionalVolumes:
- name: usb
hostPath:
path: /path/to/device
```
Second you will need to set a nodeAffinity rule, for example:
```yaml
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: app
operator: In
values:
- zigbee-controller
```
... where a node with an attached zigbee controller USB device is labeled with `app: zigbee-controller`

If you are getting errors, that the device cannot be opened when starting Zigbee2Mqtt, try uncommenting the privileged flag:

```
securityContext:
privileged: true
```

## Values

**Important**: When deploying an application Helm chart you can add more values from our common library chart [here](https://github.com/k8s-at-home/library-charts/tree/main/charts/stable/common)

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | Affinity constraint rules to place the Pod on a specific node. [[ref]](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#affinity-and-anti-affinity) |
| config | object | See values.yaml | zigbee2mqtt configuration settings. This will be copied into the container's persistent storage at first run only. Further configuration should be done in the application itself! See [project documentation](https://www.zigbee2mqtt.io/information/configuration.html) for more information. |
| config.advanced | object | `{"homeassistant_discovery_topic":"homeassistant","homeassistant_status_topic":"homeassistant/status","last_seen":"ISO_8601","log_level":"info","log_output":["console"],"network_key":"GENERATE"}` | port: /dev/serial/by-id/usb-dresden_elektronik_ingenieurtechnik_GmbH_ConBee_II_DE2400981-if00 Optional: adapter type, not needed unless you are experiencing problems (options: zstack, deconz) adapter: deconz |
| config.advanced.last_seen | string | `"ISO_8601"` | default: 11 channel: 11 Optional: Baudrate for serial port (default: 115200 for Z-Stack, 38400 for Deconz) baudrate: 38400 Optional: RTS / CTS Hardware Flow Control for serial port (default: false) rtscts: true Optional: Add a last_seen attribute to MQTT messages, contains date/time of last Zigbee message possible values are: disable (default), ISO_8601, ISO_8601_local, epoch (default: disable) |
| config.homeassistant | bool | `false` | Home Assistant integration (MQTT discovery) |
| config.permit_join | bool | `true` | WARNING: Disable this after all devices have been paired! (default: false) Note: this will be controllable in the UI |
| env | object | See below | environment variables. See [image docs](https://www.zigbee2mqtt.io/information/configuration.html#override-via-environment-variables) for more details. |
| env.ZIGBEE2MQTT_DATA | string | `"/data"` | Set the data folder for Zigbee2MQTT. |
| image.pullPolicy | string | `"IfNotPresent"` | image pull policy |
| image.repository | string | `"koenkk/zigbee2mqtt"` | image repository |
| image.tag | string | `"1.19.1"` | image tag |
| ingress.main | object | See values.yaml | Enable and configure ingress settings for the chart under this key. |
| persistence | object | See values.yaml | Configure persistence settings for the chart under this key. |
| persistence.usb | object | See values.yaml | Configure a hostPathMount to mount a USB device in the container. |
| securityContext.privileged | bool | `nil` | Privileged securityContext may be required if USB controller is accessed directly through the host machine |
| service | object | See values.yaml | Configures service settings for the chart. Normally this does not need to be modified. |
45 changes: 45 additions & 0 deletions charts/zigbee2mqtt/README_CONFIG.md.gotmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{- define "custom.custom.configuration.header" -}}
## Custom configuration
{{- end -}}

{{- define "custom.custom.configuration" -}}
{{ template "custom.custom.configuration.header" . }}

**IMPORTANT NOTE:** a zigbee controller device must be accessible on the node where this pod runs, in order for this chart to function properly.

First, you will need to mount your zigbee device into the pod, you can do so by adding the following to your values:

```yaml
additionalVolumeMounts:
- name: usb
mountPath: /path/to/device

additionalVolumes:
- name: usb
hostPath:
path: /path/to/device
```

Second you will need to set a nodeAffinity rule, for example:

```yaml
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: app
operator: In
values:
- zigbee-controller
```

... where a node with an attached zigbee controller USB device is labeled with `app: zigbee-controller`

If you are getting errors, that the device cannot be opened when starting Zigbee2Mqtt, try uncommenting the privileged flag:

```
securityContext:
privileged: true
```
{{- end -}}
9 changes: 9 additions & 0 deletions charts/zigbee2mqtt/ci/ct-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ingress:
main:
enabled: true

persistence:
data:
enabled: true
type: emptyDir
mountPath: /data
1 change: 1 addition & 0 deletions charts/zigbee2mqtt/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{- include "common.notes.defaultNotes" . -}}
17 changes: 17 additions & 0 deletions charts/zigbee2mqtt/templates/common.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{/* Make sure all variables are set properly */}}
{{- include "common.values.setup" . }}

{{/* Append the configMap volume to the volumes */}}
{{- define "zigbee2mqtt.settingsVolume" -}}
enabled: "true"
mountPath: "/app/configuration.yaml"
subPath: "configuration.yaml"
type: "custom"
volumeSpec:
configMap:
name: {{ include "common.names.fullname" . }}-settings
{{- end -}}
{{- $_ := set .Values.persistence "zigbee2mqtt-settings" (include "zigbee2mqtt.settingsVolume" . | fromYaml) -}}

{{/* Render the templates */}}
{{ include "common.all" . }}
13 changes: 13 additions & 0 deletions charts/zigbee2mqtt/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{{- include "common.values.setup" . -}}
---
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ template "common.names.fullname" . }}-settings
labels:
{{- include "common.labels" . | nindent 4 }}
data:
configuration.yaml: |
{{- with .Values.config }}
{{- toYaml . | nindent 4 }}
{{- end }}
Loading

0 comments on commit 42c8fcb

Please sign in to comment.