Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
97 changes: 97 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{
"ignorePaths": [
"**/node_modules/**",
"**/vscode-extension/**",
"**/.git/**",
".github",
".gitignore",
".gitpod.yml",
"",
".vscode",
"megalinter",
"package-lock.json",
"report"
],
"language": "en",
"noConfigSearch": true,
"version": "0.2",
"words": [
"BUILDDIR",
"Homeassistant",
"Homeassistant's",
"Moff",
"PYPI",
"Pipfile",
"Pycharm",
"Pypi",
"Quickstart",
"SOURCEDIR",
"SPHINXBUILD",
"SPHINXOPTS",
"Scrapy",
"Spyder",
"aioconsole",
"aiohttp",
"apython",
"asyncronously",
"atrribute",
"autoclass",
"bdist",
"celerybeat",
"currentmodule",
"dmypy",
"entitites",
"eventloop",
"eyavkjbdljbasdkjh",
"hgbjhl",
"homeassistant",
"homeassistantapi",
"htmlcov",
"identifying",
"inited",
"ipynb",
"ipython",
"isort",
"kwargs",
"lbjio",
"linenodiv",
"linenos",
"literalinclude",
"matangover",
"maxdepth",
"mkdocs",
"mypy",
"nosetests",
"pinentry",
"pipenv",
"pnode",
"pycache",
"pyenv",
"pyflow",
"pylint",
"pypa",
"pypackages",
"pytest",
"pythonic",
"quickstart",
"replit",
"ropeproject",
"rtfd",
"scrapy",
"sdist",
"setuptools",
"shoutout",
"simplejson",
"sphinxsidebar",
"sphinxsidebarwrapper",
"splitlines",
"spyderproject",
"spyproject",
"stefanzweifel",
"toctree",
"ujson",
"venv",
"virtualenvs",
"webassets"
]
}
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. Ubuntu]
- OS Version [e.g. 18.2]
- HomeAssistantAPI Version: [e.g. 0.0.3]
- OS: [e.g. Ubuntu]
- OS Version [e.g. 18.2]
- HomeAssistantAPI Version: [e.g. 0.0.3]

**Additional context**
Add any other context about the problem here.
83 changes: 83 additions & 0 deletions .github/workflows/mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
# MegaLinter GitHub Action configuration file
# More info at https://megalinter.github.io
name: MegaLinter

on:
# Trigger mega-linter at every push. Action will also be visible from Pull Requests to master
push: # Comment this line to trigger action only on pull-requests (not recommended if you don't pay for GH Actions)
pull_request:
branches:
- master

env: # Comment env block if you do not want to apply fixes
# Apply linter fixes configuration
APPLY_FIXES: all # When active, APPLY_FIXES must also be defined as environment variable (in github/workflows/mega-linter.yml or other CI tool)
APPLY_FIXES_EVENT: pull_request # Decide which event triggers application of fixes in a commit or a PR (pull_request, push, all)
APPLY_FIXES_MODE: commit # If APPLY_FIXES is used, defines if the fixes are directly committed (commit) or posted in a PR (pull_request)

concurrency:
group: ${{ github.ref }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
build:
name: MegaLinter
runs-on: ubuntu-latest
steps:
# Git Checkout
- name: Checkout Code
uses: actions/checkout@v2
with:
token: ${{ secrets.MEGALINTER_TOKEN || secrets.GITHUB_TOKEN }}
fetch-depth: 0

# MegaLinter
- name: MegaLinter
id: ml
# You can override MegaLinter flavor used to have faster performances
# More info at https://megalinter.github.io/flavors/
uses: megalinter/megalinter/flavors/documentation@v5
env:
# All available variables are described in documentation
# https://megalinter.github.io/configuration/
VALIDATE_ALL_CODEBASE: true # Set ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} to validate only diff with main branch
APPLY_FIXES_MODE: commit
GITHUB_TOKEN: ${{ secrets.MEGALINTER_TOKEN || secrets.GITHUB_TOKEN }}

# Upload MegaLinter artifacts
- name: Archive production artifacts
if: ${{ success() }} || ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: MegaLinter reports
path: |
report
mega-linter.log

# Create pull request if applicable (for now works only on PR from same repository, not from forks)
- name: Create Pull Request with applied fixes
id: cpr
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.MEGALINTER_TOKEN || secrets.GITHUB_TOKEN }}
commit-message: "[MegaLinter] Apply linters automatic fixes"
title: "[MegaLinter] Apply linters automatic fixes"
labels: bot
- name: Create PR output
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'pull_request' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

# Push new commit if applicable (for now works only on PR from same repository, not from forks)
- name: Prepare commit
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
run: sudo chown -Rc $UID .git/
- name: Commit and push applied linter fixes
if: steps.ml.outputs.has_updated_sources == 1 && (env.APPLY_FIXES_EVENT == 'all' || env.APPLY_FIXES_EVENT == github.event_name) && env.APPLY_FIXES_MODE == 'commit' && github.ref != 'refs/heads/main' && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) && !contains(github.event.head_commit.message, 'skip fix')
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: ${{ github.event.pull_request.head.ref || github.head_ref || github.ref }}
commit_message: "[MegaLinter] Apply linters fixes"
34 changes: 17 additions & 17 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,20 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -r requirements.txt
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install -r requirements.txt
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ __pycache__/
.idea/
venv/

# Megalinter
report/

# Repl.it
.replit
.breakpoints
Expand Down
6 changes: 3 additions & 3 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ tasks:
- before: |
echo $GPG_KEY | base64 -d | gpg --import --pinentry=loopback --passphrase "$GPG_PASSPHRASE"
echo 'pinentry-mode loopback' >> ~/.gnupg/gpg.conf
git config --local user.signingkey $GPG_KEY_ID
git config --local commit.gppsign true
- init: |
pip install poetry
poetry config virtualenvs.create false
poetry install
- command: |

vscode:
extensions:
- ms-python.python
- matangover.mypy
ports:
- port: 8000
visibility: public
onOpen: ignore
onOpen: ignore
15 changes: 15 additions & 0 deletions .jscpd.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"threshold": 0,
"reporters": ["html", "markdown"],
"ignore": [
"**/node_modules/**",
"**/.git/**",
"**/.rbenv/**",
"**/.venv/**",
"**/*cache*/**",
"**/.github/**",
"**/.idea/**",
"**/report/**",
"**/*.svg"
]
}
11 changes: 11 additions & 0 deletions .mega-linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Configuration file for MegaLinter
# See all available variables at https://megalinter.github.io/configuration/ and in linters documentation

APPLY_FIXES: all # all, none, or list of linter keys
DISABLE:
- PYTHON
- COPYPASTE
SHOW_ELAPSED_TIME: true
FILEIO_REPORTER: true
RST_FILTER_REGEX_EXCLUDE: "(:resource:`.+`)"
DISABLE_ERRORS: true # Uncomment if you want MegaLinter to detect errors but not block CI to pass
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ repos:
additional_dependencies:
- types-requests
- types-simplejson
rev: 'v0.931'
rev: "v0.931"
- repo: https://github.com/pre-commit/pre-commit-hooks
hooks:
- id: trailing-whitespace
rev: 'v4.1.0'
rev: "v4.1.0"
- repo: https://github.com/psf/black
hooks:
- id: black
rev: '21.12b0'
rev: "21.12b0"
- repo: https://github.com/PyCQA/isort
rev: '5.10.1'
rev: "5.10.1"
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: '4.0.1'
rev: "4.0.1"
hooks:
- id: flake8
- repo: https://github.com/PyCQA/pylint
rev: 'v2.12.2'
rev: "v2.12.2"
hooks:
- id: pylint
language: system
language: system
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

**v2.3.0**
- Bug fixes (see closed issues between releases)
- Added global request kwargs parameter to Client objects (see [docs](homeassistantapi.rtfd.io/en/latest/api.html#homeassistant_api.Client))
- Added global request kwargs parameter to Client objects (see [docs](https://homeassistantapi.readthedocs.io/en/latest/api.html))

**v2.4.0**
- Bug fixes (see closed issues between releases)
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/GrandMoff100/HomeassistantAPI?style=for-the-badge)
![GitHub release (latest by date)](https://img.shields.io/github/downloads/GrandMoff100/HomeassistantAPI/latest/total?style=for-the-badge)

![Homeassistant Logo](/docs/images/homeassistant-logo.png)
![Homeassistant Logo](https://github.com/GrandMoff100/HomeAssistantAPI/blob/7edb4e6298d37bda19c08b807613c6d351788491/docs/images/homeassistant-logo.png?raw=true)

Python Wrapper for Homeassistant's [REST API](https://developers.home-assistant.io/docs/api/rest/)

Expand All @@ -19,17 +19,17 @@ Here is a quick example.
from homeassistant_api import Client

client = Client(
'<API URL>',
'<Long Lived Access Token>'
'<API Server URL>',
'<Your Long Lived Access-Token>'
)

services = client.get_domains()

services.light.turn_on(entity_id='light.living_room_lamp')
```

# Documentation
All documentation, API reference, Contribution guidelines and pretty much everything else you'd want to know is on our readthedocs site [here](https://homeassistantapi.rtfd.io)
## Documentation
All documentation, API reference, Contribution guidelines and pretty much everything else you'd want to know is on our readthedocs site [here](https://homeassistantapi.readthedocs.io)

If theres something missing open an issue and let us know! Thanks!

Expand Down
Loading