This commit is contained in:
shakemid 2021-08-20 00:07:32 +09:00
parent c21acdf249
commit dd96f1861b
1 changed files with 5 additions and 9 deletions

View File

@ -33,6 +33,7 @@
=head1 LICENSE
GPLv2
SPDX-License-Identifier: GPL-2.0-only
=head1 Magic markers
@ -58,10 +59,6 @@ interval=${interval:-0}
# Temperature unit
tempunit=${tempunit:-C}
autoconf() {
echo 'no'
}
config() {
cat <<EOF
graph_title SwitchBot Meter ${deviceid}
@ -103,7 +100,7 @@ fetch_api() {
statusCode=$( echo "${response}" | jq '.statusCode' )
if [ "${statusCode}" -ne 100 ]; then
echo Error with statusCode = "${statusCode}"
echo Error with statusCode = "${statusCode}" 1>&2
exit 1
fi
@ -113,12 +110,11 @@ fetch_api() {
# Main
case ${1:-} in
autoconf)
autoconf
;;
config)
config
[ "${MUNIN_CAP_DIRTYCONFIG:-}" = "1" ] && fetch
if [ "${MUNIN_CAP_DIRTYCONFIG:-}" = "1" ]; then
fetch
fi
;;
*)
fetch