Skip to content

Commit

Permalink
pylint and PEP8 errors
Browse files Browse the repository at this point in the history
Gyran authored and balloob committed Nov 12, 2014
1 parent f4e5471 commit 8c6e6e4
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion homeassistant/components/demo.py
Original file line number Diff line number Diff line change
@@ -122,7 +122,7 @@ def mock_turn_off(service):
hass.states.set("tellstick_sensor.Outside_humidity", "54",
{
'friendly_name': 'Outside humidity',
'unit_of_measurement': '°C'
'unit_of_measurement': '%'
})

return True
6 changes: 5 additions & 1 deletion homeassistant/components/switch.py
Original file line number Diff line number Diff line change
@@ -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 @@ def get_name(self):
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 @@ def turn_off(self):

def is_on(self):
""" True if switch is on. """

try:
import tellcore.constants as tellcore_constants
except ImportError:
16 changes: 10 additions & 6 deletions homeassistant/components/tellstick_sensor.py
Original file line number Diff line number Diff line change
@@ -15,7 +15,8 @@
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 update_sensor_value_state(sensor_name, sensor_value):
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 update_sensor_value_state(sensor_name, sensor_value):
]

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 update_sensor_state(sensor):

# pylint: disable=unused-argument
def update_sensors_state(time):
"Update the state of all sensors"
for sensor in sensors:
update_sensor_state(sensor)

0 comments on commit 8c6e6e4

Please sign in to comment.