From 4545341660268d3cb5364cd94bc3234d27f8fac4 Mon Sep 17 00:00:00 2001 From: Olivier Mignault Date: Fri, 9 May 2025 14:25:00 -0400 Subject: [PATCH 1/2] update --- config.yaml | 6 ++++++ docker/entrypoint.sh | 11 ++++++++++- docker/mqtt.sh | 5 ++++- translations/en.yaml | 11 +++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 translations/en.yaml diff --git a/config.yaml b/config.yaml index 1793b3c..0a8dda7 100644 --- a/config.yaml +++ b/config.yaml @@ -14,3 +14,9 @@ arch: boot: auto services: - mqtt:need +options: + mqtt_push: false + mqtt_frequency: 5 +schema: + mqtt_push: bool + mqtt_frequency: int(1,120) diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh index 9817016..7662841 100644 --- a/docker/entrypoint.sh +++ b/docker/entrypoint.sh @@ -6,7 +6,16 @@ echo "Starting MQTT publishing script..." date # Start MQTT publishing in the background -/app/mqtt.sh & +CONFIG_PATH=/data/options.json +MQTT_PUSH=$(jq -r '.mqtt_push // false' $CONFIG_PATH) + +if [ "$MQTT_PUSH" == "true" ]; then + echo "MQTT Push is enabled" + /app/mqtt.sh & +else + echo "MQTT Push is disabled" +fi + # Now start the original entrypoint or command exec /app/orb sensor diff --git a/docker/mqtt.sh b/docker/mqtt.sh index d02e0de..980ea86 100644 --- a/docker/mqtt.sh +++ b/docker/mqtt.sh @@ -10,6 +10,9 @@ MQTT_PORT=$(echo "$MQTT_INFO" | jq -r '.data.port') MQTT_USER=$(echo "$MQTT_INFO" | jq -r '.data.username') MQTT_PASS=$(echo "$MQTT_INFO" | jq -r '.data.password') +CONFIG_PATH=/data/options.json +MQTT_PAUSE=$(jq -r '.mqtt_frequency // 5' $CONFIG_PATH) + echo "MQTT Host: $MQTT_HOST" echo "MQTT Port: $MQTT_PORT" echo "MQTT User: $MQTT_USER" @@ -82,5 +85,5 @@ while true; do mosquitto_pub -h "$MQTT_HOST" -p "$MQTT_PORT" -u "$MQTT_USER" -P "$MQTT_PASS" \ -t "$STATE_TOPIC" -m "$ORB_OUTPUT" -r - sleep 15 + sleep "$MQTT_PAUSE" done diff --git a/translations/en.yaml b/translations/en.yaml new file mode 100644 index 0000000..f699616 --- /dev/null +++ b/translations/en.yaml @@ -0,0 +1,11 @@ +--- +configuration: + mqtt_push: + name: Push Scores to MQTT + description: >- + If set to `true`, the Orb will push scores to the MQTT broker. + mqtt_frequency: + name: MQTT Frequency + description: >- + The frequency in seconds at which the Orb will push scores to the MQTT + broker. From 228a40c2cf6f9c48163923b343b488a6f37c3874 Mon Sep 17 00:00:00 2001 From: Olivier Mignault Date: Fri, 9 May 2025 14:27:09 -0400 Subject: [PATCH 2/2] adjust image --- config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.yaml b/config.yaml index 0a8dda7..c85370e 100644 --- a/config.yaml +++ b/config.yaml @@ -4,7 +4,7 @@ version: "1.0.1" slug: "orb_homeassistant" init: false host_network: true -image: "orbforge/orb" +image: "orbforge/orb-ha" environment: ORB_DATA_DIR: /data arch: