Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
11 changes: 10 additions & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion docker/mqtt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
11 changes: 11 additions & 0 deletions translations/en.yaml
Original file line number Diff line number Diff line change
@@ -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.