mirror of
https://github.com/home-assistant/core.git
synced 2025-07-17 02:07:09 +00:00
moved imports to top level (#27458)
This commit is contained in:
parent
72b711fde6
commit
930b576685
@ -7,6 +7,8 @@ from collections import namedtuple
|
|||||||
import asyncio
|
import asyncio
|
||||||
import async_timeout
|
import async_timeout
|
||||||
|
|
||||||
|
import pyads
|
||||||
|
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.const import (
|
from homeassistant.const import (
|
||||||
@ -78,7 +80,6 @@ SCHEMA_SERVICE_WRITE_DATA_BY_NAME = vol.Schema(
|
|||||||
|
|
||||||
def setup(hass, config):
|
def setup(hass, config):
|
||||||
"""Set up the ADS component."""
|
"""Set up the ADS component."""
|
||||||
import pyads
|
|
||||||
|
|
||||||
conf = config[DOMAIN]
|
conf = config[DOMAIN]
|
||||||
|
|
||||||
@ -161,7 +162,6 @@ class AdsHub:
|
|||||||
|
|
||||||
def shutdown(self, *args, **kwargs):
|
def shutdown(self, *args, **kwargs):
|
||||||
"""Shutdown ADS connection."""
|
"""Shutdown ADS connection."""
|
||||||
import pyads
|
|
||||||
|
|
||||||
_LOGGER.debug("Shutting down ADS")
|
_LOGGER.debug("Shutting down ADS")
|
||||||
for notification_item in self._notification_items.values():
|
for notification_item in self._notification_items.values():
|
||||||
@ -187,7 +187,6 @@ class AdsHub:
|
|||||||
|
|
||||||
def write_by_name(self, name, value, plc_datatype):
|
def write_by_name(self, name, value, plc_datatype):
|
||||||
"""Write a value to the device."""
|
"""Write a value to the device."""
|
||||||
import pyads
|
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
try:
|
try:
|
||||||
@ -197,7 +196,6 @@ class AdsHub:
|
|||||||
|
|
||||||
def read_by_name(self, name, plc_datatype):
|
def read_by_name(self, name, plc_datatype):
|
||||||
"""Read a value from the device."""
|
"""Read a value from the device."""
|
||||||
import pyads
|
|
||||||
|
|
||||||
with self._lock:
|
with self._lock:
|
||||||
try:
|
try:
|
||||||
@ -207,7 +205,6 @@ class AdsHub:
|
|||||||
|
|
||||||
def add_device_notification(self, name, plc_datatype, callback):
|
def add_device_notification(self, name, plc_datatype, callback):
|
||||||
"""Add a notification to the ADS devices."""
|
"""Add a notification to the ADS devices."""
|
||||||
import pyads
|
|
||||||
|
|
||||||
attr = pyads.NotificationAttrib(ctypes.sizeof(plc_datatype))
|
attr = pyads.NotificationAttrib(ctypes.sizeof(plc_datatype))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user