mirror of
https://github.com/home-assistant/core.git
synced 2025-07-11 23:37:18 +00:00
pylint and PEP8 errors
This commit is contained in:
parent
f4e54719b9
commit
8c6e6e464e
@ -122,7 +122,7 @@ def setup(hass, config):
|
|||||||
hass.states.set("tellstick_sensor.Outside_humidity", "54",
|
hass.states.set("tellstick_sensor.Outside_humidity", "54",
|
||||||
{
|
{
|
||||||
'friendly_name': 'Outside humidity',
|
'friendly_name': 'Outside humidity',
|
||||||
'unit_of_measurement': '°C'
|
'unit_of_measurement': '%'
|
||||||
})
|
})
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -65,6 +65,9 @@ def setup(hass, config):
|
|||||||
if switch_type == 'wemo':
|
if switch_type == 'wemo':
|
||||||
switch_init = get_wemo_switches
|
switch_init = get_wemo_switches
|
||||||
|
|
||||||
|
elif switch_type == 'tellstick':
|
||||||
|
switch_init = get_tellstick_switches
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.error("Unknown switch type specified: %s", switch_type)
|
logger.error("Unknown switch type specified: %s", switch_type)
|
||||||
|
|
||||||
@ -225,7 +228,7 @@ class TellstickSwitch(ToggleDevice):
|
|||||||
return self.tellstick.name
|
return self.tellstick.name
|
||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def turn_on(self, dimming=None):
|
def turn_on(self, **kwargs):
|
||||||
""" Turns the switch on. """
|
""" Turns the switch on. """
|
||||||
self.tellstick.turn_on()
|
self.tellstick.turn_on()
|
||||||
|
|
||||||
@ -235,6 +238,7 @@ class TellstickSwitch(ToggleDevice):
|
|||||||
|
|
||||||
def is_on(self):
|
def is_on(self):
|
||||||
""" True if switch is on. """
|
""" True if switch is on. """
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import tellcore.constants as tellcore_constants
|
import tellcore.constants as tellcore_constants
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -15,7 +15,8 @@ temperature_scale: The scale of the temperature value
|
|||||||
temperature_scale=°C
|
temperature_scale=°C
|
||||||
|
|
||||||
datatype_mask: mask to determine which sensor values to show based on
|
datatype_mask: mask to determine which sensor values to show based on
|
||||||
https://tellcore-py.readthedocs.org/en/v1.0.4/constants.html#module-tellcore.constants
|
https://tellcore-py.readthedocs.org
|
||||||
|
/en/v1.0.4/constants.html#module-tellcore.constants
|
||||||
|
|
||||||
datatype_mask=1 # only show temperature
|
datatype_mask=1 # only show temperature
|
||||||
datatype_mask=12 # only show rain rate and rain total
|
datatype_mask=12 # only show rain rate and rain total
|
||||||
@ -62,7 +63,7 @@ def setup(hass, config):
|
|||||||
logger.error("No Tellstick sensors found")
|
logger.error("No Tellstick sensors found")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
sensor_value_datatype_descriptions = {
|
sensor_value_descriptions = {
|
||||||
tellcore_constants.TELLSTICK_TEMPERATURE:
|
tellcore_constants.TELLSTICK_TEMPERATURE:
|
||||||
DatatypeDescription('temperature',
|
DatatypeDescription('temperature',
|
||||||
config[DOMAIN]['temperature_scale']),
|
config[DOMAIN]['temperature_scale']),
|
||||||
@ -81,10 +82,11 @@ def setup(hass, config):
|
|||||||
}
|
}
|
||||||
|
|
||||||
def update_sensor_value_state(sensor_name, sensor_value):
|
def update_sensor_value_state(sensor_name, sensor_value):
|
||||||
sensor_value_datatype_description = \
|
"Update the state of a sensor value"
|
||||||
sensor_value_datatype_descriptions[sensor_value.datatype]
|
sensor_value_description = \
|
||||||
|
sensor_value_descriptions[sensor_value.datatype]
|
||||||
sensor_value_name = '{} {}'.format(
|
sensor_value_name = '{} {}'.format(
|
||||||
sensor_name, sensor_value_datatype_description.name)
|
sensor_name, sensor_value_description.name)
|
||||||
|
|
||||||
entity_id = ENTITY_ID_FORMAT.format(
|
entity_id = ENTITY_ID_FORMAT.format(
|
||||||
util.slugify(sensor_value_name))
|
util.slugify(sensor_value_name))
|
||||||
@ -94,7 +96,7 @@ def setup(hass, config):
|
|||||||
state_attr = {
|
state_attr = {
|
||||||
ATTR_FRIENDLY_NAME: sensor_value_name,
|
ATTR_FRIENDLY_NAME: sensor_value_name,
|
||||||
ATTR_UNIT_OF_MEASUREMENT:
|
ATTR_UNIT_OF_MEASUREMENT:
|
||||||
sensor_value_datatype_description.unit
|
sensor_value_description.unit
|
||||||
}
|
}
|
||||||
|
|
||||||
hass.states.set(entity_id, state, state_attr)
|
hass.states.set(entity_id, state, state_attr)
|
||||||
@ -110,6 +112,7 @@ def setup(hass, config):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def update_sensor_state(sensor):
|
def update_sensor_state(sensor):
|
||||||
|
"Updates all the sensor values from the sensor"
|
||||||
try:
|
try:
|
||||||
sensor_name = config[DOMAIN][str(sensor.id)]
|
sensor_name = config[DOMAIN][str(sensor.id)]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
@ -124,6 +127,7 @@ def setup(hass, config):
|
|||||||
|
|
||||||
# pylint: disable=unused-argument
|
# pylint: disable=unused-argument
|
||||||
def update_sensors_state(time):
|
def update_sensors_state(time):
|
||||||
|
"Update the state of all sensors"
|
||||||
for sensor in sensors:
|
for sensor in sensors:
|
||||||
update_sensor_state(sensor)
|
update_sensor_state(sensor)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user