Skip to content

hassio-addons/bashio

Repository files navigation

Home Assistant Community Apps: Bashio

GitHub Release Project Stage License

GitHub Actions OpenSSF Scorecard Coverage on codecov Project Maintenance GitHub Activity

Discord

Sponsor Frenck via GitHub Sponsors

Support Frenck on Patreon

About

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.

Installation

The library is installed in the Home Assistant Community Apps base images and the official Home Assistant base images.

Currently available base images:

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.

Configuration

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}"

Functions

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.

Deprecation: addon renamed to app

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.

Known issues and limitations

  • Some parts of the Supervisor API are not implemented yet.

Changelog & Releases

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.

Support

Got questions?

You have several options to get them answered:

Contributing

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! 😍

Authors & contributors

The original setup of this repository is by Franck Nijhof.

For a full list of all authors and contributors, check the contributor's page.

License

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.

About

Bashio - Home Assistant Community Apps

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

118 stars

Watchers

3 watching

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors

Languages