Skip to content

Commit

Permalink
Upgrade Theengs Gateway to 1.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
koenvervloesem committed Feb 11, 2024
1 parent cefe73e commit 546242d
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 4 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ $ snap get -d theengs-gateway
"scan-duration": 5,
"time-between": 5
},
"general-presence": 0,
"ha": {
"discovery": 1,
"discovery-device-name": "TheengsGateway",
Expand Down
24 changes: 24 additions & 0 deletions scripts/bin/management-script
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ DEFAULT_BINDKEYS=""
DEFAULT_IDENTITIES=""
DEFAULT_ENABLE_BLE="1"
DEFAULT_TRACKER_TIMEOUT="120"
DEFAULT_GENERAL_PRESENCE="0"

# ADAPTER
adapter() {
Expand Down Expand Up @@ -647,3 +648,26 @@ previous_tracker_timeout() {
set_previous_tracker_timeout() {
snapctl set private.tracker-timeout="$1"
}

# GENERAL PRESENCE
general_presence() {
general_presence_enable="$(snapctl get general-presence)"
if [ -z "$general_presence_enable" ]; then
general_presence_enable="$DEFAULT_GENERAL_PRESENCE"
set_general_presence "$general_presence_enable"
set_previous_general_presence "$general_presence_enable"
fi
echo "$general_presence_enable"
}

set_general_presence() {
snapctl set general-presence="$1"
}

previous_general_presence() {
snapctl get private.general-presence
}

set_previous_general_presence() {
snapctl set private.general-presence="$1"
}
4 changes: 3 additions & 1 deletion scripts/bin/theengs-gateway-wrapper
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,7 @@ ENABLE_BLE="$(enable_ble)"
export ENABLE_BLE
TRACKER_TIMEOUT="$(tracker_time)"
export TRACKER_TIMEOUT
GENERAL_PRESENCE="$(general_presence)"
export GENERAL_PRESENCE

"$SNAP/bin/TheengsGateway" -H "$HOST" -P "$PORT" -u "$USER" -p "$PASS" -pt "$PUB_TOPIC" -st "$SUB_TOPIC" -sd "$SCAN_DUR" -tb "$TIME_BETWEEN" -ll "$LOG_LEVEL" -Dt "$DISCOVERY_TOPIC" -D "$DISCOVERY" -Dh "$HASS_DISCOVERY" -Dn "$DISCOVERY_DEVICE_NAME" -Df "$DISCOVERY_FILTER" -a "$ADAPTER" -ts "$TIME_SYNC" -tf "$TIME_FORMAT" -prt "$PRESENCE_TOPIC" -pr "$PRESENCE" -Lt "$LWT_TOPIC" -padv "$PUBLISH_ADVDATA" -tls "$ENABLE_TLS" -ws "$ENABLE_WS" -bk "$BINDKEYS" -id "$IDENTITIES" -b "$ENABLE_BLE" -to "$TRACKER_TIMEOUT"
"$SNAP/bin/TheengsGateway" -H "$HOST" -P "$PORT" -u "$USER" -p "$PASS" -pt "$PUB_TOPIC" -st "$SUB_TOPIC" -sd "$SCAN_DUR" -tb "$TIME_BETWEEN" -ll "$LOG_LEVEL" -Dt "$DISCOVERY_TOPIC" -D "$DISCOVERY" -Dh "$HASS_DISCOVERY" -Dn "$DISCOVERY_DEVICE_NAME" -Df "$DISCOVERY_FILTER" -a "$ADAPTER" -ts "$TIME_SYNC" -tf "$TIME_FORMAT" -prt "$PRESENCE_TOPIC" -pr "$PRESENCE" -Lt "$LWT_TOPIC" -padv "$PUBLISH_ADVDATA" -tls "$ENABLE_TLS" -ws "$ENABLE_WS" -bk "$BINDKEYS" -id "$IDENTITIES" -b "$ENABLE_BLE" -to "$TRACKER_TIMEOUT" -Gp "$GENERAL_PRESENCE"
15 changes: 15 additions & 0 deletions snap/hooks/configure
Original file line number Diff line number Diff line change
Expand Up @@ -415,3 +415,18 @@ handle_tracker_timeout_config() {
restart_gateway_if_running
}
handle_tracker_timeout_config

handle_general_presence_config() {
general_presence="$(general_presence)"
previous_general_presence="$(previous_general_presence)"

if [ "$general_presence" = "$previous_general_presence" ]; then
return 0
fi

set_general_presence "$general_presence"
set_previous_general_presence "$general_presence"

restart_gateway_if_running
}
handle_general_presence_config
6 changes: 3 additions & 3 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ description: |
LYWSDCGQ, and Mi Flora. It translates these data into a readable JSON
format and pushes those to an MQTT broker.
icon: snap/local/logo-Theengs.png
version: 1.3.0
version: 1.4.0
license: GPL-3.0
contact: [email protected]
website: https://github.com/theengs/gateway-snap
Expand All @@ -28,7 +28,7 @@ parts:
theengs-decoder:
plugin: python
source: https://github.com/theengs/decoder.git
source-tag: v1.6.8
source-tag: v1.7.0
source-subdir: python
override-pull: |
craftctl default
Expand All @@ -52,7 +52,7 @@ parts:
- theengs-decoder
plugin: python
source: https://github.com/theengs/gateway.git
source-tag: v1.3.0
source-tag: v1.4.0
override-pull: |
craftctl default
# Don't build Theengs Decoder as a dependency,
Expand Down

0 comments on commit 546242d

Please sign in to comment.