Just a minute here.
You CANNOT issue a command and then immediately look at the target Item state to see if it happened.
This stuff is asynchronous - sendCommand posts the request off to the openHAB bus,
That may or may not eventually do something to do the Item state - but it takes time.
Meanwhile the rule code just carries on.
When you logInfo item.state, any command won’t have been actioned yet.
Go look in your events.log to see if commands are issued.
You’ve maybe got a space e.g." OFFICE"
You can check
default: {
logInfo("myRule_default", "value receivedCommand is x{}x", receivedCommand.toString)
}
if it turns out that way, then make the rule foolproof
Wow, so receivedCommand.toString.trim did the trick with no further changes to the rule. I honestly have no idea why this leads to working for the second choice in this case but you helped me to get it working finally Thank you so much @rossko57
All .trim does is remove spaces from the beginning or end of a string.
switch/case looks for exact matches, " FRED" does not match “FRED”
Looks like HABpanel is sending " OFFICE", you can prove that with a careful logInfo.
It’ll be doing that because it thinks its been asked to do that.
Looking at an earlier widget screenshot, I see
WOHNZIMMER, OFFICE
and I think that looks suspicious.
Try
WOHNZIMMER,OFFICE