This repository has been archived by the owner on Aug 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved logic to external python package
- Loading branch information
Showing
9 changed files
with
150 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
language: python | ||
stages: | ||
- linting | ||
- load | ||
- publish | ||
|
||
jobs: | ||
include: | ||
#Linting | ||
- stage: linting | ||
install: pip install pycodestyle | ||
name: "Linting with pycodestyle" | ||
python: "3.6" | ||
script: find . -name \*.py -exec pycodestyle {} + | ||
- stage: linting | ||
install: pip install pydocstyle | ||
name: "Linting with pydocstyle" | ||
python: "3.6" | ||
script: find . -name \*.py -exec pydocstyle {} + | ||
- stage: linting | ||
install: pip install pylint | ||
name: "Linting with pylint" | ||
python: "3.6" | ||
script: find . -name \*.py -exec pylint --disable=F0401,W0613 {} + | ||
- stage: linting | ||
install: pip install pyflakes | ||
name: "Linting with pyflakes" | ||
python: "3.6" | ||
script: find . -name \*.py -exec pyflakes {} + | ||
- stage: linting | ||
install: pip install flake8 | ||
name: "Linting with flake8" | ||
python: "3.6" | ||
script: find . -name \*.py -exec flake8 {} + | ||
|
||
# Load component with Home Assistant | ||
- stage: load | ||
name: "Load component/platform in Home Assistant" | ||
install: pip install homeassistant | ||
python: "3.6" | ||
script: | ||
- hass -c . --daemon | ||
- sleep 60 | ||
- cat ./home-assistant.log | ||
- if grep -q 'ERROR' ./home-assistant.log; then echo "There was an error starting Home Assistant"; exit 1; fi | ||
|
||
# Deploy to Github if all tests pass and change was done on master. | ||
# git commit -m 'message' | ||
# git push | ||
# git tag x.x.x | ||
# git push origin x.x.x | ||
- stage: deploy | ||
name: "Deploy to GitHub" | ||
script: skip | ||
deploy: &releases | ||
provider: releases | ||
overwrite: true | ||
skip_cleanup: true | ||
target_commitish: $TRAVIS_COMMIT | ||
tag_name: $TRAVIS_TAG | ||
name: $TRAVIS_TAG | ||
body: $TRAVIS_COMMIT_MESSAGE | ||
api_key: $GHAPI | ||
on: | ||
tags: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,12 @@ | ||
# Custom_component for `hassbian-config`. | ||
# Custom_component for `hassbian-config` | ||
|
||
A custom component which allows you to controll some hassbian-config functions from Home Assistant. | ||
|
||
To get started put the contents of`/custom_components/hassbian_config/` | ||
here: `<config directory>/custom_components/hassbian_config/` | ||
To get started put `/custom_components/hassbian_config.py` | ||
here: `<config directory>/custom_components/hassbian_config.py` | ||
|
||
**Example configuration.yaml:** | ||
|
||
```yaml | ||
hassbian_config: | ||
``` | ||
For more example see the [services.yaml](https://github.com/custom-components/hassbian-config/blob/master/custom_components/hassbian_config/services.yaml) file. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
## this is used by travis | ||
homeassistant: | ||
name: Home Assistant | ||
latitude: 0 | ||
longitude: 0 | ||
elevation: 0 | ||
unit_system: metric | ||
time_zone: Europe/London | ||
|
||
hassbian_config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
""" | ||
A component which allows you to controll some hassbian-config functions. | ||
For more details about this component, please refer to the documentation at | ||
https://github.com/ludeeus/hassbian_config | ||
""" | ||
import logging | ||
|
||
__version__ = '2.0.0' | ||
|
||
REQUIREMENTS = ['pyhassbian==0.0.3'] | ||
|
||
DOMAIN = 'hassbian_config' | ||
|
||
_LOGGER = logging.getLogger(__name__) | ||
|
||
def setup(hass, config): | ||
"""Setup the component.""" | ||
import pyhassbian | ||
|
||
def install_suite_service(call): | ||
"""Define install service.""" | ||
suite = call.data.get('suite') | ||
dev = call.data.get('dev') | ||
beta = call.data.get('beta') | ||
version = call.data.get('version') | ||
all_suites = pyhassbian.get_suites() | ||
if suite in all_suites: | ||
_LOGGER.info('The suite %s is now beeing installed.', suite) | ||
pyhassbian.manage_suite('install', suite, dev, beta, version) | ||
_LOGGER.info('The suite %s has been installed.', suite) | ||
else: | ||
_LOGGER.error('The suite %s does not exist.', suite) | ||
|
||
def upgrade_suite_service(call): | ||
"""Define update service.""" | ||
suite = call.data.get('suite') | ||
dev = call.data.get('dev') | ||
beta = call.data.get('beta') | ||
version = call.data.get('version') | ||
if suite in pyhassbian.get_suites(): | ||
_LOGGER.info('The suite %s is now beeing upgraded.', suite) | ||
pyhassbian.manage_suite('upgrade', suite, dev, beta, version) | ||
_LOGGER.info('The suite %s has been upgraded.', suite) | ||
else: | ||
_LOGGER.error('The suite %s does not exist.', suite) | ||
|
||
def upgrade_os_service(call): | ||
"""Define update base OS service.""" | ||
_LOGGER.info('Upgrade of the base OS are starting.') | ||
pyhassbian.os_upgrade() | ||
_LOGGER.info('Upgrade of the base OS are done.') | ||
|
||
|
||
if pyhassbian.is_installed(): | ||
_LOGGER.info('hassbian-config found, registering services.') | ||
hass.services.register(DOMAIN, 'install_suite', install_suite_service) | ||
hass.services.register(DOMAIN, 'upgrade_suite', upgrade_suite_service) | ||
hass.services.register(DOMAIN, 'upgrade_os', upgrade_os_service) | ||
else: | ||
_LOGGER.error('hassbian-config not found...') | ||
return True |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.