HSBType from OH2 Rule (file) does not work with OH3 (UI rule)

Currently I am running an „old“ OH2 server and a new „OH3“ server to take over. On the old server, I have a .rules files with some scenes invoked by a four-button-switch for my home-cinema. Not very high tech, but working fine.

For the new server I broke up the .rules file to separate DSL UI-rules for each scene. Everything is working fine in both worlds except the „end of movie“-scene on OH3 which includes an eye-friendly „sun-rise“ of a HUE light.

var i = 0
var hue = 1
var sat = 100
var bright = 0

  while ((i=i+4)<60)
    hue = i/2
    sat = 100-i
    bright = i
    LichtTischKaminzimmer_Farbe.sendCommand (new HSBType(new DecimalType(hue), new PercentType(sat), new PercentType(bright)))
gEG_Kaminzimmer_Hue_Play_Color.sendCommand (OFF)

The line with the .sendCommand always gives me an errors like

The extension methods

	sendCommand(Item, Command) in BusEvent and

	sendCommand(Item, Number) in BusEvent

both match.; line 14, column 302, length 11

I read a lot over the last two days about problems and differences in the handling of HSBType between OH2 and OH3 and tried several different approaches to send the new color-value to the item, but none of them worked.

Any ideas?

sendCommand can be quite picky about what sort of objects you feed it. Object types that represent Item states are not the same as types representing commands.
senCommand always accepts strings though, and then tries to parse them into the object type it wants.

LichtTischKaminzimmer_Farbe.sendCommand ( new HSBType(new DecimalType(hue), new PercentType(sat), new PercentType(bright)).toString )

Of course that means you need not send an HSB at all

LichtTischKaminzimmer_Farbe.sendCommand ( hue.toString + " , " + sat.toString + " , " + bright.toString )

Thank you so much. That version was not among the things I tried. But it is the one that works!

1 Like