-
Notifications
You must be signed in to change notification settings - Fork 680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add swichbotmeter plugin #1236
Add swichbotmeter plugin #1236
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing this new plugin!
It looks good to me.
Please take a look at my minor nitpicks. Most of them are just cosmetic - feel free to ignore these.
plugins/sensors/switchbotmeter
Outdated
;; | ||
config) | ||
config | ||
[ "${MUNIN_CAP_DIRTYCONFIG:-}" = "1" ] && fetch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for the style: this compound statement can be tricky, if errexit
is enabled, since it could turn the exitcode of the case
command into non-zero (and cause an early exit with failure).
Thus it is advisable to avoid the above compound statement as the last operation anywhere (or simply: always use if
instead).
Example:
$ (set -e; if true; then true && false; fi; echo "FINISH"); echo $?
1
Just a hint - feel free to ignore this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. I will change it to if
plugins/sensors/switchbotmeter
Outdated
tempunit=${tempunit:-C} | ||
|
||
autoconf() { | ||
echo 'no' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not pretend to handle autoconf
, if you do not advertise this feature.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does 'advertise' mean capabilities
statement in magic markers? I would like to remove autoconf function and case selection. Is it ok?
=head1 LICENSE | ||
|
||
GPLv2 | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you want to add an SPDX identifier:
SPDX-License-Identifier: GPL-2.0-only
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All right. I will add it.
plugins/sensors/switchbotmeter
Outdated
|
||
statusCode=$( echo "${response}" | jq '.statusCode' ) | ||
if [ "${statusCode}" -ne 100 ]; then | ||
echo Error with statusCode = "${statusCode}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please send this message to stderr
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it.
Thank you for your review! I will fix it. |
@sumpfralle |
Thank you for contributing this new plugin and for going through all my nitpicking remarks! |
Your detailed reviews are totally acceptable. Thank you, too! |
Hi,
I would like to add switchbotmeter plugin.
SwitchBot Meter is IoT temperature/humidity meter and has capability to get data with REST API.
https://www.switch-bot.com/products/switchbot-meter
This plugin aims to get temperature/humidity from SwitchBot Meter by using REST API.
Please review the pull request.
Thank you,
K.Cima