mirror of
https://github.com/home-assistant/core.git
synced 2025-07-25 06:07:17 +00:00
Move imports in gpsd component (#27997)
This commit is contained in:
parent
5fb3f6038b
commit
6844d203a1
@ -1,6 +1,8 @@
|
|||||||
"""Support for GPSD."""
|
"""Support for GPSD."""
|
||||||
import logging
|
import logging
|
||||||
|
import socket
|
||||||
|
|
||||||
|
from gps3.agps3threaded import AGPS3mechanism
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
from homeassistant.components.sensor import PLATFORM_SCHEMA
|
||||||
@ -9,11 +11,11 @@ from homeassistant.const import (
|
|||||||
ATTR_LONGITUDE,
|
ATTR_LONGITUDE,
|
||||||
ATTR_MODE,
|
ATTR_MODE,
|
||||||
CONF_HOST,
|
CONF_HOST,
|
||||||
CONF_PORT,
|
|
||||||
CONF_NAME,
|
CONF_NAME,
|
||||||
|
CONF_PORT,
|
||||||
)
|
)
|
||||||
from homeassistant.helpers.entity import Entity
|
|
||||||
import homeassistant.helpers.config_validation as cv
|
import homeassistant.helpers.config_validation as cv
|
||||||
|
from homeassistant.helpers.entity import Entity
|
||||||
|
|
||||||
_LOGGER = logging.getLogger(__name__)
|
_LOGGER = logging.getLogger(__name__)
|
||||||
|
|
||||||
@ -50,7 +52,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
|||||||
# except GPSError:
|
# except GPSError:
|
||||||
# _LOGGER.warning('Not able to connect to GPSD')
|
# _LOGGER.warning('Not able to connect to GPSD')
|
||||||
# return False
|
# return False
|
||||||
import socket
|
|
||||||
|
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||||
try:
|
try:
|
||||||
@ -69,8 +70,6 @@ class GpsdSensor(Entity):
|
|||||||
|
|
||||||
def __init__(self, hass, name, host, port):
|
def __init__(self, hass, name, host, port):
|
||||||
"""Initialize the GPSD sensor."""
|
"""Initialize the GPSD sensor."""
|
||||||
from gps3.agps3threaded import AGPS3mechanism
|
|
||||||
|
|
||||||
self.hass = hass
|
self.hass = hass
|
||||||
self._name = name
|
self._name = name
|
||||||
self._host = host
|
self._host = host
|
||||||
|
Loading…
x
Reference in New Issue
Block a user