pi dom是用rpi和生成domotic的模块。使用'从'发出',可以在同查康54795通信。
pidom的Python项目详细描述
目的
该项目的目标是创建一个库,可以轻松地与使用HomeEasy协议的Chacon54795通信。我用树莓pi 1型b+测试我的库。
frompidomimportPiDompidom=PiDom()pidom.synchronize('tv')# 'tv' is offpidom.switch_on('tv')# 'tv' is on (obvious)pidom.toggle('tv')# 'tv' is offpidom.synchronize('light')# add new devicepidom.new_group('living-room',['tv','light'])# switch off 'tv' & 'light'pidom.toggle('living-room')# switch on 'tv' & 'light'pidom.backup()# save device and group with pickle in '~/.pidom.bin'# Use some eventfrompidomimportevent@event('pidom.update')defprint_data(ev,data):print("{} change state for : {}".format(data['name'],data['state']))pidom.toggle('living-room')# print this :# light change state for : False# tv change state for : False
test_pidom.py中的更多示例。
安装
依赖性
首先需要在raspberry pi上安装emit,emit使用wiringPi库。
安装wiringpi库:
cd /tmp git clone git://git.drogon.net/wiringPi cd wiringPi sudo ./build
安装emit命令:
cd /tmp git clone https://github.com/landru29/chacon-rpi.git cd chacon-rpi make sudo make install
您可以使用emit -h
测试安装emit使用引脚11(GPIO 0)与发射机通信。
圆周率
使用pip是最简单的方法:
pip install pidom