Clean up after global variable deletion (#33743)
* Clean up after global variable deletion * Remove self from method calls
This commit is contained in:
parent
f3b6575272
commit
0d2de919a6
6 changed files with 3 additions and 17 deletions
|
@ -26,7 +26,6 @@ def setup(hass, config):
|
||||||
|
|
||||||
port = config[DOMAIN][CONF_PORT]
|
port = config[DOMAIN][CONF_PORT]
|
||||||
|
|
||||||
board = None
|
|
||||||
try:
|
try:
|
||||||
board = ArduinoBoard(port)
|
board = ArduinoBoard(port)
|
||||||
except (serial.serialutil.SerialException, FileNotFoundError):
|
except (serial.serialutil.SerialException, FileNotFoundError):
|
||||||
|
|
|
@ -26,10 +26,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Arduino platform."""
|
"""Set up the Arduino platform."""
|
||||||
board = hass.data[DOMAIN]
|
board = hass.data[DOMAIN]
|
||||||
|
|
||||||
if board is None:
|
|
||||||
_LOGGER.error("A connection has not been made to the Arduino board")
|
|
||||||
return False
|
|
||||||
|
|
||||||
pins = config.get(CONF_PINS)
|
pins = config.get(CONF_PINS)
|
||||||
|
|
||||||
sensors = []
|
sensors = []
|
||||||
|
|
|
@ -33,11 +33,6 @@ def setup_platform(hass, config, add_entities, discovery_info=None):
|
||||||
"""Set up the Arduino platform."""
|
"""Set up the Arduino platform."""
|
||||||
board = hass.data[DOMAIN]
|
board = hass.data[DOMAIN]
|
||||||
|
|
||||||
# Verify that Arduino board is present
|
|
||||||
if board is None:
|
|
||||||
_LOGGER.error("A connection has not been made to the Arduino board")
|
|
||||||
return False
|
|
||||||
|
|
||||||
pins = config.get(CONF_PINS)
|
pins = config.get(CONF_PINS)
|
||||||
|
|
||||||
switches = []
|
switches = []
|
||||||
|
|
|
@ -30,7 +30,6 @@ def setup(hass, config):
|
||||||
"""Set up the BloomSky component."""
|
"""Set up the BloomSky component."""
|
||||||
api_key = config[DOMAIN][CONF_API_KEY]
|
api_key = config[DOMAIN][CONF_API_KEY]
|
||||||
|
|
||||||
bloomsky = None
|
|
||||||
try:
|
try:
|
||||||
bloomsky = BloomSky(api_key, hass.config.units.is_metric)
|
bloomsky = BloomSky(api_key, hass.config.units.is_metric)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
|
|
@ -36,8 +36,6 @@ def setup(hass, config):
|
||||||
Will automatically load sensor components to support
|
Will automatically load sensor components to support
|
||||||
devices discovered on the account.
|
devices discovered on the account.
|
||||||
"""
|
"""
|
||||||
data = None
|
|
||||||
|
|
||||||
username = config[DOMAIN][CONF_USERNAME]
|
username = config[DOMAIN][CONF_USERNAME]
|
||||||
password = config[DOMAIN][CONF_PASSWORD]
|
password = config[DOMAIN][CONF_PASSWORD]
|
||||||
client = Sleepyq(username, password)
|
client = Sleepyq(username, password)
|
||||||
|
|
|
@ -26,10 +26,9 @@ class IsInBedBinarySensor(SleepIQSensor, BinarySensorDevice):
|
||||||
|
|
||||||
def __init__(self, sleepiq_data, bed_id, side):
|
def __init__(self, sleepiq_data, bed_id, side):
|
||||||
"""Initialize the sensor."""
|
"""Initialize the sensor."""
|
||||||
SleepIQSensor.__init__(self, sleepiq_data, bed_id, side)
|
super().__init__(sleepiq_data, bed_id, side)
|
||||||
self.type = IS_IN_BED
|
|
||||||
self._state = None
|
self._state = None
|
||||||
self._name = SENSOR_TYPES[self.type]
|
self._name = SENSOR_TYPES[IS_IN_BED]
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -44,5 +43,5 @@ class IsInBedBinarySensor(SleepIQSensor, BinarySensorDevice):
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
"""Get the latest data from SleepIQ and updates the states."""
|
"""Get the latest data from SleepIQ and updates the states."""
|
||||||
SleepIQSensor.update(self)
|
super().update()
|
||||||
self._state = self.side.is_in_bed
|
self._state = self.side.is_in_bed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue