'********************************************************************************'
'*               Insteon Thermostat Plug-in for HomeSeer                        *'
'*                                                                              *'
'* Copyright  2014-2018 Kazteel, LLC                                           *'
'* Written by Nathan Robertson                                                  *'
'* All rights reserved.                                                         *'
'*                                                                              *'
'* Redistribution and use in source and binary forms, with or without           *'
'* modification is not permitted without the authors express written            *'
'* consent.                                                                     *'
'*                                                                              *'
'* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND       *'
'* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE        *'
'* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE   *'
'* ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE      *'
'* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL   *'
'* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS      *'
'* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)        *'
'* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT   *'
'* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY    *'
'* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF       *'
'* SUCH DAMAGE.                                                                 *'
'********************************************************************************'


Version 3.0.7.0 (6/6/2018)
Adding new special triggers (e.g. trigger when temp goes up/down)


Version 3.0.6.3 (4/11/2017)
Added symbols to the virtual device for temps and humidity.  New installs will add these by default now.  
Existing installs can update devices manually or can delete the devices and stop/start plugin to recreate them 
with the symbols but be aware deleting devices will affect events that reference those existing devices.


Version 3.0.6.2 (3/4/2017)
Fixed bug with thermostat mode device that could lose the Control Use settings.  This can impact the Amazon Echo API usage if not set correctly


Version 3.0.6.1 (3/2/2017)
Updated example scripts.  Linux / mono require New Object() in front of the array of parameters to successfully work
Updated the HSPI_INSTEON_THERMOSTAT.exe.config to address a case sensitivity issue in finding the SQLite dll


Version 3.0.6.0 (2/3/2017)
Added separate range for External Temps and option to limit device temp (and ext temp) updates to values within the bounded ranges.


Version 3.0.5.5 (9/3/2016)
New single page layout for the Control/Status webpage and Config options to hide portions of that page (HVAC, header rows etc.)


Version 3.0.5.3 (4/14/2016)
Improvements to better support voice control via Amazon Echo


Version 3.0.4.5 (3/24/2016)
Store DEVCAT in INI once known so rerequest at startup is not needed.  Config option to use or not use saved copy per thermostat.


Version 3.0.4.4 (12/10/2015)
Minor updates with register/unregister thermostats with Mark's plugin


Version 3.0.4.3 (12/10/2015)
Fixed bug introduced in 3.0.41 related to the support for copying actions/triggers


Version 3.0.4.2 (12/6/2015)
Added DEVCAT values for some wired Smarthome 2441TH thermostats including the heat-pump model 2732-242 (DEVCAT=0513) and the EU (050F) and AU/NZ (0510)
These models will use the same support as the current US wired 2441TH with DEVCAT 050B


Version 3.0.4.1 (11/24/2015)
Fixed issue with retaining set values when copying plugin actions/triggers 
Fixed poll bug with humidity devices
Added poll button to root device for each thermostat to make polling a single thermostat from the devices home page easier
Added additional protection during Init processes
Added override when Program is activated to force it to send the program settings (mode/fan/heatSP/coolSP) even if it would appear to be what is already set.


Version 3.0.3.6 (11/05/2015)
Added additional protection during Init processes


Version 3.0.3.5 (11/04/2015)
Added ability to turn off Humidity and Temp updates without turning off all INFO Logs


Version 3.0.3.4 (9/17/2015)
Fixed issue with unquoted SQLite table names


Version 3.0.3.3 (9/14/2015)

Added startup timer to check all thermostats 2 minutes after startup to make sure they have the required DEVCAT information.  If not, re-request protocol information to fix this.
Revised startup process to fatally error out if there are duplicate Thermostat or HVAC names encountered.  Solution is to edit the HS3/Config/hspi_insteon_thermostat.ini to remove one of the duplicates.


Version 3.0.3.2 (9/13/2015)

Added Log INFO checkbox to config page so it can be turned off (reduce logging)
Updated Raw Insteon dump to Log Always so that DEBUG can be turned off but logging raw messages will still work
Revised SQLite table format for data capture.  Delete HS3\Data\InsteonThermostat.db3 and restart plugin if SQLite errors happen.
Added protection when adding Thermostats and HVACs to prevent name collisions


Version 3.0.3.1 (8/17/2015)

Improved SetPoint change logging to support issue research


Version 3.0.3.0 (6/19/2015)

Added SQLite as initial step for data collection - experimental


Version 3.0.2.2 (6/14/2015)

Venstar with 2441V or integrated Insteon adaptors can stop sending humidity after a factory reset of the Insteon adaptor.  Added support in the WRITE LINKS option to detect Venstar and set the correct Operational Flags to send or not send humidity based on whether the HasHumidistat flag is set on the config page.


Version 3.0.2.1 (6/13/2015)

Initial testing under Linux


Version 3.0.2.0 (6/06/2015)

Compiled against HS3 3.0.0.181.  
This is a debug version to investigate some users thermostat configs seemign to lose their DEVCAT.
Also addresses incorrect external temp sensor reading when it should show negative (not 248 for example)


Version 3.0.1.1 (1/09/2015)

Added   UNSUPPORTED   script options to send arbitrary Insteon commands to thermostats by name


Version 3.0.1.0 (1/09/2015)

Added counter to thermostats to calculate the minutes on/off and add to log.  This is separate from the HVAC counters which can span multiple thermostats connected to a single HVAC unit.
Update documentation install


Version 3.0.0.9 (6/13/2014)

Fixed bug with interpretation of Smarthome Wireless 2441ZTH flags byte.
Specifically this affected Fahrenheit vs Celsius when changed on this thermostat type.


Version 3.0.0.8 (5/30/2014)

Revised HVAC counter handling
Added HS device config page specific to plugin to review PED data

Fixed bug with SetProgram for COOL SetPoints


Version 3.0.0.7 (4/4/2014)

Updated Change Heat SetPoint and Change Cool SetPoint actions to add +/- adjustments as an alternative to setting a specific value.

Added two new script API calls AdjustHeatSetpoint and AdjustCoolSetpoint.  See examples in InsteonThermostat_script_api.vb

Updated Change Mode action to include a next/previous option


Version 3.0.0.6 (3/30/2014)

Fixed bug with programs that was introduced in the last versions device type changes

Minor updates to Venstar 2491T1E, 2441V etc. support 
  * Prog-cool wasn't accessible
  * Fixed "unexpected" response when switching to prog-heat, prog-cool

  
Version 3.0.0.5 (3/29/2014)

Updated some device types to better support the Thermostat API for HSTouch integration


Version 3.0.0.4 (3/28/2014)

Fixed updater issue


Version 3.0.0.3 (3/26/2014)

Fixed problem with web_status if thermostat does not have humidity
Added ability to force Insteon Protocol = 2.  Some thermostats/adapters may report protocol=1 when it may need to be 2


Version 3.0.0.2 (3/22/2014)

Added support for custom plugin trigger and actions


Version 3.0.0.1 (3/21/2014)

Updated temp, ext.temp, humidity, cool setpoint and heat setpoint devices to be ranges not "extra data"


Version 3.0.0.0 (3/17/2014)

Alpha release