[SOLVED] OFFSET Profile: Can offset <value> be a variable?

Hello,

I was wondering if I could specify a variable for the offset value instead of a fixed value to be able to adjust the offset value at runtime?

Like replacing <value> which could be e.g. "2 °C" with a variable adjust_calibration_value.state and setting this variable for example:

adjust_calibration_value.postUpdate("4.5 °C")

Offset Profilet with value:

Number <itemName> { channel="<bindingID>:<thing-typeID>:<thingName>:<channelName>"[profile="offset", offset="<value>"]}

Offset Profile with variable:

Number <itemName> { channel="<bindingID>:<thing-typeID>:<thingName>:<channelName>"[profile="offset", offset=adjust_calibration_value.state]}

Thanks for clarifying!

Cheers
Justus

I don’t think this is possible, maybe in the future.
This is easily achievable with a rule, though

Yes but with the new syntax for an item with Number:Temperature and [%.1f %unit% :

Number:Temperature ZwaveDvTemp  "Temperatur DB [%.1f %unit%]"        (gZwave)  {channel="zwave:device:564c8ec1:node6:sensor_temperature"}

I get this error for my calibration rule:

12:03:15.702 [ERROR] [untime.internal.engine.RuleEngineImpl] - Rule 'Calibration of Devolo Temperature': Could not cast 23.8777777777777777777777777777778 °C to org.eclipse.smarthome.core.library.types.DecimalType; line 24, column 34, length 32

Here is the rule:

rule "Calibration of Devolo Temperature"
  when
    Item ZwaveDvTemp changed or
    Item DvTempCalibWert changed
  then
    ZwaveDvTempCorr.postUpdate( (ZwaveDvTemp.state as DecimalType) + (DvTempCalibWert.state as DecimalType) )
end

I changed it from DecimalType to QuantityType but I don’t know if this is correct:

rule "Calibration of Devolo Temperature"
  when
    Item ZwaveDvTemp changed or
    Item DvTempCalibWert changed
  then
    ZwaveDvTempCorr.postUpdate( (ZwaveDvTemp.state as QuantityType) + (DvTempCalibWert.state as QuantityType) )
end
rule "Calibration of Devolo Temperature"
  when
    Item ZwaveDvTemp changed or
    Item DvTempCalibWert changed
  then
    ZwaveDvTempCorr.postUpdate((ZwaveDvTemp.state as QuantityType<Number>).doubleValue + (DvTempCalibWert.state as QuantityType<Number>).doubleValue)
end
1 Like

Thanks Vincent,

I really appreciate your quick and great response!!!

But this is rocket science to me :thinking:

I changed it and will give feedback if it works!!! But it looks good so far!!!

Awesome, mate!!!

Thanks
Justus

Would it make sense to address this as a future feature request?
And where should I write down this request to be considered?

this post was chinesee to me i use node red for any value that is not coming up good in OH :slight_smile: (the noob workaround)

for missing core fetures i think you can commit here

Thanks for this link … will submit this idea later … family weekend first :wink:

Actually, it would be better to post in the new Development / Core category for something like this I think. Or open a new feature request. Unfortunately, I don’t know the correct repo to post to at this time. Perhaps the openhab2-addons repo.

Thanks for your reply … I will have a closer look and be careful to find out the right source to raise this request :+1: :slight_smile: