domintell协议的python库
python-domintell的Python项目详细描述
python domintell:控制domintell家庭自动化系统的python库
创建此库是为了支持home assisstant中的domintell协议。它基于Thomas Delaet的python-velbus库。
它目前正由home assisstant中的domintell组件使用,但也可以独立使用。
库的最新版本是0.0.10,它作为python包发布在pypi
API文档尚不可用。
示例用法
该库目前只支持通过deth02 domintell模块的udp通信,可以很容易地修改为支持rs-232 intiarface(domintell light protocol)。为了使用这个库,您需要首先初始化控制器,然后在domintell上发送和接收消息。
importtimeimportloggingimportsysimportdomintellimportcredentialsimportos,sysdef_on_message(message):print('received message')print(message)logging.basicConfig(stream=sys.stdout,level=logging.INFO)# UDP, Serial (or USB over serial) connection to Domintell controllerhost='192.168.0.1:17481'controller=domintell.Controller(host)controller.subscribe(_on_message)logging.info('LOGIN')controller.login(credentials.host['SECRET'])time.sleep(10)logging.info('Starting scan')controller.scan(None)logging.info('Going to sleep')time.sleep(100)logging.info('Exiting ...')controller.stop()
安装
您可以使用pip(pip install python domintell)安装库,或者签出github存储库并在存储库的根目录下运行python setup.py install。
支持的模块
此库当前支持以下DominTell模块:
Module name | Description | Status | Comments | Using everyday? |
---|---|---|---|---|
DISM4 | Control of 4 inputs (buttons) | SUPPORTED | All messages are supported | Yes |
DISM8 | Control of 8 inputs (buttons) | SUPPORTED | All messages are supported | Yes |
DPBU01 | 1 button module | SUPPORTED | All messages are supported | No |
DPBU02 | 2 button module | SUPPORTED | All messages are supported | No |
DPBU04 | 4 button module | SUPPORTED | All messages are supported | Rarely |
DPBU06 | 6 button module | SUPPORTED | All messages are supported | No |
DBIR01 | 8 relay output module | SUPPORTED | All messages are supported | Yes |
DTRP01 | Output card for the control of up to 4 trip switches | SUPPORTED | All messages are supported | Yes |
DTRP02 | Output card for the control of 2 x 2 inverted trip switches | SUPPORTED | All messages are supported | No |
DDIM01 | Control module for up to 8 dimmers | SUPPORTED | All messages are supported | Yes |
DTEM01 | Temperature sensor module. Allows the connection of the temperature sensor | SUPPORTED | Only basic messages | Yes |
DTEM02 | Temperature sensor module. Allows the connection of the temperature sensor | SUPPORTED | Only basic messages | Yes |
DDIR01 | Infrared Sensor | NOT SUPPORTED | No plans to support | No |
DTSC0x | TFT back-lit color touchscreen | SUPPORTED | Only temperature messages are supported | Yes |
DMOV01 | Movement sensor | SUPPORTED | All messages are supported | Yes |
DLCD01 | LCD | NOT SUPPORTED | No | |
DTRV01 | 4 outputs control module. For the control of shutters, valves, motors, etc | SUPPORTED | All messages are supported | No |
DLED01 | 4 outputs led control module | SUPPORTED | All messages are supported | Yes |
DTRVBT01 | Single output card controlling motors, valves, shutters or Velux with low tension between 12 to 24Vdc | SUPPORTED | All messages are supported | No |
DAMPLI01 | 4 zones stereo audio amplifi er | NOT SUPPORTED | No plans to implement | No |
VAR | Variable | SUPPORTED | All messages are supported | No |
SYS | System variable | SUPPORTED | All messages are supported | No |
DOUT10V01 | 0 - 10Vdc output module | SUPPORTED | All messages are supported | No |
DLCD01 | LCD panel | NOT SUPPORTED | No | |
DFAN01 | Fan coil controller | NOT SUPPORTED | No | |
DMR01 | Output card with 5 x 250 V/3 A monopolar relays. | SUPPORTED | All messages are supported | Yes |
DIN10V01 | 0 - 10Vdc input module | NOT SUPPORTED | No |
添加对其他模块的支持
Domintell website包含不同可用模块及其协议文档的概述。为了增加对附加模块的支持,请阅读协议文档并添加对丢失消息的支持(许多消息在模块之间共享,以确保检查是否已经存在消息)
添加对附加模块支持的步骤:
- []在Domintell website中查找要包含的模块的协议文档。
- []浏览消息目录,在协议信息表中查找尚不受支持的消息。在messages文件夹中为每个不支持的消息创建一个新文件。每个新消息都应该继承自message对象并重用公共功能。
- []为每个新消息实现构造函数方法
- []为每个新消息实现populate和data~u binary方法
- []在messages文件夹中的init.py文件中添加新消息
- []测试和迭代
- []更新readme.md文件的受支持模块部分
- []在github上提交拉取请求
进一步开发
库目前仅提供最低级别的功能:向模块发送和接收消息:
- []将模块及其支持的功能建模为实体
- []仅允许向模块发送支持的消息
- [*]模块的自动发现
- []将Velbus控制器公开为外部API,以便在不同的使用者之间共享它