RuleDSL: : Copying the value of a point to another item

Hello,
I would like to send the value of a Number:temperature point to an item:

RSTHeizkorperthermostat1Schlafzimmer_Solltemperatur.sendCommand(ABSchlaf.getState());

It results in the log message
Type mismatch: cannot convert from State to Command;

How to convert a state to a command?

ABSchlaf.getState() as QuantityType

1 Like

@JimT’s solution will work but note that not all states held by all Item types are both a State and a Command.

Other options that will work with most Items:

ABSchlaf.getState() as Command
ABSchlaf.getState().toString()

But only the toString() approach will work in those cases where the state of the Item is not a Command (ImageType is one, not sure if there are others).

1 Like