mirror of
https://github.com/home-assistant/core.git
synced 2025-04-23 16:57:53 +00:00
Bump Ohme to platinum (#141762)
* Bump version of ohmepy and fix types * Add strict typing to ohme * Inject websession for ohme * CI/code formatting fixes for ohme * Update mypy.ini for ohme * Fix typing in services for ohme * Bump ohme quality in manifest
This commit is contained in:
parent
32ee31b8c7
commit
7068986c14
@ -364,6 +364,7 @@ homeassistant.components.notify.*
|
||||
homeassistant.components.notion.*
|
||||
homeassistant.components.number.*
|
||||
homeassistant.components.nut.*
|
||||
homeassistant.components.ohme.*
|
||||
homeassistant.components.onboarding.*
|
||||
homeassistant.components.oncue.*
|
||||
homeassistant.components.onedrive.*
|
||||
|
@ -6,6 +6,7 @@ from homeassistant.const import CONF_EMAIL, CONF_PASSWORD
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.exceptions import ConfigEntryAuthFailed, ConfigEntryNotReady
|
||||
from homeassistant.helpers import config_validation as cv
|
||||
from homeassistant.helpers.aiohttp_client import async_get_clientsession
|
||||
from homeassistant.helpers.typing import ConfigType
|
||||
|
||||
from .const import DOMAIN, PLATFORMS
|
||||
@ -31,7 +32,11 @@ async def async_setup(hass: HomeAssistant, config: ConfigType) -> bool:
|
||||
async def async_setup_entry(hass: HomeAssistant, entry: OhmeConfigEntry) -> bool:
|
||||
"""Set up Ohme from a config entry."""
|
||||
|
||||
client = OhmeApiClient(entry.data[CONF_EMAIL], entry.data[CONF_PASSWORD])
|
||||
client = OhmeApiClient(
|
||||
email=entry.data[CONF_EMAIL],
|
||||
password=entry.data[CONF_PASSWORD],
|
||||
session=async_get_clientsession(hass),
|
||||
)
|
||||
|
||||
try:
|
||||
await client.async_login()
|
||||
|
@ -6,6 +6,6 @@
|
||||
"documentation": "https://www.home-assistant.io/integrations/ohme/",
|
||||
"integration_type": "device",
|
||||
"iot_class": "cloud_polling",
|
||||
"quality_scale": "silver",
|
||||
"quality_scale": "platinum",
|
||||
"requirements": ["ohme==1.5.1"]
|
||||
}
|
||||
|
@ -75,6 +75,6 @@ rules:
|
||||
comment: |
|
||||
Not supported by the API. Accounts and devices have a one-to-one relationship.
|
||||
# Platinum
|
||||
async-dependency: todo
|
||||
inject-websession: todo
|
||||
strict-typing: todo
|
||||
async-dependency: done
|
||||
inject-websession: done
|
||||
strict-typing: done
|
||||
|
@ -5,7 +5,7 @@ from typing import Final
|
||||
from ohme import OhmeApiClient
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant.config_entries import ConfigEntry, ConfigEntryState
|
||||
from homeassistant.config_entries import ConfigEntryState
|
||||
from homeassistant.core import (
|
||||
HomeAssistant,
|
||||
ServiceCall,
|
||||
@ -16,6 +16,7 @@ from homeassistant.exceptions import ServiceValidationError
|
||||
from homeassistant.helpers import selector
|
||||
|
||||
from .const import DOMAIN
|
||||
from .coordinator import OhmeConfigEntry
|
||||
|
||||
ATTR_CONFIG_ENTRY: Final = "config_entry"
|
||||
ATTR_PRICE_CAP: Final = "price_cap"
|
||||
@ -47,7 +48,7 @@ SERVICE_SET_PRICE_CAP_SCHEMA: Final = vol.Schema(
|
||||
def __get_client(call: ServiceCall) -> OhmeApiClient:
|
||||
"""Get the client from the config entry."""
|
||||
entry_id: str = call.data[ATTR_CONFIG_ENTRY]
|
||||
entry: ConfigEntry | None = call.hass.config_entries.async_get_entry(entry_id)
|
||||
entry: OhmeConfigEntry | None = call.hass.config_entries.async_get_entry(entry_id)
|
||||
|
||||
if not entry:
|
||||
raise ServiceValidationError(
|
||||
|
10
mypy.ini
generated
10
mypy.ini
generated
@ -3396,6 +3396,16 @@ disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.ohme.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
disallow_subclassing_any = true
|
||||
disallow_untyped_calls = true
|
||||
disallow_untyped_decorators = true
|
||||
disallow_untyped_defs = true
|
||||
warn_return_any = true
|
||||
warn_unreachable = true
|
||||
|
||||
[mypy-homeassistant.components.onboarding.*]
|
||||
check_untyped_defs = true
|
||||
disallow_incomplete_defs = true
|
||||
|
Loading…
x
Reference in New Issue
Block a user