mirror of
https://github.com/home-assistant/core.git
synced 2025-07-19 11:17:21 +00:00
moved imports to top level (#27695)
This commit is contained in:
parent
40fbc3bd41
commit
b22eb22358
@ -2,6 +2,8 @@
|
|||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import aiodns
|
||||||
|
from aiodns.error import DNSError
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
@ -58,7 +60,6 @@ class WanIpSensor(Entity):
|
|||||||
|
|
||||||
def __init__(self, hass, name, hostname, resolver, ipv6):
|
def __init__(self, hass, name, hostname, resolver, ipv6):
|
||||||
"""Initialize the DNS IP sensor."""
|
"""Initialize the DNS IP sensor."""
|
||||||
import aiodns
|
|
||||||
|
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self._name = name
|
self._name = name
|
||||||
@ -80,7 +81,6 @@ class WanIpSensor(Entity):
|
|||||||
|
|
||||||
async def async_update(self):
|
async def async_update(self):
|
||||||
"""Get the current DNS IP address for hostname."""
|
"""Get the current DNS IP address for hostname."""
|
||||||
from aiodns.error import DNSError
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = await self.resolver.query(self.hostname, self.querytype)
|
response = await self.resolver.query(self.hostname, self.querytype)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user