带有Vaillant multiMATIC的Python接口
pymultiMATIC的Python项目详细描述
多发性
法律免责声明
本软件与Vaillant无关,开发者对您的Vaillant设备的功能或安全不承担任何法律责任。在
安装
[sudo] pip3 install pymultimatic
测试
可以使用运行测试
^{pr2}$用法
模块使用
项目分为两层:
1。A连接器
这是一个低级连接器,使用valilant API并直接从API返回原始数据(基本上,json
格式的响应)。连接器正在处理登录和会话。
连接器能够重用已经存在的会话(cookies)。文件系统中保存了两个文件(cookies和安装序列号)。默认位置为:
~/.pymultimatic
但它可以被重写。文件名为.cookies
和.serial
。在
下面是一个如何使用它的示例:
frompymultimatic.apiimportConnector,urlssession=...# aiohttp.ClientSessionconnector=Connector('user','pass',session)json=awaitconnector.get(urls.facilities_list())
要获取有关安装的一些信息,将返回原始响应,如下所示:
{"body":{"facilitiesList":[{"serialNumber":"1234567891234567891234567890","name":"Name","responsibleCountryCode":"BE","supportedBrand":"GREEN_BRAND_COMPATIBLE","capabilities":["ROOM_BY_ROOM","SYSTEMCONTROL_MULTIMATIC"],"networkInformation":{"macAddressEthernet":"12:34:56:78:9A:BC","macAddressWifiAccessPoint":"34:56:78:9A:BC:DE","macAddressWifiClient":"56:78:9A:BC:DE:F0"},"firmwareVersion":"1.1.1"}]},"meta":{}}
基本上,你可以使用
frompymultimatic.apiimportConnector,urlsconnector=Connector('user','pass')connector.request('get',urls.system(serial='123'))
包含来自pymultimatic.api.urls
的URL
如果您只想检索基本数据(室外温度、当前温度等),我建议使用此层
2。系统管理器
此层允许您以更友好的方式与系统交互,并为您计算一些数据。
底层的Connector
被隐藏,原始响应被映射到更有用的对象。在
下面是一个例子:
frompymultimatic.systemmanagerimportSystemManagerfrompymultimatic.modelimportOperatingModessession=...# aiohttp.ClientSession manager=SystemManager('user','pass',session)# get the complete systemsystem=awaitmanager.get_system()# set the hot water target temperature to 55awaitmanager.set_hot_water_setpoint_temperature('dhw_id',55)# set the zone operation mode to 'AUTO'awaitmanager.set_zone_heating_operating_mode('zone_id',OperatingModes.AUTO)
要操作的主要对象是pymultimatic.model.System
,它将有关系统的所有信息分组。在
如果你想做更复杂的事情,例如:如果你想得到目标温度 一个房间或一个区域,它可能变得有点复杂,因为你必须处理假日模式,快速模式,快速否决,时间计划等。 这一层隐藏了你的复杂性。在
文件
您可以找到更深入的文档here。在
托多
- 搬运通风
- 将一些构造函数(系统)移到**kwargs
- 项目
标签: