Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Apr 14, 2024
1 parent 841e982 commit 2d978df
Show file tree
Hide file tree
Showing 8 changed files with 115 additions and 119 deletions.
118 changes: 59 additions & 59 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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$
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# yoto_ha

Home Assistant Integration for Yoto
5 changes: 2 additions & 3 deletions custom_components/yoto/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
9 changes: 4 additions & 5 deletions custom_components/yoto/binary_sensor.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Sensor for Yoto integration."""

from __future__ import annotations

from collections.abc import Callable
Expand Down Expand Up @@ -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",
),
)

Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions custom_components/yoto/config_flow.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Config flow for Hyundai / Kia Connect integration."""

from __future__ import annotations

import hashlib
Expand Down
11 changes: 3 additions & 8 deletions custom_components/yoto/coordinator.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
"""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 (
CONF_PASSWORD,
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,
Expand Down Expand Up @@ -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
Expand All @@ -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
)

1 change: 1 addition & 0 deletions custom_components/yoto/entity.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Base Entity for Hyundai / Kia Connect integration."""

from homeassistant.helpers.update_coordinator import CoordinatorEntity
from homeassistant.helpers.entity import DeviceInfo

Expand Down
88 changes: 44 additions & 44 deletions custom_components/yoto/translations/en.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
}
}

0 comments on commit 2d978df

Please sign in to comment.