Designer showing syntax errors in workig rules

I’ve just started using Designer to edit my config files. I had been using vim. All my rules are working properly, but in Designer, I’m seeing syntax errors for many of these working rules. Heres an example:

when
	Item ZGarage_Switch received command OFF
then
    	val HSBType white = new HSBType(new DecimalType(0),new PercentType(0),new PercentType(100))
	ZGarage_Color_Control.sendCommand(white)  // syntax error here

	ZGarage.sendCommand(receivedCommand)
	ZGarage_Switch.postUpdate(OFF)
end```

When I hover the mouse over the error indicator, it says:
 
```Ambiguous feature call.
The extension methods
	sendCommand(Item,
   Number) in BusEvent and
	sendCommand(Item, Command) in BusEvent
both
   match.

Is there something I can do to clear these errors?

I’m actually surprised that isn’t throwing errors in your OH log as well. What version of OH are you running? Another common time one might encounter that problem is when calling sendCommand or postUpdate using a DecimalType.

The problem is HSBType is a Number and is also a Command and therefore the Rules Engine doesn’t know if you mean to call ZGarage_Color_Control.sendCommand(Number) or ZGarage_Color_Control.sendCommand(Command)`. You can get around this by telling it which to use:

ZGarage_Color_Control.sendCommand(white as Command)

or sending the String which will be parsed back into a proper HSBType

ZGarage_Color_Control.sendCommand(white.toString)

NOTE: Since you just switched I hate to say the ESHD is basically end of life in favor of VSCode with the openHAB extension. If you are on the latest SNAPSHOT it will even do syntax checking for you now, making it feature complete with ESHD, only better. You might consider giving it a try.

If you are on the 2.1 release, wait until you upgrade to the 2.2 before making the switch though as in those earlier versions OH doesn’t have support for syntax checking .

Also, be aware that there are a lot of things ESHD will mark as errors that are not errors, primarily these are new features in OH 2 and include:

  • Items and Things defined via PaperUI
  • Non core Actions
  • Anything that references Channels or Things directly from Rules (e.g. Channel triggers)

Great, thanks for the information. Shame Designer been EOL’d. I had been lazy about installing it as vim was adequate enough, but I’ve made just enough syntax errors, that I thought it would be worthwhile to install. I run OH2 on a RPi3 and connect via ssh to edit the files with vim. I installed Designer on my Mac and found it quite useful and well done. I’ll go ahead and install VSCode for my Mac and give it a try.
Thanks again.

Just got VSCode installed with the OH2 extension. Looks great, thanks.