Openhab规则问题
Openhab rules issue
我想知道是否有人可以帮助弄清楚为什么我的 openhab 规则在播放电影时无法识别我的 xbmc 播放器的状态变化。
openhab 服务器正确识别状态变化
但是我的规则没有触发:
rules:
val Functions$Function1 dimLiving = [ int dimlevel |
//var boolean scene = (Scene_Living.state == 11);
// Only dim lights when a certain scene is selected
//if(scene) {
// sendCommand(Lamp_Living_Small, dimlevel)
//s sendCommand(Lamp_Living_Floor, dimlevel)
sendCommand(Lounge_Light_Dimm, dimlevel)
// }
]
rule "Lights on when paused"
when
Item htpc_state changed from Play to Pause
then
brightnessBeforePause = Lounge_Light_Dimm.state as DecimalType
if ( brightnessBeforePause < 50){
logInfo("Light", "Play to pause 2")
dimLiving.apply(50)
}
end
rule "Lights off when pause end"
when
Item htpc_state changed from Pause to Play
then
if (Lounge_Light_Dimm.state == 50){
logInfo("Light", "Pause to play 1")
dimLiving.apply(brightnessBeforePause)
}
end
我想在电影开始播放时调暗飞利浦 hue 灯。
在 openhab.cfg
中一切配置正常
你定义了brightnessBeforePause
吗?第一行(在导入之后,一定要包括那些)应该是
var Number brightnessBeforePause
Lounge_Light_Dimm
设置的是什么?如果是 Undefined
或 Uninitialized
,则这两个规则都不起作用。在测试这些规则之前,尝试将 lamp 设置为特定的暗淡级别。
我想知道是否有人可以帮助弄清楚为什么我的 openhab 规则在播放电影时无法识别我的 xbmc 播放器的状态变化。
openhab 服务器正确识别状态变化
但是我的规则没有触发:
rules:
val Functions$Function1 dimLiving = [ int dimlevel |
//var boolean scene = (Scene_Living.state == 11);
// Only dim lights when a certain scene is selected
//if(scene) {
// sendCommand(Lamp_Living_Small, dimlevel)
//s sendCommand(Lamp_Living_Floor, dimlevel)
sendCommand(Lounge_Light_Dimm, dimlevel)
// }
]
rule "Lights on when paused"
when
Item htpc_state changed from Play to Pause
then
brightnessBeforePause = Lounge_Light_Dimm.state as DecimalType
if ( brightnessBeforePause < 50){
logInfo("Light", "Play to pause 2")
dimLiving.apply(50)
}
end
rule "Lights off when pause end"
when
Item htpc_state changed from Pause to Play
then
if (Lounge_Light_Dimm.state == 50){
logInfo("Light", "Pause to play 1")
dimLiving.apply(brightnessBeforePause)
}
end
我想在电影开始播放时调暗飞利浦 hue 灯。
在 openhab.cfg
中一切配置正常你定义了brightnessBeforePause
吗?第一行(在导入之后,一定要包括那些)应该是
var Number brightnessBeforePause
Lounge_Light_Dimm
设置的是什么?如果是 Undefined
或 Uninitialized
,则这两个规则都不起作用。在测试这些规则之前,尝试将 lamp 设置为特定的暗淡级别。