Troubleshooting Contact Sensor Rules in Smart Home

Hey everyone, I’m trying to set up a rule for my contact sensor, but I’m running into some issues. Let me share my experience and see if anyone can help me figure this out!

So, I’ve been using a Xiaomi sensor before, and the rules worked perfectly. But now, with the HM-IP Contact sensor, things aren’t as smooth. I created a rule to trigger some lights when the contact sensor changes state, but it doesn’t seem to work. Here’s what my rule looks like:

plaintext
rule “Test Licht”
when Item FensterkontaktKuche1STATE changed
then
switch FensterkontaktKuche1STATE.state {
case OPEN: {
HueLightstripWohnzimmer_Alert.sendCommand(“LSELECT”)
HueIrisEssbereich_Alert.sendCommand(“LSELECT”)
}
case CLOSED: {
HueLightstripWohnzimmer_Alert.sendCommand(“LSELECT”)
HueIrisEssbereich_Alert.sendCommand(“LSELECT”)
}
}
end

Interestingly, this simpler rule works fine:

plaintext
rule “Test”
when Item FensterkontaktKuche1STATE changed from CLOSED to OPEN
then
HueLightstripWohnzimmer_Alert.sendCommand(“LSELECT”)
HueIrisEssbereich_Alert.sendCommand(“LSELECT”)
end

I’m a bit confused about why the first rule isn’t working. Is there something wrong with the way I’m handling the state changes? Also, I noticed that the item from the HM-IP Contact isn’t defined as a contact item—it’s a string item. Could that be the issue?

I’d really appreciate any insights or suggestions on how to fix this. Maybe there’s a configuration I’m missing or a different approach I should take. Thanks in advance for your help!