Fix PEPE257 issues
This commit is contained in:
1 parent
49ebc6d0b0
commit
8bff97083c
49 files changed
+429
-363
No files matched your search
@@ -21,8 +21,7 @@ OPTION_TYPES = {
|
||||
|
||||
|
||||
def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
"""Get the Time and Date sensor."""
|
||||
|
||||
"""Setup the Time and Date sensor."""
|
||||
if hass.config.time_zone is None:
|
||||
_LOGGER.error("Timezone is not set in Home Assistant config")
|
||||
return False
|
||||
@@ -39,9 +38,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
|
||||
|
||||
# pylint: disable=too-few-public-methods
|
||||
class TimeDateSensor(Entity):
|
||||
"""Implements a Time and Date sensor."""
|
||||
"""Implementation of a Time and Date sensor."""
|
||||
|
||||
def __init__(self, option_type):
|
||||
"""Initialize the sensor."""
|
||||
self._name = OPTION_TYPES[option_type]
|
||||
self.type = option_type
|
||||
self._state = None
|
||||
@@ -49,12 +49,12 @@ class TimeDateSensor(Entity):
|
||||
|
||||
@property
|
||||
def name(self):
|
||||
"""Returns the name of the sensor."""
|
||||
"""Return the name of the sensor."""
|
||||
return self._name
|
||||
|
||||
@property
|
||||
def state(self):
|
||||
"""Returns the state of the sensor."""
|
||||
"""Return the state of the sensor."""
|
||||
return self._state
|
||||
|
||||
@property
|
||||
@@ -68,7 +68,7 @@ class TimeDateSensor(Entity):
|
||||
return "mdi:clock"
|
||||
|
||||
def update(self):
|
||||
"""Gets the latest data and updates the states."""
|
||||
"""Get the latest data and updates the states."""
|
||||
time_date = dt_util.utcnow()
|
||||
time = dt_util.datetime_to_time_str(dt_util.as_local(time_date))
|
||||
time_utc = dt_util.datetime_to_time_str(time_date)
|
||||
|
||||
Reference in new issue
Block a user