✨ Add action buttons - #75
Merged
Merged
Conversation
Member
|
We should not expose it this way, but create add-on configuration instead. |
Contributor
Author
|
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. |
frenck
reviewed
Feb 20, 2020
| 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") |
Member
There was a problem hiding this comment.
- You are mixing tabs & spaces
- Only constants should be capitalized
- Variables are not declared
frenck
reviewed
Feb 20, 2020
|
|
||
| # 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 |
frenck
reviewed
Feb 20, 2020
| 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}" |
Member
There was a problem hiding this comment.
Multiple echo's to a single file can be combined using a single redirect.
e.g.:
{
echo "Line 1"
echo "Line 2"
} > file
Contributor
Author
|
Thanks for the fast review, I think I have covered all the needed fixes. |
frenck
approved these changes
Feb 23, 2020
|
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed Changes
Related Issues