Move imports to top for random (#29473)
This commit is contained in:
parent
d9661b408b
commit
c02d551cd5
2 changed files with 6 additions and 6 deletions
|
@ -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))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue