From 2d978df963ff3afea7d4585947192a7775dd7f02 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sun, 14 Apr 2024 20:19:24 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .pre-commit-config.yaml | 118 ++++++++++---------- README.md | 1 + custom_components/yoto/__init__.py | 5 +- custom_components/yoto/binary_sensor.py | 9 +- custom_components/yoto/config_flow.py | 1 + custom_components/yoto/coordinator.py | 11 +- custom_components/yoto/entity.py | 1 + custom_components/yoto/translations/en.json | 88 +++++++-------- 8 files changed, 115 insertions(+), 119 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c434003..b82cdf9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,62 +1,62 @@ --- ci: - autoupdate_commit_msg: "chore: pre-commit autoupdate" + autoupdate_commit_msg: "chore: pre-commit autoupdate" repos: - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.3 - hooks: - - id: ruff - args: - - --fix - - id: ruff-format - - repo: https://github.com/codespell-project/codespell - rev: v2.2.6 - hooks: - - id: codespell - args: - - --ignore-words-list=fro,hass - - --skip="./.*,*.csv,*.json,*.ambr" - - --quiet-level=2 - exclude_types: [csv, json] - - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 - hooks: - - id: trailing-whitespace - - id: end-of-file-fixer - - id: check-executables-have-shebangs - stages: [manual] - - id: check-json - exclude: (.vscode|.devcontainer) - - repo: https://github.com/asottile/pyupgrade - rev: v3.15.1 - hooks: - - id: pyupgrade - - repo: https://github.com/adrienverge/yamllint.git - rev: v1.35.1 - hooks: - - id: yamllint - exclude: (.github|.vscode|.devcontainer) - - repo: https://github.com/pre-commit/mirrors-prettier - rev: v4.0.0-alpha.8 - hooks: - - id: prettier - - repo: https://github.com/cdce8p/python-typing-update - rev: v0.6.0 - hooks: - # Run `python-typing-update` hook manually from time to time - # to update python typing syntax. - # Will require manual work, before submitting changes! - # pre-commit run --hook-stage manual python-typing-update --all-files - - id: python-typing-update - stages: [manual] - args: - - --py311-plus - - --force - - --keep-updates - files: ^(/.+)?[^/]+\.py$ - - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.9.0 - hooks: - - id: mypy - args: [--strict, --ignore-missing-imports] - files: ^(/.+)?[^/]+\.py$ + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.3.3 + hooks: + - id: ruff + args: + - --fix + - id: ruff-format + - repo: https://github.com/codespell-project/codespell + rev: v2.2.6 + hooks: + - id: codespell + args: + - --ignore-words-list=fro,hass + - --skip="./.*,*.csv,*.json,*.ambr" + - --quiet-level=2 + exclude_types: [csv, json] + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.5.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-executables-have-shebangs + stages: [manual] + - id: check-json + exclude: (.vscode|.devcontainer) + - repo: https://github.com/asottile/pyupgrade + rev: v3.15.1 + hooks: + - id: pyupgrade + - repo: https://github.com/adrienverge/yamllint.git + rev: v1.35.1 + hooks: + - id: yamllint + exclude: (.github|.vscode|.devcontainer) + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + - repo: https://github.com/cdce8p/python-typing-update + rev: v0.6.0 + hooks: + # Run `python-typing-update` hook manually from time to time + # to update python typing syntax. + # Will require manual work, before submitting changes! + # pre-commit run --hook-stage manual python-typing-update --all-files + - id: python-typing-update + stages: [manual] + args: + - --py311-plus + - --force + - --keep-updates + files: ^(/.+)?[^/]+\.py$ + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.9.0 + hooks: + - id: mypy + args: [--strict, --ignore-missing-imports] + files: ^(/.+)?[^/]+\.py$ diff --git a/README.md b/README.md index 71bf1ae..8083975 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # yoto_ha + Home Assistant Integration for Yoto diff --git a/custom_components/yoto/__init__.py b/custom_components/yoto/__init__.py index 2de58fe..8e59b69 100644 --- a/custom_components/yoto/__init__.py +++ b/custom_components/yoto/__init__.py @@ -22,13 +22,12 @@ PLATFORMS: list[str] = [ Platform.BINARY_SENSOR, - #Platform.SENSOR, - #Platform.NUMBER, + # Platform.SENSOR, + # Platform.NUMBER, ] async def async_setup(hass: HomeAssistant, config_entry: ConfigEntry): - return True diff --git a/custom_components/yoto/binary_sensor.py b/custom_components/yoto/binary_sensor.py index d5ebfe4..8091699 100644 --- a/custom_components/yoto/binary_sensor.py +++ b/custom_components/yoto/binary_sensor.py @@ -1,4 +1,5 @@ """Sensor for Yoto integration.""" + from __future__ import annotations from collections.abc import Callable @@ -38,8 +39,8 @@ class YotoBinarySensorEntityDescription(BinarySensorEntityDescription): key="online", name="Online", is_on=lambda player: player.engine_is_running, - #on_icon="mdi:engine", - #off_icon="mdi:engine-off", + # on_icon="mdi:engine", + # off_icon="mdi:engine-off", ), ) @@ -56,9 +57,7 @@ async def async_setup_entry( player: YotoPlayer = coordinator.yoto_manger.players[vehicle_id] for description in SENSOR_DESCRIPTIONS: if getattr(player, description.key, None) is not None: - entities.append( - YotoBinarySensor(coordinator, description, vehicle) - ) + entities.append(YotoBinarySensor(coordinator, description, vehicle)) async_add_entities(entities) return True diff --git a/custom_components/yoto/config_flow.py b/custom_components/yoto/config_flow.py index 978f77a..82da728 100644 --- a/custom_components/yoto/config_flow.py +++ b/custom_components/yoto/config_flow.py @@ -1,4 +1,5 @@ """Config flow for Hyundai / Kia Connect integration.""" + from __future__ import annotations import hashlib diff --git a/custom_components/yoto/coordinator.py b/custom_components/yoto/coordinator.py index ae605de..e244e7e 100644 --- a/custom_components/yoto/coordinator.py +++ b/custom_components/yoto/coordinator.py @@ -1,16 +1,14 @@ """Coordinator for yoto integration.""" + from __future__ import annotations -from datetime import timedelta import logging -from site import venv from yoto_api import ( YotoManager, ) -from homeassistant.exceptions import ConfigEntryAuthFailed from homeassistant.config_entries import ConfigEntry from homeassistant.const import ( @@ -18,10 +16,8 @@ CONF_SCAN_INTERVAL, CONF_USERNAME, ) -from homeassistant.exceptions import ConfigEntryAuthFailed from homeassistant.core import HomeAssistant -from homeassistant.helpers.update_coordinator import DataUpdateCoordinator, UpdateFailed -from homeassistant.util import dt as dt_util +from homeassistant.helpers.update_coordinator import DataUpdateCoordinator from .const import ( DEFAULT_SCAN_INTERVAL, @@ -59,7 +55,7 @@ async def _async_update_data(self): # try: await self.async_check_and_refresh_token() # except AuthenticationError as AuthError: - #raise ConfigEntryAuthFailed(AuthError) from AuthError + # raise ConfigEntryAuthFailed(AuthError) from AuthError await self.hass.async_add_executor_job( self.yoto_manager.update_all_vehicles_with_cached_state @@ -80,4 +76,3 @@ async def async_check_and_refresh_token(self): await self.hass.async_add_executor_job( self.yoto_manager.check_and_refresh_token ) - diff --git a/custom_components/yoto/entity.py b/custom_components/yoto/entity.py index d82d9c0..3db3839 100644 --- a/custom_components/yoto/entity.py +++ b/custom_components/yoto/entity.py @@ -1,4 +1,5 @@ """Base Entity for Hyundai / Kia Connect integration.""" + from homeassistant.helpers.update_coordinator import CoordinatorEntity from homeassistant.helpers.entity import DeviceInfo diff --git a/custom_components/yoto/translations/en.json b/custom_components/yoto/translations/en.json index cc018be..740aac6 100644 --- a/custom_components/yoto/translations/en.json +++ b/custom_components/yoto/translations/en.json @@ -1,48 +1,48 @@ { - "title":"Yoto", - "config":{ - "step":{ - "user":{ - "title":"Yoto - Authentication", - "description":"Set up your Yoto to integrate with Home Assistant.", - "data":{ - "username":"Username", - "password":"Password" - } - }, - "reauth_confirm":{ - "title":"Yoto - Reauthentication", - "description":"Your account is unable to authenticate. Click Submit to re-setup." - } - }, - "abort":{ - "already_configured":"Device is already configured" - }, - "error":{ - "invalid_auth":"Login failed into Yoto Servers. Please use official app to logout and log back in and try again!", - "unknown":"Unexpected error" - } + "title": "Yoto", + "config": { + "step": { + "user": { + "title": "Yoto - Authentication", + "description": "Set up your Yoto to integrate with Home Assistant.", + "data": { + "username": "Username", + "password": "Password" + } + }, + "reauth_confirm": { + "title": "Yoto - Reauthentication", + "description": "Your account is unable to authenticate. Click Submit to re-setup." + } }, - "options":{ - "step":{ - "init":{ - "title":"Yoto - Configuration", - "data":{ - "scan_interval":"Scan Interval (min)" - } - } - } + "abort": { + "already_configured": "Device is already configured" }, - "services": { - "update": { - "name": "Update", - "description": "Update player data from service cache", - "fields": { - "device_id": { - "name": "Player", - "description": "Target Player" - } - } - } + "error": { + "invalid_auth": "Login failed into Yoto Servers. Please use official app to logout and log back in and try again!", + "unknown": "Unexpected error" } - } + }, + "options": { + "step": { + "init": { + "title": "Yoto - Configuration", + "data": { + "scan_interval": "Scan Interval (min)" + } + } + } + }, + "services": { + "update": { + "name": "Update", + "description": "Update player data from service cache", + "fields": { + "device_id": { + "name": "Player", + "description": "Target Player" + } + } + } + } +}