Skip to content

Commit

Permalink
Code format (#118)
Browse files Browse the repository at this point in the history
* Code format

* Updates info.md
  • Loading branch information
JohNan authored Aug 15, 2024
1 parent 85928f9 commit ef9101b
Show file tree
Hide file tree
Showing 19 changed files with 199 additions and 213 deletions.
2 changes: 1 addition & 1 deletion .github/release-drafter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ template: |
[![Downloads for this release](https://img.shields.io/github/downloads/JohNan/homeassistant-wellbeing/v$RESOLVED_VERSION/total.svg)](https://github.com/JohNan/homeassistant-wellbeing/releases/v$RESOLVED_VERSION)
## Changes
$CHANGES
$CHANGES
2 changes: 0 additions & 2 deletions .github/workflows/release-drafter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@ jobs:
uses: release-drafter/release-drafter@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}


2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
file: ./custom_components/wellbeing/wellbeing.zip
asset_name: wellbeing.zip
tag: ${{ github.ref }}
overwrite: true
overwrite: true
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-json
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: no-commit-to-branch
args: [ '--branch', 'main', '--branch', 'master' ]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
args: [ '--target-version', 'py312', '--line-length=120', '.' ]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.6
hooks:
- id: ruff
args: [ --fix ]

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: [ '--py311-plus' ]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.11.1
hooks:
- id: mypy
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ A custom component designed for [Home Assistant](https://www.home-assistant.io)
- WA71-302GY
- WA71-302DG
- WA71-304GY

- Electrolux Pure A9 Purifiers
- PA91-406GY
- PA91-606DG
Expand All @@ -29,11 +29,11 @@ A custom component designed for [Home Assistant](https://www.home-assistant.io)

- AEG AX5 Air Purifiers
- AX51-304WT

- AEG AX7 Air Purifiers
- AX71-304GY
- AX71-304DG

- AEG AX9 Air Purifiers
- AX91-404GY
- AX91-404DG
Expand Down
17 changes: 5 additions & 12 deletions custom_components/wellbeing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
For more details about this integration, please refer to
https://github.com/JohNan/homeassistant-wellbeing
"""

import logging
from datetime import timedelta

Expand All @@ -24,6 +25,7 @@
_LOGGER: logging.Logger = logging.getLogger(__package__)
PLATFORMS = [Platform.SENSOR, Platform.FAN, Platform.BINARY_SENSOR, Platform.SWITCH]


async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):
"""Set up this integration using UI."""
if hass.data.get(DOMAIN) is None:
Expand All @@ -36,10 +38,7 @@ async def async_setup_entry(hass: HomeAssistant, entry: ConfigEntry):

token_manager = WellBeingTokenManager(hass, entry)
try:
hub = ElectroluxHubAPI(
session=async_get_clientsession(hass),
token_manager=token_manager
)
hub = ElectroluxHubAPI(session=async_get_clientsession(hass), token_manager=token_manager)
except Exception as exception:
raise ConfigEntryAuthFailed("Failed to setup API") from exception

Expand Down Expand Up @@ -86,9 +85,7 @@ async def _async_update_data(self):
"""Update data via library."""
try:
appliances = await self.api.async_get_appliances()
return {
"appliances": appliances
}
return {"appliances": appliances}
except Exception as exception:
raise UpdateFailed(exception) from exception

Expand All @@ -111,9 +108,5 @@ def update(self, access_token: str, refresh_token: str, api_key: str | None = No

self._hass.config_entries.async_update_entry(
self._entry,
data={
CONF_API_KEY: self.api_key,
CONF_REFRESH_TOKEN: refresh_token,
CONF_ACCESS_TOKEN: access_token
},
data={CONF_API_KEY: self.api_key, CONF_REFRESH_TOKEN: refresh_token, CONF_ACCESS_TOKEN: access_token},
)
Loading

0 comments on commit ef9101b

Please sign in to comment.