Move imports to top for random (#29473)

This commit is contained in:
springstan authored and Paulus Schoutsen committed 2019-12-04 21:13:05 -08:00
1 parent d9661b408b
commit c02d551cd5
2 files changed
+6 -6

No files matched your search

@@ -1,15 +1,16 @@
"""Support for showing random states."""
import logging
from random import getrandbits
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.binary_sensor import (
BinarySensorDevice,
PLATFORM_SCHEMA,
DEVICE_CLASSES_SCHEMA,
PLATFORM_SCHEMA,
BinarySensorDevice,
)
from homeassistant.const import CONF_NAME, CONF_DEVICE_CLASS
from homeassistant.const import CONF_DEVICE_CLASS, CONF_NAME
import homeassistant.helpers.config_validation as cv
_LOGGER = logging.getLogger(__name__)
@@ -57,6 +58,5 @@ class RandomSensor(BinarySensorDevice):
async def async_update(self):
"""Get new state and update the sensor's state."""
from random import getrandbits
self._state = bool(getrandbits(1))