Venstar Colortouch恒温器接口库API V5

venstarcolortouch的Python项目详细描述


Python3 API用于Venstar Colortouch恒温器

Venstar ColorTouch thermostat是带有rest api的wifi恒温器。这是一个简单的python3 api。必须读取API documents

限制

api没有实现venstar发现协议。假设您知道恒温器的ip地址或fqdn。

测试

$ python venstarcolortouch 192.168.1.252
Testing with IP: 192.168.1.252
Login successful. API: 5 Type: residential
Was able to get info:{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}
Name is MyHouse
Fan is 0
Heat setpoint is 75.0
Cool setpoint is 78.0

Was able to get sensors:{u'sensors': [{u'hum': 36, u'name': u'Thermostat', u'temp': 67.0}, {u'name': u'Outdoor', u'temp': 0.0}]}
Indoor temp is 67.0 and humidity is 36
Runtimes: {u'cool1': 0, u'cool2': 0, u'ts': 1429574400, u'fc': 0, u'heat2': 0, u'heat1': 0, u'aux2': 0, u'aux1': 0}
Path is: /control
set_control Success!
Heat setpoint is 60.0
Cool setpoint is 90.0

Path is: /control
set_control Success!
Heat setpoint is 75.0
Cool setpoint is 78.0

用法

classVenstarColorTouch:def__init__(self,addr,timeout):

类实例化需要具有可选超时的IP地址或主机名。

ct=venstarcolortouch.VenstarColorTouch(a,timeout=5)ifct.login()isTrue:print("Login successful. API: {0} Type: {1}".format(ct._api_ver,ct._type))

log in()函数没有真正登录,但它确实确认了通信,并且api版本足够新。

API

api调用使用以下常量:

MODE_OFFMODE_HEATMODE_COOLMODE_AUTOSTATE_IDLESTATE_HEATINGSTATE_COOLINGSTATE_LOCKOUTSTATE_ERRORFAN_AUTOFAN_ONFANSTATE_OFFFANSTATE_ONTEMPUNITS_FTEMPUNITS_CSCHED_FSCHED_CSCHEDPART_MORNINGSCHEDPART_DAYSCHEDPART_EVENINGSCHEDPART_NIGHTSCHEDPART_INACTIVEAWAY_HOMEAWAY_AWAY

功能

update_*函数可以更新各种数据的本地副本。然后是用于检索数据的get_*函数,最后是用于更改可写设置的set_*函数。

  • update_sensors()-更新室内和室外温度传感器的状态。

  • get_runtimes()-收集运行时数据。

  • get_info()-返回一条信息指令。

      {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_thermostat_sensor(attr)获取特定恒温器传感器的值。

    get_thermostat_sensor("temp")
  • get_outdoor_sensor(attr)获取室外传感器的值。

    get_outdoor_sensor("temp")```
  • get_alerts()获取任何已注册的警报。

  • set_setpoints(heattemp, cooltemp)设置加热温度/冷却温度。

  • set_mode(mode)设置恒温器模式。

    • 关闭模式
    • 加热模式
    • 模式“酷”
    • 自动模式
  • set_fan(fan)设置风扇模式。

    • 风扇自动
    • 风扇打开
  • set_tempunits(tempunits)将摄氏度或华氏度设置为

    • 温度单位
    • 温度单位
  • set_away(away)设置主客场时间表。

    • 客场
    • 客场
  • set_schedule(schedule)打开或关闭计划。

    • 0-关
    • 1-开
  • set_hum_setpoint(hum_setpoint)设置加湿器设定值

  • set_dehum_setpoint(dehum_setpoint)设置除湿器设定值

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
基于Java的遗传算法确定最优交易行为   java改型2.0无法解析Json嵌套对象   java在数组中查找最大额定值(数字),我们不能跳过数组中的一个或多个连续数字   java在spring boot中从命令行设置活动概要文件和配置位置   JavaAxis2:传输错误:404错误:未找到帮助理解其真正含义   java使用Play2WAR和Play2.2.1   java理解函数运算符:Lambda   在代理java后面读取https网页数据   java应用程序。Android单元测试中的类mock   java为什么onClick布局XML引用的方法需要是公共的?   从SMTLIB2文件解析的java显示声明   java重写给定的类以使用组合而不是继承   HTMLUnit和Java:NoSuchMethodException:createDefaultSSLContext()   java如何使用Spring和ThymeLeaf从前端正确更新后端中的对象?   来自init()Java的方法调用   使用cellrendering从数据库向JTable动态添加数据后,java无法使用JTable执行排序操作   java Android Studio 1.5.1。渲染错误(浮动操作按钮)   web服务如何使用UsenameToken和PasswordDigest为JAVA中的SOAP客户端附加wsse安全头   java为什么要在局部变量和myApplicationClass中同时删除“ArrayList.remove”?