-
-
Notifications
You must be signed in to change notification settings - Fork 46
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 action buttons #75
Conversation
We should not expose it this way, but create add-on configuration instead. |
Hi Franck, yes I see now that is a much nicer way to configure action buttons. I think I have achieved this with my last commit. |
bashio::log.info "Configuring action buttons." | ||
for button in $(bashio::config "action_buttons|keys"); do | ||
BUTTON_TYPE=$(bashio::config "action_buttons[${button}].type") | ||
CAMERA_NUMBER=$(bashio::config "action_buttons[${button}].camera") |
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.
- You are mixing tabs & spaces
- Only constants should be capitalized
- Variables are not declared
|
||
# Remove any existing action buttons before recreating | ||
for old_action in lock unlock light alarm up right down left zoom preset; do | ||
if ls /data/motioneye/${old_action}* > /dev/null 2>&1; then |
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.
Use find
instead
CAMERA_NUMBER=$(bashio::config "action_buttons[${button}].camera") | ||
BUTTON_COMMAND=$(bashio::config "action_buttons[${button}].command") | ||
bashio::log.debug "File: ${BUTTON_TYPE}_${CAMERA_NUMBER}, Command: ${BUTTON_COMMAND}" | ||
echo "#!/bin/bash" > "/data/motioneye/${BUTTON_TYPE}_${CAMERA_NUMBER}" |
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.
Multiple echo
's to a single file can be combined using a single redirect.
e.g.:
{
echo "Line 1"
echo "Line 2"
} > file
Thanks for the fast review, I think I have covered all the needed fixes. |
This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread. |
Proposed Changes
Related Issues