openhab的学习

一、openHAB安装

1.先安装jdk并配置环境变量
2.安装openhab运行环境
下载openhab安装包
http://www.openhab.org/downloads.html
openhab Runtime 就是openhab运行环境
解压distribution-<version>-runtime.zip并把它放在你想放的地方,这跟放在哪没有关系
添加你需要绑定的软件包(这些bindings是使用java做的各种通信协议的支持),默认延时环境不需要这个

在openhabconfigurations里面把openhab_default.cfg改为openhab.cfg(系统默认识别这个)注意:openHAB Designer默认cfg文件名为openhab_default.cfg,此问题由@ZealSK在openHAB Designer 使用心得http://discuz.ntballoon.com/forum.php?mod=viewthread&tid=65&fromuid=1
(出处: 开源智能家居论坛|智能家居DIY|openhab论坛|openremote)
3.添加演示sitemap
为了方便可以直接把distribution-1.6.1-demo-configuration文件夹里面的所有文件都拷贝在openhab的runtime的configuration里面。
4.点击start.bat即可启动openhab

clipboard.png

使用浏览器访问
http://localhost:8080/openhab.app?sitemap=demo
即可实现访问。

clipboard.png

5.实现手机客户端的访问
获取服务器ip地址,开始---cmd---ipconfig

clipboard.png

手机在豌豆荚下载openhab.jpk文件直接安装
打开手机客户端设置Settings,记得要勾掉demo mode
地址格式为:http://xxx.xxx.xxx.xxx:8080
clipboard.png

clipboard.png

二、openhab安装拖拽式后台管理系统habmin

安装过开源openhab系统之后我们来搞一下这个系统该如何使用,以前是通过直接修改sitemap、itemaps、rule文件来实现DIY智能家居,现在有了habmin软件,我们可以直接在openhab后台进行拖拽操作。
1.habmin下载
https://github.com/cdjackson/HABmin
https://github.com/cdjackson/HABmin2
将habmin-master文件夹更名为habmin,然后整体拷贝在webapps文件夹里面
将webappshabminaddons文件夹下面的jar文件拷贝到openhab的addons文件夹里面
访问http://localhost:8080/habmin
habmin管理界面如下:
图片描述

三、openHAB出发事件向个人邮箱发送邮件

1.先配置openhab的配置文件,/../openhab/configurations/openhab.cfg
clipboard.png
2.然后再规则里面定义,这里面我选择一盏灯

rule "Light_GF_Kitchen_Table"
/*    when
        Item Light_GF_Kitchen_Table received command
    then
        
        if(receivedCommand==ON){
            sendCommand(SerialCon,"Light_GF_Kitchen_Table : "+"ON")
        } else if(receivedCommand==OFF){
            sendCommand(SerialCon,"Light_GF_Kitchen_Table :"+"OFF")
        }*/
            
        when
            Item Light_GF_Kitchen_Table changed
        then
            //sendSms("wulangaowa@gmail.com","your text here")
            sendMail("wulanelva@sina.com","Light_GF_Kitchen_Table Changed","Hello Light_GF_Kitchen_Table status Changed")
end

3.我的habmin界面如下

clipboard.png

4.回到我们的控制界面
我选择的是GF下面Kitchen的Table灯,当我改变它的状态
clipboard.png
我发现自己的邮箱收到邮件!!成功!

![图片上传中...]

其中如果有不成功情况可以去设置一下邮箱

clipboard.png

clipboard.png

clipboard.png


存在问题

my.openhab云端连不上,总是offline

clipboard.png

http://bbs.open-smart.cn/forum.php?mod=viewthread&tid=48

其他参考资料:
http://bbs.open-smart.cn/forum.php?mod=viewthread&tid=63
https://github.com/cdjackson/HABmin
http://bbs.open-smart.cn/forum.php?mod=viewthread&tid=103
1:
http://bbs.open-smart.cn/forum.php?mod=viewthread&tid=23
总:
http://bbs.open-smart.cn/home.php?mod=space&uid=1&do=thread&view=me&type=reply&order=dateline&from=space&page=1

http://www.freebuf.com/geek/78462.html
http://bbs.open-smart.cn/forum.php?mod=viewthread&tid=48

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值