我想用OpenHAB控制飞利浦Hue Lux彩灯。所以我想知道我应该做些什么,如果我错过了什么。
在pi@raspberrypi:/opt/openhab/configurations/rules $ sudo vi demo.rules
rule "Select scene"
when
Item scene received command
then
switch(receivedCommand) {
/*alles uit */
case 0 : {
sendCommand(Toggle_7, OFF);
sendCommand(Toggle_3, OFF);
sendCommand(Toggle_1, OFF);
sendCommand(Toggle_10, OFF);
sendCommand(Toggle_11, OFF);
sendCommand(Toggle_5, OFF);
sendCommand(Toggle_9, OFF);
}
/*sfeer */
case 1 : {
sendCommand(LWD_3, 90);
sendCommand(Color_7, "45.584415,86.033516,70.19608");
sendCommand(Color_1, "45.584415,86.033516,70.19608");
sendCommand(Color_10, "45.584415,86.033516,70.19608");
sendCommand(Color_11, "45.584415,86.033516,70.19608");
sendCommand(Color_5, "45.584415,86.033516,70.19608");
sendCommand(LWD_9,10);
}
/*Alles aan */
case 2 : {
sendCommand(Toggle_7, ON);
sendCommand(Toggle_3, ON);
sendCommand(Toggle_1, ON);
sendCommand(Toggle_10, ON);
sendCommand(Toggle_11, ON);
sendCommand(Toggle_5, ON);
sendCommand(LWD_9,100);
}
/*eten */
case 3 : {
sendCommand(Toggle_3, OFF);
sendCommand(Color_7, "42.391304,73.6,100.0");
sendCommand(Color_1, "42.391304,73.6,100.0");
sendCommand(Color_10, "42.391304,73.6,100.0");
sendCommand(Color_11, "60,42,100");
sendCommand(Color_5, "60,42,100");
sendCommand(LWD_9,10);
}
case 4 : {
/*nacht */
sendCommand(LWD_9, 50);
sendCommand(Color_7, "46.25,37.64706,100.0");
sendCommand(Color_10, "46.25,37.64706,100.0");
sendCommand(Toggle_1, OFF);
sendCommand(Toggle_3, OFF);
sendCommand(Toggle_11, OFF);
sendCommand(Toggle_5, OFF);
}
case 5 : {
/* Sunset */
sendCommand(Color_7, "42.391304,73.6,100.0");
sendCommand(Color_1, "42.391304,73.6,100.0");
sendCommand(Color_10, "42.391304,73.6,100.0");
sendCommand(Color_11, "42.391304,73.6,100.0");
sendCommand(Color_5, "42.391304,73.6,100.0");
sendCommand(Toggle_3, OFF);
sendCommand(LWD_9,10);
}
case 6 : {
/* Aqua */
sendCommand(Color_7, "230.82353,100.0,100.0");
sendCommand(Color_1, "230.82353,100.0,100.0");
sendCommand(Color_10, "230.82353,100.0,100.0");
sendCommand(Color_11, "230.82353,100.0,100.0");
sendCommand(Color_5, "230.82353,100.0,100.0");
sendCommand(Toggle_3, OFF);
sendCommand(LWD_9,10);
}
case 7 : {
/* Duo */
sendCommand(Color_7, "272,100.0,100.0");
sendCommand(Color_5, "272,100.0,100.0");
sendCommand(Color_1, "330,100.0,100.0");
sendCommand(Color_10, "330,100.0,100.0");
sendCommand(Color_11, "330,100.0,100.0");
sendCommand(Toggle_3, OFF);
sendCommand(LWD_9,10);
}
case 8 : {
/* Duo ambilight play */
sendCommand(Color_7, "272,100.0,30.0");
sendCommand(Color_5, "272,100.0,30.0");
sendCommand(Color_1, "330,100.0,30.0");
sendCommand(Color_10, "330,100.0,30.0");
sendCommand(Color_11, "330,100.0,30.0");
}
case 9 : {
/* Duo ambilight pauze*/
sendCommand(Color_7, "272,100.0,100.0");
sendCommand(Color_5, "272,100.0,100.0");
sendCommand(Color_1, "330,100.0,100.0");
sendCommand(Color_10, "330,100.0,100.0");
sendCommand(Color_11, "330,100.0,100.0");
}
}
end
pi@raspberrypi:/opt/openhab/configurations/items $ vi demo.items
中的
我有 :
/* Hue */
Switch Toggle_1 "left bulb" (Switching) {hue="1"}
Switch Toggle_2 "center bulb" (Switching) {hue="2"}
Switch Toggle_3 "right bulb" (Switching) {hue="3"}
Color Color_1 "left bulb" (Colorize) {hue="1"}
Color Color_2 "center bulb" (Colorize) {hue="2"}
Color Color_3 "right bulb" (Colorize) {hue="3"}
Dimmer Dimm_1 "left bulb" (WhiteDimmer) {hue="1;brightness;30"}
Dimmer Dimm_2 "center bulb" (WhiteDimmer) {hue="2;brightness;30"}
Dimmer Dimm_3 "right bulb" (WhiteDimmer) {hue="3;brightness;30"}
Dimmer CT_Dimm_1 "left bulb" (CTDimmer) {hue="1;colorTemperature;30"}
Dimmer CT_Dimm_2 "center bulb" (CTDimmer) {hue="2;colorTemperature;30"}
Dimmer CT_Dimm_3 "right bulb" (CTDimmer) {hue="3;colorTemperature;30"}
pi@raspberrypi:/opt/openhab/configurations $ vi openhab.cfg
中的:
我有:
############################### Philips Hue Binding ###################################
#
# IP address of Hue Bridge (optional, default is auto-discovery)
hue:ip=192.168.1.117
hue:secret=openHABRuntime
hue:refresh=10000
我使用sudo ./start.sh
运行它,然后将Hue中心与OpenHAB配对。我不是缺少的,因为我仍然无法通过OpenHAB控制Hue。
我的主要目标是将Web UI连接到openHAB中的代码。任何指针都非常感谢!此外,我已经从各种教程中缝合了上面的代码,所以它可能完全没有任何意义!
答案 0 :(得分:1)
使用* .sitemap文件更改UI的外观。 此文件定义UI中显示的方式和项目: https://github.com/openhab/openhab/wiki/Explanation-of-Sitemaps
至于其他示例: - 你确定顺化桥的ip和秘密吗? - 桥上连接了多少个灯泡?因为在* .items文件中,hue = 1表示连接到桥的第一个灯泡。