From eaa06cb79dfbda4cfa8c2e3655816ea41a547bb0 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Tue, 29 Aug 2023 14:14:04 -0400 Subject: [PATCH] fix(ring-mqtt) add config.json (#11905) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** a potential fix to manually create the config.json ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [X] ⚖️ My code follows the style guidelines of this project - [X] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [X] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --------- Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/stable/ring-mqtt/Chart.yaml | 2 +- .../ring-mqtt/docs/installation_notes.md | 24 ++- charts/stable/ring-mqtt/questions.yaml | 162 ++++++++---------- .../stable/ring-mqtt/templates/_configmap.tpl | 13 ++ charts/stable/ring-mqtt/templates/common.yaml | 11 +- charts/stable/ring-mqtt/values.yaml | 67 +++++--- 6 files changed, 146 insertions(+), 133 deletions(-) create mode 100644 charts/stable/ring-mqtt/templates/_configmap.tpl diff --git a/charts/stable/ring-mqtt/Chart.yaml b/charts/stable/ring-mqtt/Chart.yaml index fb9a12fc556..c77637ae925 100644 --- a/charts/stable/ring-mqtt/Chart.yaml +++ b/charts/stable/ring-mqtt/Chart.yaml @@ -22,7 +22,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/stable/ring-mqtt - https://github.com/tsightler/ring-mqtt type: application -version: 5.0.0 +version: 5.1.0 annotations: truecharts.org/catagories: | - HomeAutomation diff --git a/charts/stable/ring-mqtt/docs/installation_notes.md b/charts/stable/ring-mqtt/docs/installation_notes.md index 6ccb696c3ac..aa1a47aeb0d 100644 --- a/charts/stable/ring-mqtt/docs/installation_notes.md +++ b/charts/stable/ring-mqtt/docs/installation_notes.md @@ -8,19 +8,17 @@ ## Ring-MQTT setup -- `RINGTOKEN` can be left blank as you can auth through the temporarily web interface which is just for the authorization of your ring account. -- Go to `http://SCALE_IP:55123`. -- Set `MQTTHOST` to **mosquitto.ix-mosquitto.svc.cluster.local**. -- Set `MQTTPORT` to **1883**. -- Set `MQTTUSER` to **user_name** from the authentication setup. -- Set `MQTTPASSWORD` to **user_pass** from the authentication setup. -- Set `ENABLECAMERAS` to **true** to enable cameras. -- Set `SNAPSHOTMODE` to **Auto** to optimize based on high vs low-power Ring devices. -- Set `ENABLEMODES` to **false**. -- Set `ENABLEPANIC` to **false**. -- Set `BEAMDURATION` to **0**. -- Leave `DISARMCODE` blank. -- Leave `RINGLOCATIONIDS` blank. +Go to `http://SCALE_IP:55123`. + +- Set `MQTT Url` to **mqtt://@mosquitto.ix-mosquitto.svc.cluster.local:1883** if not using mqtt auth or set the user/pass in the url like so: **mqtt://USER:PASS@mosquitto.ix-mosquitto.svc.cluster.local:1883**. +- Set `LiveStream User` to **user_name** for the RTSP user. +- Set `LiveStream Password` to **user_pass** for the RTSP user. +- Leave `Disarm Code` blank. +- Set `Enable Cameras` to **true** to enable cameras. +- Set `Enable Modes` to **false** to disable location modes. +- Set `Enable Panic` to **false** to disable panic button. +- Set `Hass Topic` to **homeassistant/status** for the topic to monitor for Home Assistant restarts. +- Leave `Location Ids` blank. ## Home-assistant setup diff --git a/charts/stable/ring-mqtt/questions.yaml b/charts/stable/ring-mqtt/questions.yaml index bd3dd19e65a..e688d718970 100644 --- a/charts/stable/ring-mqtt/questions.yaml +++ b/charts/stable/ring-mqtt/questions.yaml @@ -9,101 +9,79 @@ questions: # Include{podSpec} # Include{containerMain} - - variable: env - group: "App Configuration" - label: "Image Environment" - schema: - additional_attrs: true - type: dict - attrs: - - variable: RINGTOKEN - label: "RINGTOKEN" - description: "RINGTOKEN can be left blank for web authenticated." - schema: - type: string - private: true - default: "" - - variable: MQTTUSER - label: "MQTTUSER" - description: "Set a username for your MQTT instance." - schema: - type: string - default: "" - - variable: MQTTPASSWORD - label: "MQTTPASSWORD" - description: "Set a password for your MQTT instance." - schema: - type: string - default: "" - private: true - - variable: MQTTHOST - label: "MQTTHOST" - description: "Set the MQTT host cluster url or ip. ex: `mosquitto.ix-mosquitto.svc.cluster.local`." - schema: - type: string - default: "" - - variable: MQTTPORT - label: "MQTTPORT" - description: "Set MQTTPORT to the port that your MQTT uses." - schema: - type: int - default: 1883 - - variable: ENABLECAMERAS - label: "ENABLECAMERAS" - description: "Default false since the native Ring component for Home Assistant supports cameras, set to true to enable camera/chime support in this add-on. Access to Chimes cannot be granted to shared users so Chime support requires use of the primary Ring account." - schema: - type: boolean - default: false - - variable: SNAPSHOTMODE - label: "SNAPSHOTMODE" - description: "Set SNAPSHOTMODE to [`Auto``, `Motion`, `Interval`, `All`] or default `disabled`" - schema: - type: string - default: "disabled" - enum: - - value: disabled - description: Disabled - - value: auto - description: Auto - - value: motion - description: Motion - - value: interval - description: Interval - - value: all - description: All - - variable: ENABLEMODES - label: "ENABLEMODES" - description: "Enable support for Location Modes for sites without a Ring Alarm Panel." - schema: - type: boolean - default: false - - variable: ENABLEPANIC - label: "ENABLEPANIC" - description: "Enable panic buttons on Alarm Control Panel device." - schema: - type: boolean - default: false - - variable: BEAMDURATION - label: "BEAMDURATION" - description: "Container Variable BEAMDURATION" - schema: - type: string - default: "0" - - variable: DISARMCODE - label: "DISARMCODE" - description: "Used only with Home Assistant, when defined this option causes the Home Assistant Alarm Control Panel integration to require entering this code to disarm the alarm" - schema: - type: string - default: "" - - variable: RINGLOCATIONIDS - label: "RINGLOCATIONIDS" - description: "Array of location Ids in format: [`loc-id`, `loc-id2`], see [Limiting Locations](https://github.com/tsightler/ring-mqtt/wiki/Configuration-Details#limiting-locations) for details." - schema: - type: string - default: "" # Include{containerBasic} # Include{containerAdvanced} + - variable: ring + group: App Configuration + label: Ring-Mqtt + schema: + additional_attrs: true + type: dict + attrs: + - variable: mqtt_url + label: MQTT Url + description: URL for connecting to MQTT broker in standard MQTT URL format. + schema: + type: string + required: true + default: "mqtt://mosquitto.ix-mosquitto.svc.cluster.local:1883" + - variable: livestream_user + label: LiveStream User + description: Specify a user for RTSP connections. + schema: + type: string + default: "" + - variable: livestream_pass + label: LiveStream Password + description: Specify a password for RTSP connections. + schema: + type: string + private: true + default: "" + - variable: disarm_code + label: Disarm Code + description: Home Assistant Alarm Control Panel integration require entering this code to disarm the alarm + schema: + type: string + default: "" + - variable: enable_cameras + label: Enable Cameras + description: Enables support for camera/chimes. + schema: + type: boolean + default: true + - variable: enable_modes + label: Enable Modes + description: Enable support for Location Modes for sites without a Ring Alarm Panel. + schema: + type: boolean + default: false + - variable: enable_panic + label: Enable Panic + description: Enable panic buttons on Alarm Control Panel device. + schema: + type: boolean + default: false + - variable: hass_topic + label: Hass Topic + description: The topic to monitor for Home Assistant restarts (MQTT birth/last will messages) + schema: + type: string + default: "homeassistant/status" + - variable: location_ids + label: Location Ids + schema: + type: list + default: [] + items: + - variable: location + label: Location + schema: + type: string + required: true + default: "" + # Include{containerConfig} # Include{podOptions} # Include{serviceRoot} diff --git a/charts/stable/ring-mqtt/templates/_configmap.tpl b/charts/stable/ring-mqtt/templates/_configmap.tpl new file mode 100644 index 00000000000..2a3eb30b50a --- /dev/null +++ b/charts/stable/ring-mqtt/templates/_configmap.tpl @@ -0,0 +1,13 @@ +{{/* Define the configmap */}} +{{- define "ring.configmaps" -}} +{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}} + +{{- $ring := .Values.ring -}} + +ring-config: + enabled: true + data: + config.json: | + {{ $ring | toJson }} + +{{- end -}} diff --git a/charts/stable/ring-mqtt/templates/common.yaml b/charts/stable/ring-mqtt/templates/common.yaml index 78d963fb168..93ff72b8442 100644 --- a/charts/stable/ring-mqtt/templates/common.yaml +++ b/charts/stable/ring-mqtt/templates/common.yaml @@ -1,2 +1,11 @@ +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Render configmaps for all pods */}} +{{- $configmaps := include "ring.configmaps" . | fromYaml -}} +{{- if $configmaps -}} + {{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}} +{{- end -}} + {{/* Render the templates */}} -{{ include "tc.v1.common.loader.all" . }} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/stable/ring-mqtt/values.yaml b/charts/stable/ring-mqtt/values.yaml index 90f301a24f5..bc623d1026a 100644 --- a/charts/stable/ring-mqtt/values.yaml +++ b/charts/stable/ring-mqtt/values.yaml @@ -2,6 +2,14 @@ image: pullPolicy: IfNotPresent repository: tccr.io/truecharts/ring-mqtt tag: v5.5.1@sha256:948260b12bf1024af6042ac6a64733fa8556340959f1d7af4ddac4ab8488189d + +securityContext: + container: + readOnlyRootFilesystem: false + runAsNonRoot: false + runAsGroup: 0 + runAsUser: 0 + service: main: ports: @@ -17,19 +25,20 @@ service: protocol: tcp targetPort: 8554 port: 8554 -persistence: - data: - enabled: true - mountPath: /data -portal: - open: - enabled: false -securityContext: - container: - readOnlyRootFilesystem: false - runAsNonRoot: false - runAsGroup: 0 - runAsUser: 0 + +ring: + mqtt_url: "mqtt://localhost:1883" + mqtt_options: "" + livestream_user: "" + livestream_pass: "" + disarm_code: "" + enable_cameras: true + enable_modes: false + enable_panic: false + hass_topic: "homeassistant/status" + ring_topic: "ring" + location_ids": [] + workload: main: podSpec: @@ -42,16 +51,22 @@ workload: enabled: false startup: enabled: false - env: - BEAMDURATION: "0" - DISARMCODE: "" - ENABLECAMERAS: "false" - ENABLEMODES: "false" - ENABLEPANIC: "false" - MQTTHOST: "" - MQTTPORT: "1883" - RINGLOCATIONIDS: "" - SNAPSHOTMODE: disabled - RINGTOKEN: "" - MQTTUSER: "" - MQTTPASSWORD: "" + +persistence: + data: + enabled: true + mountPath: /data + ring-config: + enabled: true + type: configmap + objectName: ring-config + targetSelector: + main: + main: + mountPath: /data/config.json + subPath: config.json + readOnly: true + +portal: + open: + enabled: false