Bashio is a bash function library for use with Home Assistant apps.
It bundles commonly used operations so apps can include it instead of duplicating code, making them easier to develop and maintain.
Main goals:
- Reduce the number of operations needed in apps.
- Reduce the amount of code needed in apps.
- Make app code more readable.
- Provide a trusted and tested code base.
This speeds up app development by letting you focus on the app's logic rather than boilerplate.
The library is installed in the Home Assistant Community Apps base images and the official Home Assistant base images.
Currently available base images:
- Home Assistant Community Apps Alpine Base Image
- Home Assistant Community Apps Alpine Python Base Image
- Home Assistant Community Apps Debian Base Image
- Home Assistant Community Apps Ubuntu Base Image
- Official Home Assistant Alpine Docker Base Image
- Official Home Assistant Alpine Python Docker Base Image
- Official Home Assistant Debian Docker Base Image
- Official Home Assistant Raspbian Docker Base Image
- Official Home Assistant Ubuntu Docker Base Image
Using those images as the base for your Home Assistant app will provide this function library out of the box. Our base images are updated frequently and provide the minimal needed base image for a great app.
If you want to add Bashio to your own images, please take a look at the Dockerfile of the above base images to see how they are added at build time.
Configuring a Bash script to use the Bashio library is fairly easy. Simply
replace the shebang of your script file, from bash to bashio.
Before example:
#!/usr/bin/env bash
set -e
CONFIG_PATH=/data/options.json
USERNAME=$(jq --raw-output '.username // empty' $CONFIG_PATH)
echo "${USERNAME}"After example with Bashio:
#!/usr/bin/env bashio
USERNAME=$(bashio::config 'username')
bashio::log.info "${USERNAME}"Bashio has more than 450 functions available: communicating with the Supervisor API, Have I Been Pwned, file system, logging, configuration handling and a lot more!
The best way to get around would be by looking at the different modules
available in the lib folder. Each module has its own file, and each
function has been documented inside the codebase.
Furthermore, Bashio is used by the Home Assistant Community Apps project, those apps will be a great resource of practical examples.
Add-ons have been rebranded to apps, so the bashio::addon.* functions
(and bashio::addons / bashio::addons.*) have been renamed to
bashio::app.* (and bashio::apps / bashio::apps.*).
The old names still work: each keeps a deprecated alias that delegates to
its new counterpart and logs a warning the first time it is used. Please
migrate to the app names; for example, replace bashio::addon.name
with bashio::app.name. The aliases may be removed in a future release.
- Some parts of the Supervisor API are not implemented yet.
This repository keeps a change log using GitHub's releases functionality. The format of the log is based on Keep a Changelog.
Releases are based on Semantic Versioning, and use the format
of MAJOR.MINOR.PATCH. In a nutshell, the version will be incremented
based on the following:
MAJOR: Incompatible or major changes.MINOR: Backwards-compatible new features and enhancements.PATCH: Backwards-compatible bugfixes and package updates.
Got questions?
You have several options to get them answered:
- The Home Assistant Community Apps Discord chat server for app support and feature requests.
- You could also open an issue here GitHub.
This is an active open-source project. We are always open to people who want to use the code or contribute to it.
We have set up a separate document containing our contribution guidelines.
Thank you for being involved! 😍
The original setup of this repository is by Franck Nijhof.
For a full list of all authors and contributors, check the contributor's page.
MIT License
Copyright (c) 2019-2026 Franck Nijhof
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.