Conversation
WalkthroughA new function named Changes
Poem
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
| function bashio::supervisor.country() { | ||
| local country=${1:-} | ||
|
|
||
| bashio::log.trace "${FUNCNAME[0]}:" "$@" | ||
|
|
||
| if bashio::var.has_value "${country}"; then | ||
| channel=$(bashio::var.json country "${country}") | ||
| bashio::api.supervisor POST /supervisor/options "${country}" | ||
| bashio::cache.flush_all | ||
| else | ||
| bashio::supervisor 'supervisor.info.country' '.country' | ||
| fi | ||
| } | ||
|
|
There was a problem hiding this comment.
🛠️ Refactor suggestion
Add tests for bashio::supervisor.country()
The new getter/setter has no automated tests. Please add Bats (or equivalent) tests to cover both read and write paths:
- Calling without args should return the cached or API-provided country string.
- Calling with an argument should POST the correct JSON and flush the cache.
Proposed Changes
Add support to read the installations Country as known by Supervisor.
See: home-assistant/supervisor#5826
Summary by CodeRabbit