Skip to content
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

bashio::addon.option cannot set boolean #158

Open
llamafilm opened this issue Mar 3, 2024 · 3 comments
Open

bashio::addon.option cannot set boolean #158

llamafilm opened this issue Mar 3, 2024 · 3 comments

Comments

@llamafilm
Copy link

llamafilm commented Mar 3, 2024

Problem/Motivation

My addon has a boolean config option that starts as true, and after a successful initialization, my shell script sets it to false, to prevent re-initialization on the next launch. This isn't working because bashio adds quotation marks to everything.

Expected behavior

I run this code:

bashio::addon.option regenerate_auth False

After that, I expect the toggle switch in the GUI to show off, but it's still on:
image

The API shows the value was set to "false" with quotes but it should not have quotes.

curl -s -H "Authorization: Bearer $SUPERVISOR_TOKEN"  \
  http://supervisor/addons/self/info | jq .data.options.regenerate_auth
"false"
@llamafilm
Copy link
Author

I found a workaround:

options=$(bashio::addon.options)
new_options=$(echo $options | jq .regenerate_auth=true)
payload=$(bashio::var.json options "^${new_options}")
bashio::api.supervisor POST "/addons/self/options" "${payload}"
curl -sH "Authorization: Bearer $SUPERVISOR_TOKEN" http://supervisor/addons/self/info | jq .data.options

Copy link

github-actions bot commented Apr 3, 2024

There hasn't been any activity on this issue recently, so we clean up some of the older and inactive issues.
Please make sure to update to the latest version and check if that solves the issue. Let us know if that works for you by leaving a comment 👍
This issue has now been marked as stale and will be closed if no further activity occurs. Thanks!

@github-actions github-actions bot added the stale There has not been activity on this issue or PR for quite some time. label Apr 3, 2024
@llamafilm
Copy link
Author

still an issue

@github-actions github-actions bot removed the stale There has not been activity on this issue or PR for quite some time. label Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant