Hi,
I’m stuck and going crazy
the first rule below is not working, the second is
??? Not working
rule "bedlamp aan uit"
when
Channel "mihome:86sw2:158d0001641c68:ch1" triggered
then
if (E2Lbedlamp_dimmer_colortemp.state == OFF) {E2Lbedlamp_dimmer_colortemp.sendCommand(ON)}
if (E2Lbedlamp_dimmer_colortemp.state == ON) {E2Lbedlamp_dimmer_colortemp.sendCommand(OFF)}
end
Working!
rule "bedlamp aan uit"
when
Channel "mihome:86sw2:158d0001641c68:ch1" triggered
then
E2Lbedlamp_dimmer_colortemp.sendCommand(ON)
end
How can i check if my comparison is ok?
is the state of a HUE bulp a string, constant (ON/OFF) or 0/1 ??
My Rule file read correctly, no errors related to this in openhab.log as far as i can see
Additional, a good way to debug these kind of issues is typically to include some logging directly after the then to check what E2Lbedlamp_dimmer_colortemp.state returns:
logInfo("BedlampTest","State of bedlamp is " + E2Lbedlamp_dimmer_colortemp.state.toString)
If the Item is ON, we turn it off. If it’s anything else - OFF, UNDEF, 22, “alpha” etc. - we turn it on.
That’s often good enough to deal with unexpected NULL states.
I think in this case though you’ll need to think about the states of a dimmer type Item, as Rich says.