Skip to content

Commit

Permalink
Ensure remote branches are known
Browse files Browse the repository at this point in the history
  • Loading branch information
mdeweerd committed Nov 4, 2023
1 parent 7fe68e9 commit f5f75c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
10 changes: 8 additions & 2 deletions addon_meterstoha/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,26 @@ GIT_VERSION_STR=
if bashio::config.has_value "git_version" ; then
GIT_VERSION="$(bashio::config git_version)"
# shellcheck disable=SC2089
GIT_VERSION_STR="\"${GIT_VERSION/\"/\\\"}\""
GIT_VERSION_STR="${GIT_VERSION/\"/\\\"}"
fi

git clone --depth=1 "https://github.com/mdeweerd/MetersToHA.git" --no-checkout MetersToHA
(
cd MetersToHA || exit 255
git sparse-checkout set apps

if [ "$GIT_VERSION_STR" != "" ] ; then
# Make sure we have copy of branches
git remote set-branches origin '*'
git fetch -v --depth=1
fi

# GIT_VERSION_STR is allowed to be empty
echo "git checkout $GIT_VERSION_STR"
# shellcheck disable=SC2086,SC2090
git checkout $GIT_VERSION_STR

echo "MetersToHA Container version: $(bashio::addon.version).008 @$(stat -c '%y' "${MYDIR}run.sh")"
echo "MetersToHA Container version: $(bashio::addon.version).010 @$(stat -c '%y' "${MYDIR}run.sh")"
git show -s --pretty=format:"MetersToHA Python GIT version: %h on %ad%n"
)

Expand Down
5 changes: 3 additions & 2 deletions apps/meters_to_ha/meters_to_ha.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,7 @@ def init_chromium(self):
options.add_experimental_option(
"excludeSwitches", ["enable-automation"]
)
if log_level >= logging.WARNING:
options.add_experimental_option(
"excludeSwitches", ["enable-logging"]
)
Expand All @@ -693,10 +694,10 @@ def init_chromium(self):
self.mylog("Start virtual display (Chromium).", end="")

if log_level < logging.INFO:
options.add_argument("--log-level=1")
options.add_argument("--enable-logging")
options.add_argument("--log-level=1")
options.add_argument("--v=1")
if log_level < logging.WARNING:
elif log_level < logging.WARNING:
options.add_argument("--enable-logging")
options.add_argument("--log-level=0")
options.add_argument("--v=0")
Expand Down

0 comments on commit f5f75c8

Please sign in to comment.