mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 19:27:45 +00:00
Move imports to top for rainmachine (#29472)
This commit is contained in:
parent
c6b8d35c16
commit
d9661b408b
@ -1,8 +1,10 @@
|
|||||||
"""Support for RainMachine devices."""
|
"""Support for RainMachine devices."""
|
||||||
import asyncio
|
import asyncio
|
||||||
import logging
|
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
|
import logging
|
||||||
|
|
||||||
|
from regenmaschine import login
|
||||||
|
from regenmaschine.errors import RainMachineError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.config_entries import SOURCE_IMPORT
|
from homeassistant.config_entries import SOURCE_IMPORT
|
||||||
@ -10,12 +12,12 @@ from homeassistant.const import (
|
|||||||
ATTR_ATTRIBUTION,
|
ATTR_ATTRIBUTION,
|
||||||
CONF_BINARY_SENSORS,
|
CONF_BINARY_SENSORS,
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
|
CONF_MONITORED_CONDITIONS,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
CONF_PORT,
|
CONF_PORT,
|
||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
CONF_SENSORS,
|
CONF_SENSORS,
|
||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
CONF_MONITORED_CONDITIONS,
|
|
||||||
CONF_SWITCHES,
|
CONF_SWITCHES,
|
||||||
)
|
)
|
||||||
from homeassistant.exceptions import ConfigEntryNotReady
|
from homeassistant.exceptions import ConfigEntryNotReady
|
||||||
@ -211,8 +213,6 @@ async def async_setup(hass, config):
|
|||||||
|
|
||||||
async def async_setup_entry(hass, config_entry):
|
async def async_setup_entry(hass, config_entry):
|
||||||
"""Set up RainMachine as config entry."""
|
"""Set up RainMachine as config entry."""
|
||||||
from regenmaschine import login
|
|
||||||
from regenmaschine.errors import RainMachineError
|
|
||||||
|
|
||||||
_verify_domain_control = verify_domain_control(hass, DOMAIN)
|
_verify_domain_control = verify_domain_control(hass, DOMAIN)
|
||||||
|
|
||||||
@ -377,7 +377,6 @@ class RainMachine:
|
|||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Update sensor/binary sensor data."""
|
"""Update sensor/binary sensor data."""
|
||||||
from regenmaschine.errors import RainMachineError
|
|
||||||
|
|
||||||
tasks = {}
|
tasks = {}
|
||||||
|
|
||||||
|
@ -2,10 +2,11 @@
|
|||||||
|
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
|
||||||
|
from regenmaschine import login
|
||||||
|
from regenmaschine.errors import RainMachineError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant import config_entries
|
from homeassistant import config_entries
|
||||||
from homeassistant.core import callback
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
CONF_IP_ADDRESS,
|
CONF_IP_ADDRESS,
|
||||||
CONF_PASSWORD,
|
CONF_PASSWORD,
|
||||||
@ -13,6 +14,7 @@ from homeassistant.const import (
|
|||||||
CONF_SCAN_INTERVAL,
|
CONF_SCAN_INTERVAL,
|
||||||
CONF_SSL,
|
CONF_SSL,
|
||||||
)
|
)
|
||||||
|
from homeassistant.core import callback
|
||||||
from homeassistant.helpers import aiohttp_client
|
from homeassistant.helpers import aiohttp_client
|
||||||
|
|
||||||
from .const import DEFAULT_PORT, DEFAULT_SCAN_INTERVAL, DEFAULT_SSL, DOMAIN
|
from .const import DEFAULT_PORT, DEFAULT_SCAN_INTERVAL, DEFAULT_SSL, DOMAIN
|
||||||
@ -55,8 +57,6 @@ class RainMachineFlowHandler(config_entries.ConfigFlow):
|
|||||||
|
|
||||||
async def async_step_user(self, user_input=None):
|
async def async_step_user(self, user_input=None):
|
||||||
"""Handle the start of the config flow."""
|
"""Handle the start of the config flow."""
|
||||||
from regenmaschine import login
|
|
||||||
from regenmaschine.errors import RainMachineError
|
|
||||||
|
|
||||||
if not user_input:
|
if not user_input:
|
||||||
return await self._show_form()
|
return await self._show_form()
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from regenmaschine.errors import RequestError
|
||||||
|
|
||||||
from homeassistant.components.switch import SwitchDevice
|
from homeassistant.components.switch import SwitchDevice
|
||||||
from homeassistant.const import ATTR_ID
|
from homeassistant.const import ATTR_ID
|
||||||
from homeassistant.core import callback
|
from homeassistant.core import callback
|
||||||
@ -181,7 +183,6 @@ class RainMachineProgram(RainMachineSwitch):
|
|||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs) -> None:
|
||||||
"""Turn the program off."""
|
"""Turn the program off."""
|
||||||
from regenmaschine.errors import RequestError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.rainmachine.client.programs.stop(self._rainmachine_entity_id)
|
await self.rainmachine.client.programs.stop(self._rainmachine_entity_id)
|
||||||
@ -193,7 +194,6 @@ class RainMachineProgram(RainMachineSwitch):
|
|||||||
|
|
||||||
async def async_turn_on(self, **kwargs) -> None:
|
async def async_turn_on(self, **kwargs) -> None:
|
||||||
"""Turn the program on."""
|
"""Turn the program on."""
|
||||||
from regenmaschine.errors import RequestError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.rainmachine.client.programs.start(self._rainmachine_entity_id)
|
await self.rainmachine.client.programs.start(self._rainmachine_entity_id)
|
||||||
@ -205,7 +205,6 @@ class RainMachineProgram(RainMachineSwitch):
|
|||||||
|
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
"""Update info for the program."""
|
"""Update info for the program."""
|
||||||
from regenmaschine.errors import RequestError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._obj = await self.rainmachine.client.programs.get(
|
self._obj = await self.rainmachine.client.programs.get(
|
||||||
@ -265,7 +264,6 @@ class RainMachineZone(RainMachineSwitch):
|
|||||||
|
|
||||||
async def async_turn_off(self, **kwargs) -> None:
|
async def async_turn_off(self, **kwargs) -> None:
|
||||||
"""Turn the zone off."""
|
"""Turn the zone off."""
|
||||||
from regenmaschine.errors import RequestError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.rainmachine.client.zones.stop(self._rainmachine_entity_id)
|
await self.rainmachine.client.zones.stop(self._rainmachine_entity_id)
|
||||||
@ -274,7 +272,6 @@ class RainMachineZone(RainMachineSwitch):
|
|||||||
|
|
||||||
async def async_turn_on(self, **kwargs) -> None:
|
async def async_turn_on(self, **kwargs) -> None:
|
||||||
"""Turn the zone on."""
|
"""Turn the zone on."""
|
||||||
from regenmaschine.errors import RequestError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await self.rainmachine.client.zones.start(
|
await self.rainmachine.client.zones.start(
|
||||||
@ -285,7 +282,6 @@ class RainMachineZone(RainMachineSwitch):
|
|||||||
|
|
||||||
async def async_update(self) -> None:
|
async def async_update(self) -> None:
|
||||||
"""Update info for the zone."""
|
"""Update info for the zone."""
|
||||||
from regenmaschine.errors import RequestError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._obj = await self.rainmachine.client.zones.get(
|
self._obj = await self.rainmachine.client.zones.get(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user