Package: venstarcolortouch
Python3 API for Venstar ColorTouch thermostatsTheVenstar ColorTouch thermostatis a WIFI thermostat with a REST api.  This is a simple Python3 API for talking to it.  TheAPI documentsare required reading.LimitationsThe API does not implement the Venstar discovery protocol.  It is assumed that you know the IP address or FQDN of your thermostat(s).Testing$pythonvenstarcolortouch192.168.1.252
TestingwithIP:192.168.1.252
Loginsuccessful.API:5Type:residential
Wasabletogetinfo:{u'spacetemp':67.0,u'schedulepart':255,u'dehum_setpoint':0,u'away':0,u'cooltempmax':99.0,u'cooltemp':78.0,u'tempunits':0,u'state':1,u'schedule':0,u'hum':0,u'heattemp':75.0,u'hum_setpoint':36,u'fan':0,u'hum_active':99,u'heattempmax':99.0,u'cooltempmin':35.0,u'name':u'DebtRidge',u'mode':1,u'heattempmin':35.0,u'availablemodes':0,u'fanstate':1,u'setpointdelta':2.0}NameisMyHouse
Fanis0Heatsetpointis75.0
Coolsetpointis78.0

Wasabletogetsensors:{u'sensors':[{u'hum':36,u'name':u'Thermostat',u'temp':67.0},{u'name':u'Outdoor',u'temp':0.0}]}Indoortempis67.0andhumidityis36Runtimes:{u'cool1':0,u'cool2':0,u'ts':1429574400,u'fc':0,u'heat2':0,u'heat1':0,u'aux2':0,u'aux1':0}Pathis:/control
set_controlSuccess!
Heatsetpointis60.0
Coolsetpointis90.0

Pathis:/control
set_controlSuccess!
Heatsetpointis75.0
Coolsetpointis78.0UsageclassVenstarColorTouch:def__init__(self,addr,timeout):Class instantiation requires an IP address or hostname with an optional timeout.ct=venstarcolortouch.VenstarColorTouch(a,timeout=5)ifct.login()isTrue:print("Login successful. API:{0}Type:{1}".format(ct._api_ver,ct._type))The login() function does not really log in, but it does confirm communication and that the API version is recent enough.APIAPI calls use the following constants:MODE_OFFMODE_HEATMODE_COOLMODE_AUTOSTATE_IDLESTATE_HEATINGSTATE_COOLINGSTATE_LOCKOUTSTATE_ERRORFAN_AUTOFAN_ONFANSTATE_OFFFANSTATE_ONTEMPUNITS_FTEMPUNITS_CSECURITY_OFFSECURITY_ONSCHED_FSCHED_CSCHEDPART_MORNINGSCHEDPART_DAYSCHEDPART_EVENINGSCHEDPART_NIGHTSCHEDPART_INACTIVEAWAY_HOMEAWAY_AWAYFunctionsThere areupdate_*functions which update local copies of various pieces of data.  Then there areget_*functions for retrieving that data and finallyset_*functions for changing writable settings.update_info()- Update the control state of the thermostat.Must be called at least once before any set_ functions.update_sensors()- Update the state of indoor and outdoor temperature sensors.get_runtimes()- Gather runtime data.get_info()- returns a dict of information.{u'spacetemp',
   u'schedulepart',
   u'dehum_setpoint',
   u'away',
   u'cooltempmax',
   u'cooltemp',
   u'tempunits',
   u'state',
   u'schedule',
   u'hum',
   u'heattemp',
   u'hum_setpoint',
   u'fan',
   u'hum_active',
   u'heattempmax',
   u'cooltempmin',
   u'name',
   u'mode',
   u'heattempmin',
   u'availablemodes',
   u'fanstate',
   u'setpointdelta'}get_info("heattemp")get_sensor(name, attr)Get a specific named sensor's value. In case of duplicate names, the first matching sensor will be returned.get_sensor("Outdoor","temp")get_sensor_list(type)Get a list of sensor names, optionally filtered by type. Type is one of "Control", "Local", "Outdoor", "Remote", "Return", or "Supply".get_sensor_list()get_sensor_list("Remote")get_thermostat_sensor(attr)Get a specific thermostat sensor's value.get_thermostat_sensor("temp")get_outdoor_sensor(attr)Get an outdoor sensor's value.get_outdoor_sensor("temp")```get_alerts()Get any alerts that are registered.set_setpoints(heattemp, cooltemp)Set heattemp/cooltemp.set_mode(mode)Set the thermostat mode.MODE_OFFMODE_HEATMODE_COOLMODE_AUTOset_fan(fan)Set the Fan mode.FAN_AUTOFAN_ONset_tempunits(tempunits)Set degrees to either Celsius or FahrenheitTEMPUNITS_FTEMPUNITS_Cset_away(away)Set either Home or Away schedule.AWAY_HOMEAWAY_AWAYset_schedule(schedule)Set Schedule On or Off.0 - off1 - onset_hum_setpoint(hum_setpoint)Set humidifier Setpointset_dehum_setpoint(dehum_setpoint)Set dehumidifier SetpointT2100 Specificset_security(security)Set the Security mode (whether or not setpoint limits are active).SECURITY_OFFSECURITY_ONset_setpoint_limits(sp_max, sp_min)Set the maximum and minimum setpoint limits.