Left and Right functions

I can’t seem to find this anywhere. I use .left() and .right() in a couple of rules since OH 1. They seem to work in OH2 but designer claims the method doesn’t exist. I can’t seem to find the new functions for this.

postUpdate(NUM_DSC_Vender_Status, PANEL_MESSAGE.state.toString.left(3))

Designer complains about a lot, but as long as your rules work don’t worry.
In some files i have loads of complaints in Designer but rules run OK.

OK, That’s fine, I’m just trying to find anything that might cause my rules engine to lock up.

Hi

Did anyone get an answer to this?

I have a rule that works perfectly, until the incoming string is more than 64 characters, then the recieving device just rejects the whole command.

Current rule

rule "Sonos to Velbus Memo text"
when
Item Sonos_Title changed
then

Velbus_memo_text.sendCommand(Sonos_Title.state)

end

Should something like this work? (In openHAB2 2.5 M1)

rule "Sonos to Velbus Memo text - Left 63"
when
Item Sonos_Title changed
then

Velbus_memo_text.sendCommand(Sonos_Title.state.toString.left(63))

end

Have you tried it?
The original post was about OH Designer not recognizing the methods; I shouldn’t think you are using Designer.

That’s an excellent observation.
I’m not using the designer (to be honest I don’t know what it is).

I’ll simply “try” what I’ve put here and see what happens…

“What’s the worst that can happen”, said the drunk parachute instructor…

It was the old VS Code. It was an eclipse based openHAB editor,. It was good but never really worked as well as VS Code.

1 Like