Skip to content

Commit 338f92e

Browse files
authored
Merge pull request #681 from jasonacox/v4.8.5
v4.8.5
2 parents 69e1ee0 + 180b3d6 commit 338f92e

File tree

4 files changed

+103
-8
lines changed

4 files changed

+103
-8
lines changed

RELEASE.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# RELEASE NOTES
22

3-
## v4.x.x - Unreleased
3+
## v4.8.5 - Setup and Verify
44

55
* Add enhanced log display options to `verify.sh`: supports `--logs` and `--no-logs` flags to control log output, and interactive prompt for log viewing. Log output is now cleaner and only shown when requested.
6-
*
6+
* Add input validation for timezone entry in `setup.sh` to prevent invalid/corrupt values in configuration files. Timezone is now checked against system zoneinfo and format before acceptance.
7+
* Update pypowerwall to v0.14.1 - See updates: https://github.com/jasonacox/pypowerwall/releases/tag/v0.14.1 for error handling updates.
78

89
## v4.8.4 - pyPowerwall update
910

@@ -321,11 +322,11 @@ curl http://localhost:8675/control/reserve
321322

322323
* Updated timezone variable in `dashboard.json` to tz:text to ensure the Time Zone string is output as-is. This will make upgrading Grafana easier later on and future-proof the variables by @s-crypt in #439.
323324
* Removed $tz from any queries that do not have a GROUP BY statement by @s-crypt in #439.
324-
* Updated pyPowerwall Proxy t42 - Adds Power Flow Animation style (set PW_STYLE="solar") for Solar-Only display. Removes the Powerwall image and related text to display a Grid + Solar + Home power flow animation.
325+
* Updated pyPowerWall Proxy t42 - Adds Power Flow Animation style (set PW_STYLE="solar") for Solar-Only display. Removes the Powerwall image and related text to display a Grid + Solar + Home power flow animation.
325326

326327
## v4.0.4 - Cloud Grid Status
327328

328-
* Update to pyPowerwall v0.7.9 - Bug fix to render correct grid status for Solar-Only systems on cloud mode (see #437)
329+
* Update to pyPowerWall v0.7.9 - Bug fix to render correct grid status for Solar-Only systems on cloud mode (see #437)
329330

330331
## v4.0.3 - Cloud Mode Fixes
331332

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.8.4
1+
4.8.5

powerwall.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ services:
2424
start_period: 60s
2525

2626
pypowerwall:
27-
image: jasonacox/pypowerwall:0.14.0t80
27+
image: jasonacox/pypowerwall:0.14.1t81
2828
container_name: pypowerwall
2929
hostname: pypowerwall
3030
restart: unless-stopped

setup.sh

Lines changed: 96 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,102 @@ fi
279279

280280
CURRENT=`cat tz`
281281

282-
echo "Timezone (leave blank for ${CURRENT})"
283-
read -p 'Enter Timezone: ' TZ
282+
# Function to display a (filtered) paginated list of timezones
283+
show_timezones() {
284+
local FILTER="$1"
285+
local LIST_CMD=""
286+
if command -v timedatectl >/dev/null 2>&1; then
287+
LIST_CMD="timedatectl list-timezones"
288+
elif [ -f /usr/share/zoneinfo/zone.tab ]; then
289+
# Escape $3 so shell doesn't expand it before awk runs
290+
LIST_CMD="awk '!/^#/ {print \\$3}' /usr/share/zoneinfo/zone.tab"
291+
else
292+
LIST_CMD="find /usr/share/zoneinfo -type f -maxdepth 4 2>/dev/null | sed 's#^/usr/share/zoneinfo/##'"
293+
fi
294+
295+
# Build list (apply optional filter) - allow zero matches without aborting
296+
if [ -n "$FILTER" ]; then
297+
TZ_LIST=$( { eval "$LIST_CMD" | grep -F "$FILTER" || true; } | sort )
298+
else
299+
TZ_LIST=$(eval "$LIST_CMD" | sort)
300+
fi
301+
302+
if [ -z "$TZ_LIST" ]; then
303+
echo "No timezones match filter '$FILTER'."
304+
return 0
305+
fi
306+
307+
# If less is available and stdout is a TTY, use it for paging
308+
if command -v less >/dev/null 2>&1 && [ -t 1 ]; then
309+
echo "$TZ_LIST" | less
310+
return 0
311+
fi
312+
313+
# Manual pagination fallback
314+
local PAGE_SIZE=30
315+
local count=0
316+
while IFS= read -r line; do
317+
printf '%s\n' "$line"
318+
count=$((count+1))
319+
if (( count % PAGE_SIZE == 0 )); then
320+
read -p "--More-- (Enter=continue, q=quit) " ans
321+
[[ "$ans" == "q" || "$ans" == "Q" ]] && break
322+
fi
323+
done <<< "$TZ_LIST"
324+
}
325+
326+
327+
# Timezone input validation
328+
echo "Timezone (leave blank for ${CURRENT} or ? to browse)"
329+
while true; do
330+
read -p 'Enter Timezone: ' TZ
331+
if [ "$TZ" = "?" ]; then
332+
read -p 'Optional filter (e.g., America/ or Europe/Paris): ' TZFILT
333+
show_timezones "$TZFILT"
334+
continue
335+
fi
336+
if [ -z "$TZ" ]; then
337+
TZ="$CURRENT"
338+
break
339+
fi
340+
341+
# 1) timedatectl (most accurate, includes multi-level names)
342+
if command -v timedatectl >/dev/null 2>&1; then
343+
if timedatectl list-timezones 2>/dev/null | grep -Fx "$TZ" >/dev/null; then
344+
break
345+
fi
346+
fi
347+
348+
# 2) Direct zoneinfo file path (supports multi-level e.g. America/Argentina/Buenos_Aires)
349+
if [ -f "/usr/share/zoneinfo/$TZ" ]; then
350+
break
351+
fi
352+
353+
# 3) Check zone.tab third column (if present) – some systems lack timedatectl
354+
if [ -f /usr/share/zoneinfo/zone.tab ]; then
355+
if awk '{print $3}' /usr/share/zoneinfo/zone.tab | grep -Fx "$TZ" >/dev/null; then
356+
break
357+
fi
358+
fi
359+
360+
# 4) POSIX / RFC style TZ strings (e.g. GMT, UTC, GMT+5, EST5EDT, etc.)
361+
# Only accept if it contains at least one alphabetic character to avoid numeric garbage like '1'.
362+
if [[ "$TZ" =~ [A-Za-z] ]]; then
363+
if TZ="$TZ" date +%Z >/dev/null 2>&1; then
364+
echo "Note: '$TZ' accepted as POSIX TZ string (not an Olson zone identifier)."
365+
break
366+
fi
367+
fi
368+
369+
echo ""
370+
echo "WARNING: '$TZ' is not a recognized timezone."
371+
echo -n "Do you wish to use this timezone anyway? [y/N] "
372+
read -r response
373+
if [[ "$response" =~ ^([yY][eE][sS]|[yY])$ ]]; then
374+
break
375+
fi
376+
echo ""
377+
done
284378
echo ""
285379

286380
# Powerwall Credentials

0 commit comments

Comments
 (0)