How do I merge two "Set point's" together?

How do I merge two “Set point’s” together?

So I have these two “Set Point’s” that I want to have control of separately but, I want to have the availability to control both of them at the same time.

Here is what they look like

Setpoint item=temp2min label="Temperature [%d C]" icon="temperature" minValue=0 maxValue=40 step=1
Setpoint item=temp2max label="Temperature [%d C]" icon="temperature_hot" minValue=0 maxValue=40 step=1

Afterwards they are being used in rules to be sent to MQTT, it’s for a thermostat, anyways could anyone showme how to create a one set point that could control both of these, but still have these to at the same time? Any response is greatly appreciated :slight_smile:

My question is: How do you want them to behave, when one item is set to another level?

The easiest way would be to define a proxy item:

Number temp2linked "linked temperature"

and use a simple rule:

rule "linked temp2"
    Item temp2linked changed
    //previousState is available in rules, triggered with 'changed'
    var Number change = (temp2linked.state as Number) - (previousState as Number)
    temp2max.sendCommand((temp2max.state as Number) + change)
    temp2min.sendCommand((temp2min.state as Number) + change)

This would virtually link both setpoints to one, i.e. you will shift the range without changing the range width.
As an alternative, you could use one of the items to shift the range and the other item to change the width:

rule "linked temp2"
    Item temp2max changed
    var Number change = (temp2max.state as Number) - (previousState as Number)
    temp2min.sendCommand((temp2min.state as Number) + change)

So if you change temp2max, temp2min will also change, but if you change temp2min, temp2max will not.

If you want to change all temperatures to the same level, for example to set preferred temperature for all rooms, I would suggest to put all setpoints to a group and set the group.

1 Like

Will try it in the morning, I want to be able to use a third setpoint that could control both temp2max and temp2min but whenever i would change temp2max or temp 2min it wouldnt change the third setpoint

The second option worked with a little bit of edit. Thanks anyway. :slight_smile: