mirror of
https://github.com/hassio-addons/addon-homebridge.git
synced 2025-05-07 12:21:24 +00:00
🔨 Full rewrite onto new base and S6
This commit is contained in:
parent
797633ef8d
commit
cb04a04c61
30 changed files with 653 additions and 728 deletions
5
.github/ISSUE_TEMPLATE.md
vendored
5
.github/ISSUE_TEMPLATE.md
vendored
|
@ -1,4 +1,4 @@
|
|||
## Problem/Motivation
|
||||
# Problem/Motivation
|
||||
|
||||
> (Why the issue was filed)
|
||||
|
||||
|
@ -16,4 +16,5 @@
|
|||
|
||||
## Proposed changes
|
||||
|
||||
> (If you have a proposed change, workaround or fix, describe the rationale behind it)
|
||||
> (If you have a proposed change, workaround or fix,
|
||||
> describe the rationale behind it)
|
||||
|
|
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
6
.github/PULL_REQUEST_TEMPLATE.md
vendored
|
@ -1,7 +1,9 @@
|
|||
## Proposed Changes
|
||||
# Proposed Changes
|
||||
|
||||
> (Describe the changes and rationale behind them)
|
||||
|
||||
## Related Issues
|
||||
|
||||
> ([Github link](https://help.github.com/articles/autolinked-references-and-urls/) to related issues or pull requests)
|
||||
> ([Github link][autolink-references] to related issues or pull requests)
|
||||
|
||||
[autolink-references]: https://help.github.com/articles/autolinked-references-and-urls/
|
88
CHANGELOG.md
88
CHANGELOG.md
|
@ -2,34 +2,94 @@
|
|||
|
||||
All notable changes to this add-on will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
||||
The format is based on [Keep a Changelog][keep-a-changelog]
|
||||
and this project adheres to [Semantic Versioning][semantic-versioning].
|
||||
|
||||
## Unreleased
|
||||
|
||||
- Migrated to the new Hass.io build system
|
||||
### Added
|
||||
|
||||
- Added CodeClimate
|
||||
- Added CircleCI
|
||||
- Added support for Hass.io's extended label schema
|
||||
- Added support for IPv6 (but can be disabled)
|
||||
- Added support for automatic detection of Avahi interfaces
|
||||
- Added support for manually limiting/changing the interfaces Avahi is using
|
||||
- Added automatic detection of the Avahi hostname
|
||||
- Added support for manually setting an Avahi hostname
|
||||
- Added support for changing Avahi's domain name
|
||||
- Added support for installing custom OS packages
|
||||
- Added support for executing custom commands
|
||||
|
||||
## [v1.0.3](https://github.com/hassio-addons/addon-homebridge/tree/v1.0.3) (2017-08-21)
|
||||
[Full Changelog](https://github.com/hassio-addons/addon-homebridge/compare/v1.0.2...v1.0.3)
|
||||
### Fixed
|
||||
- Adds 'default_visbility' flag to the default configuration of Homebridge [#2](https://github.com/hassio-addons/addon-homebridge/issues/2)
|
||||
|
||||
## [v1.0.2](https://github.com/hassio-addons/addon-homebridge/tree/v1.0.2) (2017-08-20)
|
||||
[Full Changelog](https://github.com/hassio-addons/addon-homebridge/compare/v1.0.1...v1.0.2)
|
||||
- Can't use curl with this addon [#11][11]
|
||||
- Homebridge will not show in iOS app [#5][5]
|
||||
- Automatic restart needed [#16][16]
|
||||
- Siri will not lock or unlock a door. Home app will do this just fine. [#26][26]
|
||||
|
||||
### Changed
|
||||
|
||||
- Reduced image size significantly
|
||||
- Migrated to the new Hass.io build system
|
||||
- Migrated to our new base images
|
||||
- Rewrite of add-on onto the S6 process supervisor
|
||||
- Updated Homebridge to 0.4.28
|
||||
- Updated Home Assistant Homebridge to 2.3.1
|
||||
- Updated Homebridge configuration template to include latest features
|
||||
- Updated all documentation files
|
||||
|
||||
## [v1.0.3] (2017-08-21)
|
||||
|
||||
[Full Changelog][v1.0.3-v1.0.3]
|
||||
|
||||
### Fixed
|
||||
|
||||
- Adds 'default_visbility' flag to the default configuration of Homebridge [#2][2]
|
||||
|
||||
## [v1.0.2] (2017-08-20)
|
||||
|
||||
[Full Changelog][v1.0.1-v1.0.2]
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated `homebridge-homeassistant` to version v2.3.0
|
||||
- Changed repository file structure
|
||||
- Changed / simplyfield buildscripts
|
||||
- Updated the documentation to match recent changes
|
||||
### Fixes
|
||||
- There was an error when installed the plugin [#6](https://github.com/hassio-addons/repository/issues/6)
|
||||
|
||||
## [v1.0.1](https://github.com/hassio-addons/addon-homebridge/tree/v1.0.1) (2017-08-15)
|
||||
[Full Changelog](https://github.com/hassio-addons/addon-homebridge/compare/v1.0.0...v1.0.1)
|
||||
### Fixes
|
||||
- Homebridge pin generated with additional dash [#3](https://github.com/hassio-addons/repository/issues/3)
|
||||
|
||||
## [v1.0.0](https://github.com/hassio-addons/addon-homebridge/tree/v1.0.0) (2017-08-14)
|
||||
- There was an error when installed the plugin [#6][6]
|
||||
|
||||
## [v1.0.1] (2017-08-15)
|
||||
|
||||
[Full Changelog][v1.0.0-v1.0.1]
|
||||
|
||||
### Fixes
|
||||
|
||||
- Homebridge pin generated with additional dash [#3][3]
|
||||
|
||||
## [v1.0.0] (2017-08-14)
|
||||
|
||||
### Added
|
||||
|
||||
- First version of the Homebridge Add-on
|
||||
- This CHANGELOG file
|
||||
|
||||
[keep-a-changelog]: http://keepachangelog.com/en/1.0.0/
|
||||
[semantic-versioning]: http://semver.org/spec/v2.0.0.html
|
||||
[v1.0.0-v1.0.1]: https://github.com/hassio-addons/addon-homebridge/compare/v1.0.0...v1.0.1
|
||||
[v1.0.1-v1.0.2]: https://github.com/hassio-addons/addon-homebridge/compare/v1.0.1...v1.0.2
|
||||
[v1.0.3-v1.0.3]: https://github.com/hassio-addons/addon-homebridge/compare/v1.0.2...v1.0.3
|
||||
[v1.0.0]: https://github.com/hassio-addons/addon-homebridge/tree/v1.0.0
|
||||
[v1.0.1]: https://github.com/hassio-addons/addon-homebridge/tree/v1.0.1
|
||||
[v1.0.2]: https://github.com/hassio-addons/addon-homebridge/tree/v1.0.2
|
||||
[v1.0.3]: https://github.com/hassio-addons/addon-homebridge/tree/v1.0.3
|
||||
[3]: https://github.com/hassio-addons/repository/issues/3
|
||||
[6]: https://github.com/hassio-addons/repository/issues/6
|
||||
[2]: https://github.com/hassio-addons/repository/issues/2
|
||||
[5]: https://github.com/hassio-addons/addon-homebridge/issues/3
|
||||
[11]: https://github.com/hassio-addons/addon-homebridge/issues/11
|
||||
[16]: https://github.com/hassio-addons/addon-homebridge/issues/16
|
||||
[26]: https://github.com/hassio-addons/addon-homebridge/issues/26
|
||||
|
|
|
@ -22,11 +22,14 @@ include:
|
|||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
- The use of sexualized language or imagery and unwelcome sexual attention
|
||||
or advances
|
||||
- Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
- Public or private harassment
|
||||
- Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
- Publishing others' private information, such as a physical or
|
||||
electronic address, without explicit permission
|
||||
- Other conduct which could reasonably be considered inappropriate
|
||||
in a professional setting
|
||||
|
||||
## Our responsibilities
|
||||
|
||||
|
@ -52,7 +55,7 @@ further defined and clarified by project maintainers.
|
|||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported by contacting the project lead at frenck@geekchimp.com. All
|
||||
reported by contacting the project lead at frenck@addons.community. All
|
||||
complaints will be reviewed and investigated and will result in a response that
|
||||
is deemed necessary and appropriate to the circumstances. The project lead is
|
||||
obligated to maintain confidentiality with regard to the reporter of an incident.
|
||||
|
|
|
@ -21,9 +21,9 @@ Even better: You could submit a pull request with a fix / new feature!
|
|||
1. Search our repository for open or closed [pull requests][prs] that relates
|
||||
to your submission. You don't want to duplicate effort.
|
||||
|
||||
2. You may merge the pull request in once you have the sign-off of two other
|
||||
1. You may merge the pull request in once you have the sign-off of two other
|
||||
developers, or if you do not have permission to do that, you may request
|
||||
the second reviewer to merge it for you.
|
||||
|
||||
[github]: https://github.com/hassio-addons/addon-homebridge/issues
|
||||
[prs]: https://github.com/hassio-addons/addon-homebridge/pulls
|
||||
[prs]: https://github.com/hassio-addons/addon-homebridge/pulls
|
||||
|
|
310
README.md
310
README.md
|
@ -1,26 +1,56 @@
|
|||
# Community Hass.io Add-on: Homebridge
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
|
||||
[![GitHub Release][releases-shield]][releases]
|
||||
![Project Stage][project-stage-shield]
|
||||
![Maintenance][maintenance-shield]
|
||||
![Awesome][awesome-shield]
|
||||
![Project Maintenance][maintenance-shield]
|
||||
[![GitHub Activity][commits-shield]][commits]
|
||||
[![License][license-shield]](LICENSE.md)
|
||||
|
||||
[![CircleCI][circleci-shield]][circleci]
|
||||
[![Code Climate][codeclimate-shield]][codeclimate]
|
||||
[![Bountysource][bountysource-shield]][bountysource]
|
||||
[![Discord][discord-shield]][discord]
|
||||
[![Community Forum][forum-shield]][forum]
|
||||
|
||||
[![Gratipay][gratipay-shield]][gratipay]
|
||||
[![Patreon][patreon-shield]][patreon]
|
||||
[![PayPal][paypal-shield]][paypal]
|
||||
[![Bitcoin][bitcoin-shield]][bitcoin]
|
||||
|
||||
This add-on provides the installation, configuration, and integration for
|
||||
[Homebridge][homebridge].
|
||||
|
||||
## About
|
||||
|
||||
Homebridge is a server that emulates the iOS HomeKit API, allowing you to
|
||||
control your Home Assistant through via Apple devices (including Siri).
|
||||
control your Home Assistant via Apple devices (including Siri).
|
||||
|
||||
Since Siri supports devices added through HomeKit, this means that with
|
||||
Homebridge you can ask Siri to control devices that don't have any support for
|
||||
HomeKit at all. For instance, using just some of the available plugins,
|
||||
you can say:
|
||||
HomeKit at all. For instance, you could say:
|
||||
|
||||
* _Siri, unlock the back door._
|
||||
* _Siri, open the garage door._
|
||||
* _Siri, turn on the coffee maker._
|
||||
* _Siri, turn on the living room lights._
|
||||
* _Siri, good morning!_
|
||||
- _Siri, unlock the back door._
|
||||
- _Siri, open the garage door._
|
||||
- _Siri, turn on the coffee maker._
|
||||
- _Siri, turn on the living room lights._
|
||||
- _Siri, good morning!_
|
||||
|
||||
## Installation
|
||||
|
||||
The installation of this add-on is pretty straightforward and not different in
|
||||
comparison to installing any other Hass.io add-on.
|
||||
|
||||
1. [Add our Hass.io add-ons repository][repository] to your Hass.io instance.
|
||||
1. Install the "Homebridge" add-on.
|
||||
1. Start the "Homebridge" add-on.
|
||||
1. Check the logs of the "Homebridge" add-on to see if everything went well
|
||||
moreover, to find the pin code needed to add your Home Assistant instance to
|
||||
your iOS device
|
||||
|
||||
Please read the rest of this document further instructions.
|
||||
|
||||
**NOTE**: Do not add this repository to Hass.io, please use:
|
||||
`https://github.com/hassio-addons/repository`.
|
||||
|
||||
## Docker status
|
||||
|
||||
|
@ -44,52 +74,96 @@ you can say:
|
|||
[![Docker Layers][i386-layers-shield]][i386-microbadger]
|
||||
[![Docker Pulls][i386-pulls-shield]][i386-dockerhub]
|
||||
|
||||
## Installation
|
||||
|
||||
The installation of this add-on is pretty straight forward and not different in
|
||||
comparison to installing any other Hass.io add-on.
|
||||
|
||||
1. [Add our Hass.io add-ons repository][repository] to your Hass.io instance.
|
||||
**NOTE**: Do not add this repository, but use: `https://github.com/hassio-addons/repository`.
|
||||
2. Install the "Homebridge" add-on
|
||||
3. Start the "Homebridge" add-on
|
||||
4. Check the logs of the "Homebridge" add-on to see if everything went well and
|
||||
to find the pin code needed to add your Home Assistant instance to
|
||||
your iOS device
|
||||
|
||||
Please read the rest of this document further instructions.
|
||||
|
||||
## Configuration
|
||||
|
||||
On the first run, this add-on will create the necessary configuration files
|
||||
On the first run, this add-on creates the necessary configuration files
|
||||
for you. Stored in `/config/homebridge/`. You can modify the configuration
|
||||
to your liking. For documentation on configuring Homebridge, please refer
|
||||
to the [Homebridge GitHub][homebridge] repository. For documentation on
|
||||
configuring the Home Assistant for Homebridge plugin, please refer to the
|
||||
[Home Assistant for Homebridge GitHub][homebridge-homeassistant] repository.
|
||||
|
||||
The add-on has a limited configuration possibility as well.
|
||||
The add-on has a configuration possibilities as well.
|
||||
|
||||
_Please remember to restart the add-on when the configuration changes._
|
||||
**Note**: _Remember to restart the add-on when the configuration is changed._
|
||||
|
||||
Example add-on configuration:
|
||||
|
||||
```json
|
||||
{
|
||||
"debug": false,
|
||||
"log_level": "info",
|
||||
"avahi_interfaces": "",
|
||||
"avahi_hostname": "",
|
||||
"avahi_domainname": "local",
|
||||
"enable_ipv6": true,
|
||||
"packages": [],
|
||||
"init_commands": [],
|
||||
"plugins": []
|
||||
}
|
||||
```
|
||||
|
||||
**Option: `debug`**
|
||||
### Option: `log_level`
|
||||
|
||||
When set to `true` the addon will output more information in the logs of the
|
||||
add-on. The add-on will also start all the services in debug mode, which causes
|
||||
more output in the log files.
|
||||
The `log_level` option controls the level of log output by the addon and can
|
||||
be changed to be more or less verbose, which might be useful when you are
|
||||
dealing with an unknown issue. Possible values are:
|
||||
|
||||
This might be useful when you are dealing with an unknown issue. It is
|
||||
recommended leaving to option set to `false`, unless you are troubleshooting.
|
||||
- `trace`: Show every detail, like all called internal functions.
|
||||
- `debug`: Shows detailed debug information.
|
||||
- `info`: Normal (usually) interesting events.
|
||||
- `warning`: Exceptional occurrences that are not errors.
|
||||
- `error`: Runtime errors that do not require immediate action.
|
||||
- `fatal`: Something went terribly wrong. Add-on becomes unusable.
|
||||
|
||||
**Option: `plugins`**
|
||||
Please note that each level automatically includes log messages from a
|
||||
more severe level, e.g., `debug` also shows `info` messages. By default,
|
||||
the `log_level` is set to `info`, which is the recommended setting unless
|
||||
you are troubleshooting.
|
||||
|
||||
Using `trace` or `debug` log levels puts the Homebridge server into debug mode.
|
||||
|
||||
### Option: `avahi_interfaces`
|
||||
|
||||
Set a comma separated list of allowed network interfaces that should be used by
|
||||
the Avahi service. Other interfaces will be ignored. If left empty, the add-on
|
||||
will try to auto-detect the interfaces, which should be fine in most cases.
|
||||
|
||||
**Note**: _There is a special internal interface for Hass.io called `hassio`.
|
||||
This interface is always added to the list automatically_
|
||||
|
||||
### Option: `avahi_hostname`
|
||||
|
||||
Set the hostname to Avahi server. The add-on tries to register on your network
|
||||
using this hostname. If left empty the hostname will be automatically detected
|
||||
via the Hass.io API, which sould be fine in most cases.
|
||||
|
||||
### Option: `avahi_domainname`
|
||||
|
||||
Set the default domain name for Avahi. The add-on tries to register its hostname
|
||||
and services on your network. In most cases, the default, `local`, should be
|
||||
fine.
|
||||
|
||||
### Option: `enable_ipv6`
|
||||
|
||||
In some situations, IPv6 might cause more problems then it solves.
|
||||
Setting this option to `false`, partially disables IPv6 support causing
|
||||
Ahahi and Homebridge to only listen for connections on IPv4
|
||||
|
||||
### Option: `packages`
|
||||
|
||||
Allows you to specify additional [Alpine packages][alpine-packages] to be
|
||||
installed to your Homebridge setup (e.g., `python`, `g++`. `make`, `ffmpeg`).
|
||||
|
||||
**Note**: _Adding many packages will result in a longer start-up time
|
||||
for the add-on._
|
||||
|
||||
### Option: `init_commands`
|
||||
|
||||
Customize your Homebridge setup even more with the `init_commands` option.
|
||||
Add one or more shell commands to the list, and they will be executed every
|
||||
single time this add-on starts.
|
||||
|
||||
### Option: `plugins`
|
||||
|
||||
This Homebridge add-on has support for installing additional Homebridge plugins.
|
||||
Plugins are NodeJS modules published through NPM and tagged with the keyword
|
||||
|
@ -99,12 +173,12 @@ like `homebridge-mysmartlock`.
|
|||
The `homebridge-homeassistant` plugin is already installed for you.
|
||||
|
||||
You can install a plugin by adding it to the add-on configuration. The add-on
|
||||
will ensure the plugin is installed on start.
|
||||
ensures the plugin is installed on start.
|
||||
|
||||
Example add-on configuration (partial):
|
||||
|
||||
Example add-on configuration:
|
||||
```json
|
||||
{
|
||||
"debug": false,
|
||||
"plugins": [
|
||||
"homebridge-dummy",
|
||||
"homebridge-mysmartlock"
|
||||
|
@ -112,15 +186,18 @@ Example add-on configuration:
|
|||
}
|
||||
```
|
||||
|
||||
You can explore all available plugins at the NPM website by [searching for the
|
||||
keyword `homebridge-plugin`][homebridge-plugins].
|
||||
You can explore all available plugins at the NPM website by
|
||||
[searching for the keyword homebridge-plugin][homebridge-plugins].
|
||||
|
||||
**Note**: _Some plugins require build tools or other packages. You might need to
|
||||
install these packages using the `packages` option first._
|
||||
|
||||
## Adding Homebridge to iOS
|
||||
|
||||
Using the Home app (or most other HomeKit apps), you should be able to add the
|
||||
single accessory "Home Assistant", assuming that you are still running the
|
||||
Homebridge add-on and you are on the same (Wifi) network. Adding this accessory
|
||||
will automatically add all accessories and platforms defined in your
|
||||
automatically adds all accessories and platforms defined in your
|
||||
Home Assistant instance.
|
||||
|
||||
When you attempt to add the "Home Assistant" accessory, it will ask for a
|
||||
|
@ -131,94 +208,117 @@ can change it as well).
|
|||
|
||||
## Known issues and limitations
|
||||
|
||||
* Once your device has been added to HomeKit, you should be able to tell Siri to
|
||||
control your devices. However, realize that Siri is a cloud service, and iOS may
|
||||
need some time to synchronize your device information with iCloud.
|
||||
* Siri will almost always prefer its default phrase handling over HomeKit
|
||||
devices. For instance, if you name your Sonos device "Radio" and try saying
|
||||
"Siri, turn on the Radio" then Siri will probably start playing an iTunes Radio
|
||||
station on your phone. Even if you name it "Sonos" and say
|
||||
"Siri, turn on the Sonos", Siri will probably just launch the Sonos app instead.
|
||||
This is why, for instance, the suggested `name` for the Sonos accessory
|
||||
is "Speakers".
|
||||
* One installation of Homebridge can only expose 100 accessories due to a
|
||||
HomeKit limit.
|
||||
* Once an accessory has been added to the Home app, changing its name via
|
||||
Homebridge will not be automatically reflected in iOS. You must change it via
|
||||
the Home app as well.
|
||||
* IPv6 support has been removed from this addon, because of known issues with
|
||||
libraries used by Homebridge. If you rely solely on IPv6 on your network,
|
||||
this add-on will not work.
|
||||
* If you have set up SSL using a self-signed certificate, you will need to
|
||||
set verify_ssl to false in your `/config/homebridge/config.json` file to allow
|
||||
bypassing the Node.js certificate checks.
|
||||
* Errors on startup. The following errors are experienced when starting
|
||||
Homebridge and can be safely ignored.
|
||||
- Once your device has been added to HomeKit, you should be able to tell Siri to
|
||||
control your devices. However, realize that Siri is a cloud service and iOS
|
||||
may need some time to synchronize your device information with iCloud.
|
||||
- Siri will almost always prefer its default phrase handling over HomeKit
|
||||
devices. For instance, if you name your Sonos device "Radio" and try saying
|
||||
"Siri, turn on the Radio" then Siri will probably start playing an iTunes Radio
|
||||
station on your phone. Even if you name it "Sonos" and say
|
||||
"Siri, turn on the Sonos", Siri will probably just launch the Sonos app instead.
|
||||
This is why, for instance, the suggested `name` for the Sonos accessory
|
||||
is "Speakers".
|
||||
- One installation of Homebridge can only expose 100 accessories due to a
|
||||
HomeKit limit.
|
||||
- Once an accessory has been added to the Home app, changing its name via
|
||||
Homebridge will not be automatically reflected in iOS. You must change it via
|
||||
the Home app as well.
|
||||
- If you have set up SSL using a self-signed certificate, you will need to
|
||||
set `verify_ssl` to false in your `/config/homebridge/config.json` file to
|
||||
allow bypassing the NodeJS certificate checks.
|
||||
- Errors on startup. The following errors are experienced when starting
|
||||
Homebridge and can be safely ignored.
|
||||
|
||||
```
|
||||
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer
|
||||
*** WARNING *** The program 'nodejs' uses the Apple Bonjour compatibility layer
|
||||
of Avahi
|
||||
*** WARNING *** Please fix your application to use the native API of Avahi!
|
||||
*** WARNING *** For more information see
|
||||
*** WARNING *** For more information see
|
||||
http://0pointerde/avahi-compat?s=libdns_sd&e=nodejs
|
||||
*** WARNING *** The program 'nodejs' called 'DNSServiceRegister()' which is not
|
||||
supported (or only supported partially) in the Apple Bonjour compatibility layer
|
||||
of Avahi
|
||||
*** WARNING *** Please fix your application to use the native API of Avahi!
|
||||
*** WARNING *** For more information see
|
||||
*** WARNING *** For more information see
|
||||
http://0pointerde/avahi-compat?s=libdns_sd&e=nodejs&f=DNSServiceRegister
|
||||
```
|
||||
|
||||
## FAQ
|
||||
|
||||
**Homebridge cannot connect or login to Home Assistant**
|
||||
### Homebridge cannot connect or login to Home Assistant
|
||||
|
||||
Please be sure to set the `host` and `password` parameters in the
|
||||
`/config/homebridge/config.json` file.
|
||||
Normally `http://172.17.0.1:8123` should be a sufficient `host` to use when
|
||||
running hass.io.
|
||||
If a password protects your Home Assistant instance, you will also need to
|
||||
set the `password`, which is empty by default.
|
||||
`/config/homebridge/config.json` file.
|
||||
Normally `http://homeassistant:8123` should be a sufficient `host` to use when
|
||||
running hass.io. The `password` is left empty by default, however, if a
|
||||
password protects your Home Assistant instance, you might also need to
|
||||
set the `password` option.
|
||||
|
||||
**My iOS App Cannot Find Homebridge/Home Assistant**
|
||||
### My iOS App Cannot Find Homebridge/Home Assistant
|
||||
|
||||
Two reasons why Homebridge may not be discoverable:
|
||||
|
||||
1. Homebridge server thinks it has been paired with, but iOS thinks otherwise.
|
||||
1. Homebridge server thinks it has been paired with, but iOS thinks otherwise.
|
||||
Fix: deleted `persist/` directory which is in your `config/homebridge`
|
||||
directory and restart the add-on.
|
||||
|
||||
2. iOS device has gotten your Homebridge `username` (looks like a MAC address)
|
||||
1. iOS device has gotten your Homebridge `username` (looks like a MAC address)
|
||||
"stuck" somehow, where it is in the database but inactive. Fix: change your
|
||||
`username` in the "bridge" section of `/config/homebridge/config.json` to be
|
||||
some new value and restart the add-on.
|
||||
|
||||
## Support
|
||||
|
||||
Got questions? Got some unexpected behavior caused by this plugin?
|
||||
Got questions?
|
||||
|
||||
Please [open an issue on our GitHub repository][issues] and we'll do our best
|
||||
to help you out.
|
||||
You have several options to get them answered:
|
||||
|
||||
- The Home Assistant [Community Forum][forum], we have a
|
||||
[dedicated topic][forum] on that forum regarding this repository.
|
||||
- The Home Assistant [Discord Chat Server][discord] for general Home Assistant
|
||||
discussions and questions.
|
||||
- Join the [Reddit subreddit][reddit] in [/r/homeassistant][reddit]
|
||||
|
||||
You could also [open an issue here][issue] GitHub.
|
||||
|
||||
## 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](CONTRIBUTING.md).
|
||||
|
||||
Thank you for being involved! :heart_eyes:
|
||||
|
||||
## Authors & contributors
|
||||
|
||||
The original setup of this repository is by [Franck Nijhof][frenck].
|
||||
|
||||
For a full list of all authors and contributors,
|
||||
check [the contributor's page][contributors].
|
||||
|
||||
## Credits
|
||||
|
||||
A big shout out to the following people, without them this add-on was not
|
||||
A big shout out to the following people, without them this add-on was not
|
||||
possible:
|
||||
- The team & community of [Home Assistant][home-assistant] for developing such
|
||||
an excellent home automation toolkit
|
||||
|
||||
- The team & community of [Home Assistant][home-assistant] for developing such
|
||||
an excellent home automation toolkit
|
||||
- [Nick Farina][nfarina] for developing [Homebrige][homebridge]
|
||||
|
||||
This add-on has been inspired by the following repositories:
|
||||
|
||||
- [docker-homebridge][oznu-docker-homebridge] by [Oznu][oznu]
|
||||
- [homebridge-docker][ckuburlis-homebridge-docker]by [ckuburlis]
|
||||
- [hassio-addons][olivierguerriat-hassio-addons]
|
||||
- [hassio-addons][olivierguerriat-hassio-addons]
|
||||
by [Olivier Guerriat][olivierguerriat]
|
||||
|
||||
Thank you all!
|
||||
|
||||
## More Hass.io add-ons
|
||||
## We have got some Hass.io add-ons for you
|
||||
|
||||
Do you like this add-on? Want some more functionality to your Hass.io Home
|
||||
Assistant instance?
|
||||
Want some more functionality to your Hass.io Home Assistant instance?
|
||||
|
||||
We have created multiple add-ons for Hass.io. For a full list, check out
|
||||
our [GitHub Repository][repository].
|
||||
|
@ -265,9 +365,26 @@ SOFTWARE.
|
|||
[armhf-microbadger]: https://microbadger.com/images/hassioaddons/homebridge-armhf
|
||||
[armhf-pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/homebridge-armhf.svg
|
||||
[armhf-version-shield]: https://images.microbadger.com/badges/version/hassioaddons/homebridge-armhf.svg
|
||||
[awesome-shield]: https://img.shields.io/badge/awesome%3F-yes-brightgreen.svg
|
||||
[bitcoin-shield]: https://img.shields.io/badge/donate-bitcoin-blue.svg
|
||||
[bitcoin]: https://blockchain.info/payment_request?address=3GVzgN6NpVtfXnyg5dQnaujtqVTEDBCtAH
|
||||
[bountysource-shield]: https://img.shields.io/bountysource/team/hassio-addons/activity.svg
|
||||
[bountysource]: https://www.bountysource.com/teams/hassio-addons/issues
|
||||
[circleci-shield]: https://img.shields.io/circleci/project/github/hassio-addons/addon-homebridge.svg
|
||||
[circleci]: https://circleci.com/gh/hassio-addons/addon-homebridge
|
||||
[ckuburlis-homebridge-docker]: https://github.com/ckuburlis/homebridge-docker
|
||||
[ckuburlis]: https://github.com/ckuburlis
|
||||
[codeclimate-shield]: https://img.shields.io/badge/code%20climate-protected-brightgreen.svg
|
||||
[codeclimate]: https://codeclimate.com/github/hassio-addons/addon-homebridge
|
||||
[commits-shield]: https://img.shields.io/github/commit-activity/y/hassio-addons/addon-homebridge.svg
|
||||
[commits]: https://github.com/hassio-addons/addon-homebridge/commits/master
|
||||
[contributors]: https://github.com/hassio-addons/addon-homebridge/graphs/contributors
|
||||
[discord-shield]: https://img.shields.io/discord/330944238910963714.svg
|
||||
[discord]: https://discord.gg/c5DvZ4e
|
||||
[forum-shield]: https://img.shields.io/badge/community-forum-brightgreen.svg
|
||||
[forum]: https://community.home-assistant.io/t/repository-community-hass-io-add-ons/24705?u=frenck
|
||||
[frenck]: https://github.com/frenck
|
||||
[gratipay-shield]: https://img.shields.io/badge/donate-gratipay-blue.svg
|
||||
[gratipay]: https://gratipay.com/hassio-addons/
|
||||
[home-assistant]: https://home-assistant.io
|
||||
[homebridge-homeassistant]: https://github.com/home-assistant/homebridge-homeassistant
|
||||
[homebridge-plugins]: https://www.npmjs.com/search?q=homebridge-plugin
|
||||
|
@ -278,13 +395,22 @@ SOFTWARE.
|
|||
[i386-microbadger]: https://microbadger.com/images/hassioaddons/homebridge-i386
|
||||
[i386-pulls-shield]: https://img.shields.io/docker/pulls/hassioaddons/homebridge-i386.svg
|
||||
[i386-version-shield]: https://images.microbadger.com/badges/version/hassioaddons/homebridge-i386.svg
|
||||
[issues]: https://github.com/hassio-addons/addon-homebridge/issues
|
||||
[license-shield]: https://img.shields.io/github/license/hassio-addons/repository.svg
|
||||
[issue]: https://github.com/hassio-addons/addon-homebridge/issues
|
||||
[keepchangelog]: http://keepachangelog.com/en/1.0.0/
|
||||
[license-shield]: https://img.shields.io/github/license/hassio-addons/addon-homebridge.svg
|
||||
[maintenance-shield]: https://img.shields.io/maintenance/yes/2017.svg
|
||||
[nfarina]: https://github.com/nfarina
|
||||
[olivierguerriat-hassio-addons]: https://github.com/olivierguerriat/hassio-addons
|
||||
[olivierguerriat]: https://github.com/olivierguerriat
|
||||
[oznu-docker-homebridge]: https://github.com/oznu/docker-homebridge
|
||||
[oznu]: https://github.com/oznu
|
||||
[project-stage-shield]: https://img.shields.io/badge/Project%20Stage-Development-yellowgreen.svg
|
||||
[patreon-shield]: https://img.shields.io/badge/donate-patreon-blue.svg
|
||||
[patreon]: https://www.patreon.com/frenck
|
||||
[paypal-shield]: https://img.shields.io/badge/donate-paypal-blue.svg
|
||||
[paypal]: https://www.paypal.me/FranckNijhof
|
||||
[project-stage-shield]: https://img.shields.io/badge/project%20stage-production%20ready-brightgreen.svg
|
||||
[reddit]: https://reddit.com/r/homeassistant
|
||||
[releases-shield]: https://img.shields.io/github/release/hassio-addons/addon-homebridge.svg
|
||||
[releases]: https://github.com/hassio-addons/addon-homebridge/releases
|
||||
[repository]: https://github.com/hassio-addons/repository
|
||||
[semver]: http://semver.org/spec/v2.0.0.htm
|
||||
|
|
128
bin/build.sh
128
bin/build.sh
|
@ -1,128 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
SLUG="homebridge"
|
||||
BUILD_CONTAINER_NAME="hassioaddons-$SLUG-$$"
|
||||
LOCAL_REPOSITORY="."
|
||||
BUILD_DIR="$(pwd)/build"
|
||||
DOCKER_PUSH="true"
|
||||
DOCKER_CACHE="true"
|
||||
DOCKER_WITH_LATEST="true"
|
||||
|
||||
cleanup() {
|
||||
echo "[INFO] Cleanup."
|
||||
|
||||
# Stop docker container
|
||||
echo "[INFO] Cleaning up hassio-build container."
|
||||
docker stop $BUILD_CONTAINER_NAME 2> /dev/null || true
|
||||
docker rm --volumes $BUILD_CONTAINER_NAME 2> /dev/null || true
|
||||
|
||||
if [ "$1" == "fail" ]; then
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
trap 'cleanup fail' SIGINT SIGTERM
|
||||
|
||||
help () {
|
||||
cat << EOF
|
||||
Script for hassio addon docker build
|
||||
build [options]
|
||||
|
||||
Options:
|
||||
-h, --help
|
||||
Display this help and exit.
|
||||
-a, --arch armhf|aarch64|i386|amd64
|
||||
Arch for addon build.
|
||||
-t, --test
|
||||
Don't upload the build to docker hub.
|
||||
-n, --no-cache
|
||||
Disable build from cache
|
||||
EOF
|
||||
}
|
||||
|
||||
# Parse arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
key=$1
|
||||
case $key in
|
||||
-h|--help)
|
||||
help
|
||||
exit 0
|
||||
;;
|
||||
-a|--arch)
|
||||
ARCH=$2
|
||||
shift
|
||||
;;
|
||||
-t|--test)
|
||||
DOCKER_PUSH="false"
|
||||
;;
|
||||
-n|--no-cache)
|
||||
DOCKER_CACHE="false"
|
||||
;;
|
||||
*)
|
||||
echo "[WARNING] $0 : Argument '$1' unknown. Ignoring."
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Sanity checks
|
||||
if [ "$ARCH" != 'armhf' ] && [ "$ARCH" != 'aarch64' ] && [ "$ARCH" != 'i386' ] && [ "$ARCH" != 'amd64' ]; then
|
||||
echo "Error: $ARCH is not a supported platform for hassio-supervisor!"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$SLUG" ]; then
|
||||
echo "[ERROR] please set a slug!"
|
||||
help
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BASE_IMAGE="homeassistant\/$ARCH-base:latest"
|
||||
DOCKER_IMAGE="hassioaddons/$SLUG-$ARCH"
|
||||
WORKSPACE=$BUILD_DIR/hassio-supervisor-$ARCH
|
||||
ADDON_WORKSPACE=$WORKSPACE/$SLUG
|
||||
|
||||
# setup docker
|
||||
echo "[INFO] cleanup old WORKSPACE"
|
||||
rm -rf "$ADDON_WORKSPACE"
|
||||
|
||||
echo "[INFO] Setup docker for addon"
|
||||
mkdir -p "$BUILD_DIR"
|
||||
mkdir -p "$WORKSPACE"
|
||||
cp -r "$LOCAL_REPOSITORY/$SLUG" "$ADDON_WORKSPACE"
|
||||
|
||||
# Init docker
|
||||
echo "[INFO] Setup dockerfile"
|
||||
|
||||
sed -i "s/{arch}/${ARCH}/g" "$ADDON_WORKSPACE/config.json"
|
||||
DOCKER_TAG=$(jq --raw-output ".version" "$ADDON_WORKSPACE/config.json")
|
||||
|
||||
# Replace hass.io vars
|
||||
sed -i "s/%%BASE_IMAGE%%/${BASE_IMAGE}/g" "$ADDON_WORKSPACE/Dockerfile"
|
||||
sed -i "s/#${ARCH}:FROM/FROM/g" "$ADDON_WORKSPACE/Dockerfile"
|
||||
sed -i "s/%%ARCH%%/${ARCH}/g" "$ADDON_WORKSPACE/Dockerfile"
|
||||
echo "LABEL io.hass.version=\"$DOCKER_TAG\" io.hass.arch=\"$ARCH\" io.hass.type=\"addon\"" >> "$ADDON_WORKSPACE/Dockerfile"
|
||||
|
||||
# Run build
|
||||
echo "[INFO] start docker build"
|
||||
docker stop $BUILD_CONTAINER_NAME 2> /dev/null || true
|
||||
docker rm --volumes $BUILD_CONTAINER_NAME 2> /dev/null || true
|
||||
docker run --rm \
|
||||
-v "$ADDON_WORKSPACE":/docker \
|
||||
-v ~/.docker:/root/.docker \
|
||||
-e DOCKER_PUSH=$DOCKER_PUSH \
|
||||
-e DOCKER_CACHE=$DOCKER_CACHE \
|
||||
-e DOCKER_WITH_LATEST=$DOCKER_WITH_LATEST \
|
||||
-e DOCKER_IMAGE="$DOCKER_IMAGE" \
|
||||
-e DOCKER_TAG="$DOCKER_TAG" \
|
||||
--name $BUILD_CONTAINER_NAME \
|
||||
--privileged \
|
||||
homeassistant/docker-build-env \
|
||||
/run-docker.sh
|
||||
|
||||
echo "[INFO] cleanup WORKSPACE"
|
||||
cd "$BUILD_DIR"
|
||||
rm -rf "$WORKSPACE"
|
||||
|
||||
cleanup "okay"
|
||||
exit 0
|
|
@ -1,8 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
for arch in "armhf" "aarch64" "i386" "amd64"
|
||||
do
|
||||
./bin/build.sh -a $arch "$@" &
|
||||
done
|
||||
wait
|
|
@ -1,33 +1,62 @@
|
|||
ARG BUILD_FROM=homeassistant/amd64-base:latest
|
||||
ARG BUILD_FROM=hassioaddons/base-amd64:1.0.0
|
||||
FROM ${BUILD_FROM}
|
||||
MAINTAINER Franck Nijhof <frenck@geekchimp.com>
|
||||
|
||||
# Add env
|
||||
ENV LANG="C.UTF-8"
|
||||
|
||||
# Copy run file
|
||||
COPY files/run.sh /
|
||||
# Copy root filesystem
|
||||
COPY rootfs /
|
||||
|
||||
# Setup base
|
||||
RUN apk add --no-cache jq git python make g++ libffi-dev openssl-dev dbus \
|
||||
avahi-compat-libdns_sd avahi-dev avahi-tools avahi-ui-tools \
|
||||
nodejs-current yarn && \
|
||||
mkdir -p /var/run/dbus && \
|
||||
mkdir -p /var/run/avahi-daemon && \
|
||||
chown messagebus:messagebus /var/run/dbus && \
|
||||
chown avahi:avahi /var/run/avahi-daemon && \
|
||||
yarn global add npm && \
|
||||
yarn cache clean && \
|
||||
apk del yarn && \
|
||||
npm set unsafe-perm true && \
|
||||
npm -g install \
|
||||
node-gyp \
|
||||
homebridge@0.4.26 \
|
||||
homebridge-homeassistant@2.3.1 && \
|
||||
chmod a+x /run.sh
|
||||
RUN \
|
||||
apk add --no-cache --virtual .build-dependencies \
|
||||
g++ \
|
||||
git \
|
||||
avahi-dev \
|
||||
libffi-dev \
|
||||
make \
|
||||
openssl-dev \
|
||||
yarn \
|
||||
python \
|
||||
\
|
||||
&& apk add --no-cache \
|
||||
avahi-compat-libdns_sd \
|
||||
avahi \
|
||||
dbus \
|
||||
nodejs-current \
|
||||
\
|
||||
&& yarn global add npm \
|
||||
\
|
||||
&& npm set unsafe-perm true \
|
||||
\
|
||||
&& npm -g install \
|
||||
node-gyp \
|
||||
homebridge@0.4.28 \
|
||||
homebridge-homeassistant@2.3.1 \
|
||||
\
|
||||
&& yarn cache clean \
|
||||
\
|
||||
&& apk del --purge .build-dependencies
|
||||
|
||||
# Copy configuration files
|
||||
COPY files/avahi-daemon.conf /etc/avahi/
|
||||
COPY files/homebridge-config.json /root/
|
||||
CMD [ "/usr/bin/run.sh" ]
|
||||
|
||||
CMD [ "/run.sh" ]
|
||||
# Build arugments
|
||||
ARG BUILD_ARCH
|
||||
ARG BUILD_DATE
|
||||
ARG BUILD_REF
|
||||
ARG BUILD_VERSION
|
||||
|
||||
# Labels
|
||||
LABEL \
|
||||
io.hass.name="Homebridge" \
|
||||
io.hass.description="HomeKit support for your Home Assistant instance using Homebridge" \
|
||||
io.hass.arch="${BUILD_ARCH}" \
|
||||
io.hass.type="addon" \
|
||||
io.hass.version=${BUILD_VERSION} \
|
||||
maintainer="Franck Nijhof <frenck@addons.community>" \
|
||||
org.label-schema.description="HomeKit support for your Home Assistant instance using Homebridge" \
|
||||
org.label-schema.build-date=${BUILD_DATE} \
|
||||
org.label-schema.name="Homebridge" \
|
||||
org.label-schema.schema-version="1.0" \
|
||||
org.label-schema.url="https://addons.community" \
|
||||
org.label-schema.usage="https://github.com/hassio-addons/addon-homebridge/tree/master/README.md" \
|
||||
org.label-schema.vcs-ref=${BUILD_REF} \
|
||||
org.label-schema.vcs-url="https://github.com/hassio-addons/addon-homebridge" \
|
||||
org.label-schema.vendor="Community Hass.io Add-ons"
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"squash": false,
|
||||
"build_from": {
|
||||
"aarch64": "homeassistant/aarch64-base:latest",
|
||||
"amd64": "homeassistant/amd64-base:latest",
|
||||
"armhf": "homeassistant/armhf-base:latest",
|
||||
"i386": "homeassistant/i386-base:latest"
|
||||
"aarch64": "hassioaddons/base-aarch64:1.0.0",
|
||||
"amd64": "hassioaddons/base-amd64:1.0.0",
|
||||
"armhf": "hassioaddons/base-armhf:1.0.0",
|
||||
"i386": "hassioaddons/base-i386:1.0.0"
|
||||
},
|
||||
"args": {}
|
||||
}
|
|
@ -1,22 +1,40 @@
|
|||
{
|
||||
"name": "Homebridge",
|
||||
"version": "1.0.3",
|
||||
"version": "dev",
|
||||
"slug": "homebridge",
|
||||
"description": "HomeKit support for your Home Assistant instance using Homebridge",
|
||||
"url": "https://github.com/hassio-addons/addon-homebridge",
|
||||
"startup": "application",
|
||||
"boot": "auto",
|
||||
"hassio_api": true,
|
||||
"homeassistant_api": true,
|
||||
"host_network": true,
|
||||
"privileged": [],
|
||||
"map": [
|
||||
"config:rw"
|
||||
"config:rw",
|
||||
"ssl"
|
||||
],
|
||||
"options": {
|
||||
"debug": false,
|
||||
"log_level": "info",
|
||||
"avahi_interfaces": "",
|
||||
"avahi_hostname": "",
|
||||
"avahi_domainname": "local",
|
||||
"enable_ipv6": true,
|
||||
"packages": [],
|
||||
"init_commands": [],
|
||||
"plugins": []
|
||||
},
|
||||
"schema": {
|
||||
"debug": "bool",
|
||||
"log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)",
|
||||
"avahi_interfaces": "str",
|
||||
"avahi_hostname": "str",
|
||||
"avahi_domainname": "str",
|
||||
"enable_ipv6": "bool",
|
||||
"packages": ["str"],
|
||||
"init_commands": ["str"],
|
||||
"plugins": ["str"]
|
||||
},
|
||||
"environment": {
|
||||
"LOG_FORMAT": "{LEVEL}: {MESSAGE}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,434 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
# ==============================================================================
|
||||
# Hass.io Add-on for Home Assistant: Homebridge
|
||||
# ==============================================================================
|
||||
|
||||
set -o errexit # Exit script when a command exits with non-zero status
|
||||
set -o nounset # Exit script on use of an undefined variable
|
||||
set -o pipefail # Return exit status of the last command in the pipe that failed
|
||||
|
||||
# ==============================================================================
|
||||
# GLOBALS
|
||||
# ==============================================================================
|
||||
|
||||
# Exit codes
|
||||
readonly EX_OK=0 # Successful termination
|
||||
readonly EX_DBUS_ID_FAILED=3 # Failed to generated a unique D-Bus ID
|
||||
readonly EX_PLUGIN_FAILED=4 # Homebridge plugin installation failed
|
||||
readonly EX_DBUS_DAEMON=5 # Failed to start D-Bus daemon
|
||||
readonly EX_PID_AVAHI=6 # Failed to remove Avahi daemon PID file
|
||||
readonly EX_PID_DBUS=7 # Failed to remove D-Bus daemon PID file
|
||||
readonly EX_PATCH_ERROR=8 # Failed to apply patch
|
||||
readonly EX_HOMEBRIDGE_DIR=9 # Failed to create Homebridge config directory
|
||||
readonly EX_HOMEBRIDGE_FILE=10 # Failed to create Homebridge config file
|
||||
readonly EX_HOMEBRIDGE_USER=11 # Failed to set Homebridge user config
|
||||
readonly EX_HOMEBRIDGE_PIN=12 # Failed to set Homebridge user pin
|
||||
|
||||
# Configuration paths
|
||||
readonly CONFIG_PATH=/data/options.json
|
||||
readonly HOMEBRIDGE_CONFIG_FILE=/config/homebridge/config.json
|
||||
readonly HOMEBRIDGE_TEMPLATE_CONFIG_FILE=/root/homebridge-config.json
|
||||
|
||||
# PID Files
|
||||
readonly PID_FILE_DBUS=/var/run/dbus.pid
|
||||
readonly PID_FILE_AVAHI=/var/run/avahi-daemon/pid
|
||||
|
||||
# D-Bus System bus socket file location
|
||||
readonly DBUS_SYSTEM_SOCKET=/var/run/dbus/system_bus_socket
|
||||
|
||||
# Debug mode?
|
||||
readonly DEBUG=$(jq --raw-output ".debug" $CONFIG_PATH)
|
||||
|
||||
# ==============================================================================
|
||||
# UTILITY
|
||||
# ==============================================================================
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Displays a status message
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# $* Status message to display
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
display_status_message() {
|
||||
local status=$*
|
||||
|
||||
echo "[ADD-ON] $status"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Displays a debug message
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# $* Status message to display
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
display_debug_message() {
|
||||
local status=$*
|
||||
|
||||
if [[ "$DEBUG" == "true" ]];
|
||||
then
|
||||
display_status_message "[DEBUG] $status"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Displays a error message and is able to terminate te script execution
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# $1 Error message
|
||||
# $2 Exitcode, script will continue execution when omitted
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
display_error_message() {
|
||||
local status=$1
|
||||
local exitcode=${2:-0}
|
||||
|
||||
echo "[ADD-ON][ERROR] An error occured!" >&2
|
||||
echo >&2
|
||||
echo "!!! ERROR: $status" >&2
|
||||
echo >&2
|
||||
|
||||
if [[ $exitcode -ne 0 ]];
|
||||
then
|
||||
exit "$exitcode"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Gets a configuration parameter form the configuration file
|
||||
# Globals:
|
||||
# CONFIG_PATH
|
||||
# Arguments:
|
||||
# $1 Key of the configuration parameter to get
|
||||
# $2 'true' If the configuration value is an array, false otherwise
|
||||
# Returns:
|
||||
# The configuration value
|
||||
# ------------------------------------------------------------------------------
|
||||
get_config() {
|
||||
local key=$1
|
||||
local is_array=$2
|
||||
|
||||
if $is_array;
|
||||
then
|
||||
command jq --raw-output ".$key[]" $CONFIG_PATH
|
||||
else
|
||||
command jq --raw-output ".$key" $CONFIG_PATH
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Finds the MAC address of the main interface
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# MAC address of the main interface (upper-cased)
|
||||
# ------------------------------------------------------------------------------
|
||||
get_mac_addr() {
|
||||
local interface
|
||||
local mac
|
||||
|
||||
interface=$(ip route show default | awk '/default/ {print $5}')
|
||||
mac=$(cat "/sys/class/net/$interface/address")
|
||||
|
||||
echo "${mac^^}"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Generates a random pin number for HomeKit (###-##-### format)
|
||||
# Globals:
|
||||
# None
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# The generated random pin number
|
||||
# ------------------------------------------------------------------------------
|
||||
generate_homekit_pin() {
|
||||
local pin
|
||||
|
||||
pin=$(< /dev/urandom tr -dc 0-9 | head -c3)
|
||||
pin+="-"
|
||||
pin+=$(< /dev/urandom tr -dc 0-9 | head -c2)
|
||||
pin+="-"
|
||||
pin+=$(< /dev/urandom tr -dc 0-9 | head -c3)
|
||||
|
||||
echo "$pin"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# SCRIPT LOGIC
|
||||
# ==============================================================================
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Applies temporary but necessary patch to HAP NodeJS
|
||||
# Globals:
|
||||
# EX_PATCH_ERROR
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
apply_hap_nodejs_ipv6_hotfix() {
|
||||
local eventedhttp_file='/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js'
|
||||
|
||||
display_status_message 'Applying HAP NodeJS IPV6 HOTFIX'
|
||||
command patch $eventedhttp_file <<PATCH
|
||||
--- eventedhttp.js
|
||||
+++ eventedhttp.js
|
||||
@@ -57,7 +57,7 @@
|
||||
inherits(EventedHTTPServer, EventEmitter);
|
||||
|
||||
EventedHTTPServer.prototype.listen = function(targetPort) {
|
||||
- this._tcpServer.listen(targetPort);
|
||||
+ this._tcpServer.listen(targetPort, '0.0.0.0');
|
||||
|
||||
this._tcpServer.on('listening', function() {
|
||||
var port = this._tcpServer.address().port;
|
||||
PATCH
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [[ "$?" -ne 0 ]];
|
||||
then
|
||||
display_error_message 'Patching HAP NodeJS failed' "$EX_PATCH_ERROR"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Ensures D-Bus UUID exists and has the uuid in it
|
||||
# Globals:
|
||||
# EX_DBUS_ID_FAILED
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
ensure_dbus_id() {
|
||||
display_status_message 'Ensuring D-Bus unique ID exists'
|
||||
|
||||
command dbus-uuidgen --ensure || display_error_message \
|
||||
'Failed to generated unique D-Bus ID' "$EX_DBUS_ID_FAILED"
|
||||
|
||||
# Somehow we need this sleep. Atm it is unclear why...
|
||||
sleep 2
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Install list of user requested Homebridge Plugins
|
||||
# Globals:
|
||||
# EX_PLUGIN_FAILED
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
install_plugins() {
|
||||
local plugins
|
||||
|
||||
plugins=$(get_config "plugins" true)
|
||||
for plugin in $plugins;
|
||||
do
|
||||
display_status_message "Installing Homebridge plugin $plugin"
|
||||
|
||||
command npm install --unsafe-perm -g "$plugin" || display_error_message \
|
||||
"Failed installing Homebridge plugin $plugin" $EX_PLUGIN_FAILED
|
||||
done
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Removes old PID files that may be left behind from last run
|
||||
# Globals:
|
||||
# EX_PID_AVAHI
|
||||
# EX_PID_DBUS
|
||||
# PID_FILE_AVAHI
|
||||
# PID_FILE_DBUS
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
remove_old_pid_files() {
|
||||
display_status_message 'Ensuring old PID files are absent'
|
||||
|
||||
if [[ -e "$PID_FILE_AVAHI" ]];
|
||||
then
|
||||
display_status_message 'Removing old Avahi daemon PID file'
|
||||
command rm -f "$PID_FILE_AVAHI" || display_error_message \
|
||||
'Failed to removed Avahi daemon PID file' "$EX_PID_AVAHI"
|
||||
fi
|
||||
|
||||
if [[ -e "$PID_FILE_DBUS" ]];
|
||||
then
|
||||
display_status_message 'Removing old D-Bus daemon PID file'
|
||||
command rm -f "$PID_FILE_DBUS" || display_error_message \
|
||||
'Failed to remove D-Bus daemon PID file' "$EX_PID_DBUS"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Start the Avahi daemon in the background
|
||||
# Globals:
|
||||
# DEBUG
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
start_avahi_daemon() {
|
||||
display_status_message 'Starting Avahi daemon'
|
||||
|
||||
if [[ "$DEBUG" == "true" ]];
|
||||
then
|
||||
command avahi-daemon --debug &
|
||||
else
|
||||
command avahi-daemon &
|
||||
fi
|
||||
|
||||
# Waiting 5 seconds to allow Avahi to register itself
|
||||
sleep 5
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Applies temporary but necessary patch to HAP NodeJS
|
||||
# Globals:
|
||||
# EX_DBUS_DAEMON
|
||||
# DBUS_SYSTEM_SOCKET
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
start_dbus_daemon() {
|
||||
display_status_message 'Starting D-Bus daemon'
|
||||
|
||||
command dbus-daemon --system || display_error_message \
|
||||
'Failed to start D-Bus daemon' $EX_DBUS_DAEMON
|
||||
|
||||
display_debug_message 'Waiting until system bus socket is ready'
|
||||
|
||||
until [[ -e "$DBUS_SYSTEM_SOCKET" ]];
|
||||
do
|
||||
display_debug_message 'Still waiting...'
|
||||
sleep 1
|
||||
done
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Starts Homebridge
|
||||
# Globals:
|
||||
# HOMEBRIDGE_CONFIG_FILE
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
start_homebridge() {
|
||||
display_status_message 'Starting Homebridge'
|
||||
|
||||
if [[ "$DEBUG" == "true" ]];
|
||||
then
|
||||
command homebridge -D -U "$(dirname "$HOMEBRIDGE_CONFIG_FILE")"
|
||||
else
|
||||
command homebridge -U "$(dirname "$HOMEBRIDGE_CONFIG_FILE")"
|
||||
fi
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Generates an initial Homebridge configuration file
|
||||
# Globals:
|
||||
# HOMEBRIDGE_CONFIG_FILE
|
||||
# EX_HOMEBRIDGE_DIR
|
||||
# EX_HOMEBRIDGE_FILE
|
||||
# EX_HOMEBRIDGE_USER
|
||||
# EX_HOMEBRIDGE_PIN
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
generate_homebridge_config() {
|
||||
local homebridge_config_dir
|
||||
|
||||
display_status_message 'Generating Homebridge configuration files'
|
||||
|
||||
homebridge_config_dir=$(dirname "$HOMEBRIDGE_CONFIG_FILE")
|
||||
if [[ ! -d "$homebridge_config_dir" ]];
|
||||
then
|
||||
display_debug_message 'Creating Homebridge configuration directory'
|
||||
command mkdir -p "$homebridge_config_dir" || display_error_message \
|
||||
'Failed to create Homebrige configuration directory' \
|
||||
"$EX_HOMEBRIDGE_DIR"
|
||||
fi
|
||||
|
||||
display_debug_message 'Copying Homebrige configuration template'
|
||||
command cp "$HOMEBRIDGE_TEMPLATE_CONFIG_FILE" "$HOMEBRIDGE_CONFIG_FILE" ||
|
||||
display_error_message 'Failed creating Homebridge configuration file' \
|
||||
"$EX_HOMEBRIDGE_FILE"
|
||||
|
||||
display_debug_message 'Setting Homebridge username based on MAC address'
|
||||
command sed -i "s/%%USERNAME%%/$(get_mac_addr)/g" \
|
||||
"$HOMEBRIDGE_CONFIG_FILE" || display_error_message \
|
||||
'Failed setting Homebridge username' "$EX_HOMEBRIDGE_USER"
|
||||
|
||||
display_debug_message 'Setting Homebridge HomeKit pin'
|
||||
command sed -i "s/%%PIN%%/$(generate_homekit_pin)/g" \
|
||||
"$HOMEBRIDGE_CONFIG_FILE" || display_error_message \
|
||||
'Failed setting Homebridge pin' "$EX_HOMEBRIDGE_PIN"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Cleanup function after execution is of the script is stopped. (trap)
|
||||
# Globals:
|
||||
# PID_FILE_AVAHI
|
||||
# PID_FILE_DBUS
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
cleanup() {
|
||||
command rm -f "$PID_FILE_AVAHI"
|
||||
command rm -f "$PID_FILE_DBUS"
|
||||
}
|
||||
|
||||
# ==============================================================================
|
||||
# RUN LOGIC
|
||||
# ------------------------------------------------------------------------------
|
||||
# Globals:
|
||||
# EX_OK
|
||||
# HOMEBRIDGE_CONFIG_FILE
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# None
|
||||
# ------------------------------------------------------------------------------
|
||||
main() {
|
||||
trap cleanup ERR
|
||||
trap cleanup EXIT
|
||||
|
||||
install_plugins
|
||||
|
||||
remove_old_pid_files
|
||||
ensure_dbus_id
|
||||
start_dbus_daemon
|
||||
|
||||
start_avahi_daemon
|
||||
|
||||
if [[ ! -f "$HOMEBRIDGE_CONFIG_FILE" ]]; then
|
||||
generate_homebridge_config
|
||||
fi
|
||||
|
||||
apply_hap_nodejs_ipv6_hotfix
|
||||
|
||||
start_homebridge
|
||||
|
||||
exit "$EX_OK"
|
||||
}
|
||||
main
|
|
@ -3,7 +3,7 @@ host-name=hassio
|
|||
domain-name=local
|
||||
#browse-domains=0pointer.de, zeroconf.org
|
||||
use-ipv4=yes
|
||||
use-ipv6=no
|
||||
use-ipv6=yes
|
||||
#allow-interfaces=eth0
|
||||
#deny-interfaces=eth1
|
||||
#check-response-ttl=no
|
||||
|
@ -31,8 +31,8 @@ publish-workstation=no
|
|||
#publish-domain=yes
|
||||
#publish-dns-servers=192.168.50.1, 192.168.50.2
|
||||
#publish-resolv-conf-dns-servers=yes
|
||||
#publish-aaaa-on-ipv4=yes
|
||||
#publish-a-on-ipv6=no
|
||||
publish-aaaa-on-ipv4=yes
|
||||
publish-a-on-ipv6=yes
|
||||
|
||||
[reflector]
|
||||
#enable-reflector=no
|
9
homebridge/rootfs/etc/cont-init.d/20-dbus.sh
Normal file
9
homebridge/rootfs/etc/cont-init.d/20-dbus.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Ensures we've got an unique D-Bus ID
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
dbus-uuidgen --ensure || hass.die 'Failed to generate a unique D-Bus ID'
|
47
homebridge/rootfs/etc/cont-init.d/30-avahi.sh
Normal file
47
homebridge/rootfs/etc/cont-init.d/30-avahi.sh
Normal file
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Configures the Avahi daemon
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
readonly AVAHI_CONFIG='/etc/avahi/avahi-daemon.conf'
|
||||
declare interfaces
|
||||
declare hostname
|
||||
|
||||
# Determine interface to use for Avahi
|
||||
if hass.config.has_value 'avahi_interfaces'; then
|
||||
interfaces=$(hass.config.get 'avahi_interfaces')
|
||||
else
|
||||
interfaces=$(ip route show default | awk '/default/ {print $5}')
|
||||
hass.log.debug "Detected Avahi interfaces: ${interfaces}"
|
||||
fi
|
||||
sed -i "s/#allow-interfaces=.*/allow-interfaces=hassio,${interfaces}/" \
|
||||
"${AVAHI_CONFIG}"
|
||||
|
||||
# Find the hostname
|
||||
if hass.config.has_value 'avahi_hostname'; then
|
||||
hostname=$(hass.config.get 'avahi_hostname')
|
||||
else
|
||||
hostname=$(hass.api.host.info.hostname)
|
||||
hass.log.debug "Detected Avahi hostname: ${hostname}"
|
||||
fi
|
||||
sed -i "s/host-name=.*/host-name=${hostname}/" "${AVAHI_CONFIG}"
|
||||
|
||||
# Set the domainname
|
||||
if hass.config.has_value 'avahi_domainname'; then
|
||||
sed -i "s/domain-name=.*/domain-name=$(hass.config.get 'avahi_domainname')/" \
|
||||
"${AVAHI_CONFIG}"
|
||||
fi
|
||||
|
||||
# Disable IPV6?
|
||||
if hass.config.false 'enable_ipv6'; then
|
||||
sed -i "s/use-ipv6=.*/use-ipv6=no/" "${AVAHI_CONFIG}"
|
||||
sed -i "s/publish-aaaa-on-ipv4=.*/publish-aaaa-on-ipv4=no/" "${AVAHI_CONFIG}"
|
||||
sed -i "s/publish-a-on-ipv6=.*/publish-a-on-ipv6=no/" "${AVAHI_CONFIG}"
|
||||
hass.log.debug 'Disabled IPV6 in the Avahi daemon'
|
||||
fi
|
||||
|
||||
# Remove some problematic Avahi service files
|
||||
rm -f /etc/avahi/services/*
|
67
homebridge/rootfs/etc/cont-init.d/50-config.sh
Normal file
67
homebridge/rootfs/etc/cont-init.d/50-config.sh
Normal file
|
@ -0,0 +1,67 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Generates the Homebridge configuration file
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
# Configuration paths
|
||||
readonly HOMEBRIDGE_CONFIG_FILE=/config/homebridge/config.json
|
||||
readonly HOMEBRIDGE_TEMPLATE_CONFIG_FILE=/root/homebridge-config.json
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Generates a random pin number for HomeKit (###-##-### format)
|
||||
#
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# The generated random pin number
|
||||
# ------------------------------------------------------------------------------
|
||||
generate_homekit_pin() {
|
||||
local pin
|
||||
|
||||
pin=$(< /dev/urandom tr -dc 0-9 | head -c3)
|
||||
pin+="-"
|
||||
pin+=$(< /dev/urandom tr -dc 0-9 | head -c2)
|
||||
pin+="-"
|
||||
pin+=$(< /dev/urandom tr -dc 0-9 | head -c3)
|
||||
|
||||
echo "$pin"
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Finds the MAC address of the main interface
|
||||
#
|
||||
# Arguments:
|
||||
# None
|
||||
# Returns:
|
||||
# MAC address of the main interface (upper-cased)
|
||||
# ------------------------------------------------------------------------------
|
||||
get_mac_addr() {
|
||||
local interface
|
||||
local mac
|
||||
|
||||
interface=$(ip route show default | awk '/default/ {print $5}')
|
||||
mac=$(cat "/sys/class/net/$interface/address")
|
||||
|
||||
echo "${mac^^}"
|
||||
}
|
||||
|
||||
# Create Homebridge configuration directory when it is missing
|
||||
if ! hass.directory_exists "$(dirname "${HOMEBRIDGE_CONFIG_FILE}")"; then
|
||||
mkdir -p "$(dirname "${HOMEBRIDGE_CONFIG_FILE}")" \
|
||||
|| hass.die 'Failed to create Homebrige configuration directory'
|
||||
fi
|
||||
|
||||
# Generate Homebridge configuration file, when missing
|
||||
if ! hass.file_exists "${HOMEBRIDGE_CONFIG_FILE}"; then
|
||||
cp "${HOMEBRIDGE_TEMPLATE_CONFIG_FILE}" "${HOMEBRIDGE_CONFIG_FILE}" \
|
||||
|| hass.die 'Failed creating Homebridge configuration file'
|
||||
|
||||
sed -i "s/%%USERNAME%%/$(get_mac_addr)/g" "${HOMEBRIDGE_CONFIG_FILE}" \
|
||||
|| hass.die 'Failed setting Homebridge username'
|
||||
|
||||
sed -i "s/%%PIN%%/$(generate_homekit_pin)/g" "${HOMEBRIDGE_CONFIG_FILE}" \
|
||||
|| hass.die 'Failed setting Homebridge pin'
|
||||
fi
|
33
homebridge/rootfs/etc/cont-init.d/60-ipv6-hotfix.sh
Normal file
33
homebridge/rootfs/etc/cont-init.d/60-ipv6-hotfix.sh
Normal file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Applies temporary but necessary patch to HAP NodeJS
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
readonly EVENTHTTP_FILE='/usr/lib/node_modules/homebridge/node_modules/hap-nodejs/lib/util/eventedhttp.js'
|
||||
|
||||
if hass.config.false 'enable_ipv6'; then
|
||||
patch "${EVENTHTTP_FILE}" <<PATCH
|
||||
--- eventedhttp.js
|
||||
+++ eventedhttp.js
|
||||
@@ -57,7 +57,7 @@
|
||||
inherits(EventedHTTPServer, EventEmitter);
|
||||
|
||||
EventedHTTPServer.prototype.listen = function(targetPort) {
|
||||
- this._tcpServer.listen(targetPort);
|
||||
+ this._tcpServer.listen(targetPort, '0.0.0.0');
|
||||
|
||||
this._tcpServer.on('listening', function() {
|
||||
var port = this._tcpServer.address().port;
|
||||
PATCH
|
||||
|
||||
# shellcheck disable=SC2181
|
||||
if [[ "$?" -ne 0 ]];
|
||||
then
|
||||
hass.die 'Patching HAP NodeJS failed'
|
||||
fi
|
||||
|
||||
hass.log.debug 'Applied HAP NodeJS IPv6 disable hotfix'
|
||||
fi
|
17
homebridge/rootfs/etc/cont-init.d/80-user-packages.sh
Normal file
17
homebridge/rootfs/etc/cont-init.d/80-user-packages.sh
Normal file
|
@ -0,0 +1,17 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Install user configured/requested packages
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
if hass.config.has_value 'packages'; then
|
||||
apk update \
|
||||
|| hass.die 'Failed updating Alpine packages repository indexes'
|
||||
|
||||
for package in $(hass.config.get 'packages'); do
|
||||
apk add "$package" \
|
||||
|| hass.die "Failed installing package ${package}"
|
||||
done
|
||||
fi
|
14
homebridge/rootfs/etc/cont-init.d/81-user-scripts.sh
Normal file
14
homebridge/rootfs/etc/cont-init.d/81-user-scripts.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Executes user configured/requested commands on startup
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
if hass.config.has_value 'init_commands'; then
|
||||
while read -r cmd; do
|
||||
eval "${cmd}" \
|
||||
|| hass.die "Failed executing init command: ${cmd}"
|
||||
done <<< "$(hass.config.get 'init_commands')"
|
||||
fi
|
14
homebridge/rootfs/etc/cont-init.d/82-user-plugins.sh
Normal file
14
homebridge/rootfs/etc/cont-init.d/82-user-plugins.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Install user configured/requested packages
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
if hass.config.has_value 'plugins'; then
|
||||
for plugin in $(hass.config.get 'plugins'); do
|
||||
npm install --unsafe-perm -g "${plugin}" \
|
||||
|| hass.die "Failed installing plugin ${plugin}"
|
||||
done
|
||||
fi
|
1
homebridge/rootfs/etc/fix-attrs.d/10-homebridge
Normal file
1
homebridge/rootfs/etc/fix-attrs.d/10-homebridge
Normal file
|
@ -0,0 +1 @@
|
|||
/usr/bin/run.sh false root 0755 0755
|
1
homebridge/rootfs/etc/fix-attrs.d/20-dbus
Normal file
1
homebridge/rootfs/etc/fix-attrs.d/20-dbus
Normal file
|
@ -0,0 +1 @@
|
|||
/var/run/dbus true messagebus 0755 0755
|
1
homebridge/rootfs/etc/fix-attrs.d/30-avahi
Normal file
1
homebridge/rootfs/etc/fix-attrs.d/30-avahi
Normal file
|
@ -0,0 +1 @@
|
|||
/var/run/avahi-daemon true avahi 0755 0755
|
20
homebridge/rootfs/etc/services.d/avahi/run
Normal file
20
homebridge/rootfs/etc/services.d/avahi/run
Normal file
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Start the Avahi daemon
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
# Wait until D-Bus is available
|
||||
until [[ -e /var/run/dbus/system_bus_socket ]];
|
||||
do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Start the Avahi daemon
|
||||
if hass.debug; then
|
||||
avahi-daemon --debug
|
||||
else
|
||||
avahi-daemon
|
||||
fi
|
10
homebridge/rootfs/etc/services.d/dbus/run
Normal file
10
homebridge/rootfs/etc/services.d/dbus/run
Normal file
|
@ -0,0 +1,10 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Starts the D-Bus daemon
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
dbus-daemon --system --nofork \
|
||||
|| hass.die 'Failed to start D-Bus daemon'
|
|
@ -11,10 +11,11 @@
|
|||
{
|
||||
"platform": "HomeAssistant",
|
||||
"name": "HomeAssistant",
|
||||
"host": "http://172.17.0.1:8123",
|
||||
"host": "http://homeassistant:8123",
|
||||
"password": "",
|
||||
"default_visibility": "visible",
|
||||
"supported_types": [
|
||||
"automation",
|
||||
"binary_sensor",
|
||||
"climate",
|
||||
"cover",
|
||||
|
@ -25,11 +26,13 @@
|
|||
"light",
|
||||
"lock",
|
||||
"media_player",
|
||||
"remote",
|
||||
"scene",
|
||||
"sensor",
|
||||
"switch"
|
||||
],
|
||||
"logging": true
|
||||
"logging": true,
|
||||
"verify_ssl": true
|
||||
}
|
||||
]
|
||||
}
|
19
homebridge/rootfs/usr/bin/run.sh
Normal file
19
homebridge/rootfs/usr/bin/run.sh
Normal file
|
@ -0,0 +1,19 @@
|
|||
#!/usr/bin/with-contenv bash
|
||||
# ==============================================================================
|
||||
# Community Hass.io Add-ons: Homebridge
|
||||
# Runs Homebridge
|
||||
# ==============================================================================
|
||||
# shellcheck disable=SC1091
|
||||
source /usr/lib/hassio-addons/base.sh
|
||||
|
||||
readonly HOMEBRIDGE_CONFIG_FILE=/config/homebridge/config.json
|
||||
|
||||
# Wait at least 5 seconds before staring Homebridge
|
||||
# Avahi might need some time.
|
||||
sleep 5
|
||||
|
||||
if hass.debug; then
|
||||
homebridge -D -U "$(dirname "$HOMEBRIDGE_CONFIG_FILE")"
|
||||
else
|
||||
homebridge -U "$(dirname "$HOMEBRIDGE_CONFIG_FILE")"
|
||||
fi
|
0
homebridge/rootfs/var/run/avahi-daemon/.gitkeep
Normal file
0
homebridge/rootfs/var/run/avahi-daemon/.gitkeep
Normal file
0
homebridge/rootfs/var/run/dbus/.gitkeep
Normal file
0
homebridge/rootfs/var/run/dbus/.gitkeep
Normal file
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"name": "Development - Community Hass.io add-on: Homebridge",
|
||||
"name": "Development - Community Hass.io Add-ons: Homebridge",
|
||||
"url": "https://github.com/hassio-addons/addon-homebridge",
|
||||
"maintainer": "Franck Nijhof <frenck@geekchimp.com>"
|
||||
"maintainer": "Franck Nijhof <frenck@addons.community>"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue