diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 00000000..6852ae3a --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,21 @@ +# MIT License + +Copyright (c) 2016 David McNett + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/insteonplm/devices/climateControl.py b/insteonplm/devices/climateControl.py index a06fe691..de35c055 100644 --- a/insteonplm/devices/climateControl.py +++ b/insteonplm/devices/climateControl.py @@ -16,8 +16,8 @@ _LOGGER = logging.getLogger(__name__) -class ClimateControl_2441th(Device): - """Thermostat model 2441TH.""" +class ClimateControl_Base(Device): + """Thermostat model.""" def __init__(self, plm, address, cat, subcat, product_key=None, description=None, model=None): @@ -25,6 +25,8 @@ def __init__(self, plm, address, cat, subcat, product_key=None, Device.__init__(self, plm, address, cat, subcat, product_key, description, model) + _LOGGER.debug("Created instance of Insteon Climate Controller") + self._stateList[0x01] = CoolSetPoint( self._address, "coolSetPoint", 0x01, self._send_msg, self._message_callbacks, 0x00) @@ -100,3 +102,25 @@ def async_refresh_state(self): # pylint: disable=unused-argument def _mode_changed(self, addr, group, val): self.async_refresh_state() + + +class ClimateControl_2441th(ClimateControl_Base): + """TH2441TH thermostat model.""" + + def __init__(self, plm, address, cat, subcat, product_key=None, + description=None, model=None): + """Constructor, delegates most work to the base thermostat class.""" + _LOGGER.debug("Created instance of 2441TH controller") + ClimateControl_Base.__init__(self, plm, address, cat, subcat, + product_key, description, model) + + +class ClimateControl_2441v(ClimateControl_Base): + """TH2441V thermostat adapter model.""" + + def __init__(self, plm, address, cat, subcat, product_key=None, + description=None, model=None): + """Constructor, delegates most work to the base thermostat class.""" + _LOGGER.debug("Created instance of 2441V controller") + ClimateControl_Base.__init__(self, plm, address, cat, subcat, + product_key, description, model) diff --git a/insteonplm/devices/ipdb.py b/insteonplm/devices/ipdb.py index 4687fded..3885fb0e 100644 --- a/insteonplm/devices/ipdb.py +++ b/insteonplm/devices/ipdb.py @@ -15,7 +15,7 @@ SwitchedLightingControl_2334_222_6, SwitchedLightingControl_2334_222_8, SwitchedLightingControl_2663_222) -from insteonplm.devices.climateControl import ClimateControl_2441th +from insteonplm.devices.climateControl import (ClimateControl_2441th, ClimateControl_2441v) from insteonplm.devices.securityHealthSafety import (SecurityHealthSafety, SecurityHealthSafety_2421, SecurityHealthSafety_2842_222, @@ -248,7 +248,7 @@ class IPDB(): Product(0x05, 0x00, None, 'Broan SMSC080 Exhaust Fan', '', None), Product(0x05, 0x01, 0x000002, 'EZTherm', '', None), Product(0x05, 0x02, None, 'Broan SMSC110 Exhaust Fan', '', None), - Product(0x05, 0x03, 0x00001F, 'Thermostat Adapter', '2441V', None), + Product(0x05, 0x03, None, 'Thermostat Adapter', '2441V', ClimateControl_2441v), Product(0x05, 0x04, 0x000024, 'EZTherm', '', None), Product(0x05, 0x05, 0x000038, 'Broan, Venmar, BEST Rangehoods', '', None), Product(0x05, 0x07, None, 'Wireless Thermostat', '2441ZTH', ClimateControl_2441th), diff --git a/insteonplm/plm.py b/insteonplm/plm.py index c2ee55aa..dba2014b 100644 --- a/insteonplm/plm.py +++ b/insteonplm/plm.py @@ -649,7 +649,8 @@ def _get_device_info(self): self.devices.add_device_callback(self._new_device_added) for addr in self._aldb_devices: - _LOGGER.debug('Getting device info for %s', Address(addr).human) + _LOGGER.debug('Queueing send request for device info for %s', + Address(addr).human) self._aldb_devices[addr].id_request() _LOGGER.debug('Ending _get_device_info') diff --git a/insteonplm/states/thermostat.py b/insteonplm/states/thermostat.py index caed75f1..a1ec57f3 100644 --- a/insteonplm/states/thermostat.py +++ b/insteonplm/states/thermostat.py @@ -43,11 +43,12 @@ def __init__(self, address, statename, group, send_message_method, send_message_method, message_callbacks, defaultvalue) - self._update_method = self._send_status_request + self._updatemethod = self._send_status_request self._register_messages() def _send_status_request(self): + _LOGGER.debug("Sending status request") msg = StandardSend( address=self._address, commandtuple=COMMAND_THERMOSTAT_GET_ZONE_INFORMATION_0X6A_NONE, @@ -55,9 +56,11 @@ def _send_status_request(self): self._send_method(msg, self._status_received) def _status_received(self, msg): + _LOGGER.debug("Received temperature status update") self._update_subscribers(msg.cmd2 / 2) def _temp_received(self, msg): + _LOGGER.debug("Received temperature value update") self._update_subscribers(msg.cmd2 / 2) def _register_messages(self): @@ -90,7 +93,7 @@ def __init__(self, address, statename, group, send_message_method, address, statename, group, send_message_method, message_callbacks, defaultvalue) - self._update_method = self._send_status_request + self._updatemethod = self._send_status_request self._register_messages() @@ -102,9 +105,11 @@ def _send_status_request(self): self._send_method(msg, self._status_received) def _status_received(self, msg): + _LOGGER.debug("Received humidity status") self._update_subscribers(msg.cmd2) def _humidity_received(self, msg): + _LOGGER.debug("Received humidity value") self._update_subscribers(msg.cmd2) def _register_messages(self): @@ -136,7 +141,7 @@ def __init__(self, address, statename, group, send_message_method, address, statename, group, send_message_method, message_callbacks, defaultvalue) - self._update_method = self._send_status_request + self._updatemethod = self._send_status_request self._register_messages() @@ -188,9 +193,11 @@ def _send_status_request(self): self._send_method(msg, self._status_received) def _status_received(self, msg): + _LOGGER.info("mode standard status received") self._update_subscribers(ThermostatMode(msg.cmd2)) def _ext_status_received(self, msg): + _LOGGER.info("mode extended status received") sysmode = msg.userdata['d6'] ext_mode = sysmode >> 4 if ext_mode == 0: @@ -253,7 +260,7 @@ def __init__(self, address, statename, group, send_message_method, address, statename, group, send_message_method, message_callbacks, defaultvalue) - self._update_method = self._send_status_request + self._updatemethod = self._send_status_request self._register_messages() @@ -300,9 +307,11 @@ def _send_status_request(self): self._send_method(msg, self._status_received) def _status_received(self, msg): + _LOGGER.debug("Fan standard status message received") self._update_subscribers(ThermostatMode(msg.cmd2)) def _ext_status_received(self, msg): + _LOGGER.debug("Fan extended status message received") sysmode = msg.userdata['d6'] ext_mode = sysmode & 0x0f if ext_mode == 0: @@ -356,7 +365,7 @@ def __init__(self, address, statename, group, send_message_method, address, statename, group, send_message_method, message_callbacks, defaultvalue) - self._update_method = self._send_status_request + self._updatemethod = self._send_status_request self._register_messages() @@ -371,6 +380,7 @@ def set(self, val): self._send_method(msg, self._set_cool_point_ack) def _set_cool_point_ack(self, msg): + _LOGGER.debug("Cooling setpoint standard received") self._update_subscribers(msg.cmd2 / 2) def _send_status_request(self): @@ -381,6 +391,7 @@ def _send_status_request(self): self._send_method(msg, self._status_message_received) def _status_message_received(self, msg): + _LOGGER.debug("Cooling standard status received") self._update_subscribers(msg.cmd2 / 2) def _register_messages(self): @@ -398,6 +409,7 @@ def _register_messages(self): self._ext_status_received) def _ext_status_received(self, msg): + _LOGGER.debug("Cooling extended status received") cool_sp = msg.userdata['d7'] / 2 self._update_subscribers(cool_sp) @@ -412,7 +424,7 @@ def __init__(self, address, statename, group, send_message_method, address, statename, group, send_message_method, message_callbacks, defaultvalue) - self._update_method = self._send_status_request + self._updatemethod = self._send_status_request self._register_messages() @@ -437,6 +449,7 @@ def _send_status_request(self): self._send_method(msg, self._status_message_received) def _status_message_received(self, msg): + _LOGGER.debug("Heating standard status received") self._update_subscribers(msg.cmd2 / 2) def _register_messages(self): @@ -457,5 +470,6 @@ def _register_messages(self): self._ext_status_received) def _ext_status_received(self, msg): + _LOGGER.debug("Heating extended status received") heat_sp = msg.userdata['d12'] / 2 self._update_subscribers(heat_sp)