Hallo community,
I have, from my point of view, a non-deterministic behavior when it comes to the use of HUE components in rules. What is the problem? While using sendCommand I get sometimes “predict to become” … messages in the log.
What have I done? I configure my HUE devices with an .things file. The fiels below are just pieces from the entire files …
Bridge hue:bridge:1 "Hue Bridge" [ ipAddress="192.168.0.4", userName="my_password ;-)" ] {
0210 HueColorLight1 [ lightId = "1" ]
0210 HueColorLight2 [ lightId = "2" ]
0210 HueColorLight3 [ lightId = "3" ]
:
0302 HueTemperaturSens1 [ sensorId = "14" ]
0107 HueMotionSensor1 [ sensorId = "15" ]
0106 HueAmbienceLightSens1 [ sensorId = "16" ]
:
group Esstisch "Tischlicht" @ "EZ" [ groupId = "1" ]
group Flur_Lights "Flurlicht" @ "EG" [ groupId = "9" ]
group Inga_Decke "Deckenlicht" @ "IG" [ groupId = "22" ]
group WC_Decke "WC-Deckelicht" @ "WC" [ groupId = "14" ]
}
Than I have an correspondig .item file.
//****************************************************************************************
// hue: WC
Dimmer HueAmbianceLight9 <light> (WC_Lampe_Brightness) { channel="hue:0220:1:18:brightness" }
Dimmer HueAmbianceLight10 <light> (WC_Lampe_Brightness) { channel="hue:0220:1:19:brightness" }
Dimmer HueAmbianceLight9_coltemp <light> (WC_Lampe_ColorTemp) { channel="hue:0220:1:18:color_temperature" }
Dimmer HueAmbianceLight10_coltemp <light> (WC_Lampe_ColorTemp) { channel="hue:0220:1:19:color_temperature" }
Dimmer HueWCLight <light> (WC_Group_Brightness) { channel="hue:group:1:14:brightness" }
Dimmer HueWCLight_coltemp <light> (WC_Group_ColorTemp) { channel="hue:group:1:14:color_temperature" }
And finaly I’ve got some rule files e.g.
// -------------------------------------------------------------------------------------------------------------
var boolean LightOn = false // Light is on if OUTPUT_STATUS > 0
var boolean LightToggle = false // LightToggle = true, if OUTPUT_STATUS was 0 and than again > 0
var Timer WC_Auto_OFF_Timer = null
val int AutoOffTime = 1*30
// -------------------------------------------------------------------------------------------------------------
// Switch Light ON/OFF : Controlled by Modul 20, Relay 1
//
rule "WC_LightON"
when
Item HueSensMotion2 changed to ON or
Item LCN_WC_Relay_HUE_WC_Switch changed from ON or
Item LCN_WC_Relay_HUE_WC_Switch changed from OFF
then {
logWarn("WC-Rule","Triggered")
val currBrightness = HueAmbianceLight9.getStateAs(PercentType) as Number // get the brightness
if (WC_Auto_OFF_Timer === null || WC_Auto_OFF_Timer.hasTerminated() ) {
if (currBrightness == 0) {
sendCommand(HueWCLight, WC_WC_Brightness_Last)
logWarn("WC-Rule", "switched ON by either switch or BWM.")
}
logWarn("WC-Rule", currBrightness.toString) ; // currBrightness.toString)
logWarn("WC-Rule", "start Timer.")
WC_Auto_OFF_Timer = createTimer(now.plusSeconds(AutoOffTime), [|
sendCommand(HueWCLight, OFF)
WC_Auto_OFF_Timer = null
logWarn("WC-Rule", " switch light OFF, because timer has finished.")
])
} else {
logWarn("WC-Rule", "retrigger path.")
if (LCN_WC_Relay_HUE_WC_Switch == ON) {
WC_Auto_OFF_Timer.cancel
WC_Auto_OFF_Timer = null
logWarn("WC-Rule","OFF by switch.")
sendCommand(HueWCLight, OFF)
}
}
}
end
When the rules are running I cant access the hue-bulbs or groups, I still get logs like :
2020-11-22 13:44:15.195 [WARN ] [lipse.smarthome.model.script.WC-Rule] - switch light OFF, because timer has finished.
==> /var/log/openhab2/events.log <==
2020-11-22 13:44:15.193 [ome.event.ItemCommandEvent] - Item 'HueWCLight' received command OFF
2020-11-22 13:44:15.217 [nt.ItemStatePredictedEvent] - HueWCLight predicted to become NULL
So prediction menas, that there will be no real physical device. So the questions are:
a) is there a dependency between declaraion of devices thru files and within the paperUI?
b) by decalring a hue-item, I can use the bridge number (e.g. “1”) OR the pfysical number (a 24Bit address). What is the difference, because both have a different behaviour, and what is the right way?
c) can’t I get the state from an hue-group (e.g. HUEWCLight)?
Thanks for helping
Stef