[Solved] Set tempature by a dynamic value

Hello together,

I’m struggle with the following task.

“Set the temperature value from my room by a dynamic value.”

var myTemperature as Number

This run in an error: “cannot be resolved to an item or type”

It works with a predefined value. Like this.

var myTemperature = 20|°C

I need your help.

In your first you are trying to postUpdate with a plain number, in the second one you are using a number:temperature.
Why don’t you try something similar with the first example, like:

roomHeating.postUpdate(myTemperature | °C)

Sorry, I can’t test that ATM.

Hi opus,

nice idea, but i get the follow error message
… has errors, therefore ignoring it: [94,57]: no viable alternative at input ‘°C’

I think it’s only one argument allowed. But i do not know which type of data is required.

How are you calculating myTemperature? It may be easier to define it as a QuantityType from the start, and then use QuantityType’s methods for performing the calculations. If not, you’d need to use this format in the sendCommand…

roomHeating.postUpdate(new QuantityType(myTemperature.toString + " °C"))

Thanks Scott!!

Your have solved this topic.