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如何向类添加适用于该类中所有对象的单个@XmlAttribute注释   java未处理的继续记录跟踪类org。阿帕奇。波伊。hssf。记录塔比德雷科德   Eclipse中java代码的rest连接超时,而不是浏览器的rest连接超时   数组我的Java插入排序逻辑有什么问题?   java使用Http客户端进行请求,该请求返回内容类型为“application/vnd.msexcel”的jsp页面   java连接到数据库(Derby)   url编码如何使用java发布而不使用url编码url的查询部分   正则表达式使用Java替换字符串中的模式   Java中声明数组的区别   java hibernate ReferenceColumnNames未映射到单个属性   java如何对地图集合的分层键进行排序?   java ValueAnimator在我的手机上似乎工作不正常   java如何使用Hibernate Lucene搜索访问实体中外键的排序字段名?   在同一台机器上以不同的JAVA路径运行两个Tomcat   java如何在Eclipse中记录最新的git提交哈希?   java为什么我必须将JRE、编译器和facet全部降级为Java1。8在Eclipse中创建简单Web服务时   无法将java DataBufferInt解析为类型