pylint and PEP8 errors

This commit is contained in:
Gustav Ahlberg 2014-11-11 22:35:06 +01:00 committed by Paulus Schoutsen
parent f4e54719b9
commit 8c6e6e464e
3 changed files with 16 additions and 8 deletions

View File

@ -122,7 +122,7 @@ def setup(hass, config):
hass.states.set("tellstick_sensor.Outside_humidity", "54",
{
'friendly_name': 'Outside humidity',
'unit_of_measurement': '°C'
'unit_of_measurement': '%'
})
return True

View File

@ -65,6 +65,9 @@ def setup(hass, config):
if switch_type == 'wemo':
switch_init = get_wemo_switches
elif switch_type == 'tellstick':
switch_init = get_tellstick_switches
else:
logger.error("Unknown switch type specified: %s", switch_type)
@ -225,7 +228,7 @@ class TellstickSwitch(ToggleDevice):
return self.tellstick.name
# pylint: disable=unused-argument
def turn_on(self, dimming=None):
def turn_on(self, **kwargs):
""" Turns the switch on. """
self.tellstick.turn_on()
@ -235,6 +238,7 @@ class TellstickSwitch(ToggleDevice):
def is_on(self):
""" True if switch is on. """
try:
import tellcore.constants as tellcore_constants
except ImportError:

View File

@ -15,7 +15,8 @@ temperature_scale: The scale of the temperature value
temperature_scale=°C
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=12 # only show rain rate and rain total
@ -62,7 +63,7 @@ def setup(hass, config):
logger.error("No Tellstick sensors found")
return False
sensor_value_datatype_descriptions = {
sensor_value_descriptions = {
tellcore_constants.TELLSTICK_TEMPERATURE:
DatatypeDescription('temperature',
config[DOMAIN]['temperature_scale']),
@ -81,10 +82,11 @@ def setup(hass, config):
}
def update_sensor_value_state(sensor_name, sensor_value):
sensor_value_datatype_description = \
sensor_value_datatype_descriptions[sensor_value.datatype]
"Update the state of a sensor value"
sensor_value_description = \
sensor_value_descriptions[sensor_value.datatype]
sensor_value_name = '{} {}'.format(
sensor_name, sensor_value_datatype_description.name)
sensor_name, sensor_value_description.name)
entity_id = ENTITY_ID_FORMAT.format(
util.slugify(sensor_value_name))
@ -94,7 +96,7 @@ def setup(hass, config):
state_attr = {
ATTR_FRIENDLY_NAME: sensor_value_name,
ATTR_UNIT_OF_MEASUREMENT:
sensor_value_datatype_description.unit
sensor_value_description.unit
}
hass.states.set(entity_id, state, state_attr)
@ -110,6 +112,7 @@ def setup(hass, config):
]
def update_sensor_state(sensor):
"Updates all the sensor values from the sensor"
try:
sensor_name = config[DOMAIN][str(sensor.id)]
except KeyError:
@ -124,6 +127,7 @@ def setup(hass, config):
# pylint: disable=unused-argument
def update_sensors_state(time):
"Update the state of all sensors"
for sensor in sensors:
update_sensor_state(sensor)