fixed my own cleanup

This commit is contained in:
Tom Duijf 2015-12-16 22:36:40 +00:00
parent 687ce64551
commit 4eec89b35e

View File

@ -25,7 +25,7 @@ _LOGGER = logging.getLogger(__name__)
def setup_platform(hass, config, add_devices, discovery_info=None): def setup_platform(hass, config, add_devices, discovery_info=None):
""" Sets up the heatmiser thermostat. """ """ Sets up the heatmiser thermostat. """
from heatmiserV3 import connection as HMC from heatmiserV3 import heatmiser, connection
ipaddress = str(config[CONF_IPADDRESS]) ipaddress = str(config[CONF_IPADDRESS])
port = str(config[CONF_PORT]) port = str(config[CONF_PORT])
@ -35,7 +35,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
CONF_IPADDRESS, CONF_PORT) CONF_IPADDRESS, CONF_PORT)
return False return False
serport = HMC.connection(ipaddress, port) serport = connection.connection(ipaddress, port)
serport.open() serport.open()
tstats = [] tstats = []
@ -49,6 +49,7 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
for tstat in tstats: for tstat in tstats:
add_devices([ add_devices([
HeatmiserV3Thermostat( HeatmiserV3Thermostat(
heatmiser,
tstat.get("id"), tstat.get("id"),
tstat.get("name"), tstat.get("name"),
serport) serport)
@ -58,10 +59,10 @@ def setup_platform(hass, config, add_devices, discovery_info=None):
class HeatmiserV3Thermostat(ThermostatDevice): class HeatmiserV3Thermostat(ThermostatDevice):
""" Represents a HeatmiserV3 thermostat. """ """ Represents a HeatmiserV3 thermostat. """
from heatmiserV3 import heatmiser
def __init__(self, device, name, serport):
# pylint: disable=too-many-instance-attributes
def __init__(self, heatmiser, device, name, serport):
self.heatmiser = heatmiser
self.device = device self.device = device
self.serport = serport self.serport = serport
self._current_temperature = None self._current_temperature = None