从树莓pi远程控制电源插座

energenie的Python项目详细描述


python模块控制用于远程打开和关闭电源插座的Raspberry Pi插件板。

安装

在Raspberry PI上,在PIP中安装Energenie模块。

Python3:

sudo apt-get install python3-pip
sudo pip-3.2 install energenie

Python2:

sudo apt-get install python-pip
sudo pip install energenie

用法

示例用法:

from energenie import switch_on, switch_off
from time import sleep

# turn all plug sockets on and off
switch_on()
switch_off()

# turn a plug socket on and off by number
switch_on(1)
switch_off(1)

switch_on(3)
switch_off(3)

# turn some plug sockets on, then turn them off after 10 seconds
switch_on(1)
switch_on(4)
sleep(10)
switch_off(1)
switch_off(4)

开源

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

推荐PyPI第三方库


热门话题
正则表达式Java使用关键字拆分字符串   Neo4j Java API模式索引范围查找?   java访问JButton[]   java如何混淆tomcat日志文件中的请求属性   apache运行CGI Java程序   java从一个Eclipse插件开始,我如何通过编程使Eclipse编辑某个文件?   从php中的SQL数据库到Java中的多个值作为单独的变量   java如何在多个osgi捆绑包之间共享资源   datetime Java time,无法从历元秒解析年份   java无法在安卓应用程序中使用morpho指纹扫描仪设备捕获指纹   java使用groovy/ratpack发送电子邮件   javascript在jsp页面中添加验证,但在控制台中仍然显示一些错误   java如何修复com。mysql。jdbc。DocsConnectionPropsHelper   java AlertDialog dispatchTouchEvent