Is there a way to set a dynamic minValue maxValue on a Setpoint based on Number Item value?

Hello! I’ve been trying to figure out a way to set a dynamic maxValue for a Setpoint. Here is an example of what I want to do:

//Items File
Number Set_Temp
Number Temp_Limit

//Sitemap File
Setpoint item=Set_Temp minValue=0 maxValue=Temp_Limit.state step=1 icon=“temperature”

Of course, with the above, it does not work. Is there anyway I can make the max and min Values in a setpoint dynamic depending on a Number Item?

Thank you!

AFAIK this is not possible, but you could use a rule as a workaround, like this:

rule setTempLimit
when 
Item Set_Temp received command
then
if(Set_Temp.state>Temp_Limit.state)
{
Set_Temp.sendCommand(Temp_Limit.state.toString)
}
end

Does this suit your needs?

Thank you for your help! I really appriciate the rule code as well! I think this will work, ok!

Here is an update. I tried to use the rule code to limit the setpoint limits externally, but at the limits, there were definitely some issues due to the rules counteracting the user input in realtime. Sometimes, I would be able to set the value higher than the limit when the rule would not be able to keep up. I tried to introduce delays in the rules to make sure the value gets overwritten, but that didn’t 100% either.

The solution I was able to find would be helpful for people who have a finite set number of limits they want to use. (ie. not an infinite variable amount) I was able to use the visibility flag to have many identical looking setpoints but with different limits. Here is an example:

//Items File
Number Set_Temp "Temp: [%.0f °C]"
Number Temp_Limit “Temp Limit: [%.0f]”

//Sitemap File
Setpoint item=Temp_Limit minValue=10 maxValue=30 step=5 icon=“none”//This is the “controller” for the Temp_Limit
Setpoint item=Set_Temp minValue=0 maxValue=10 step=1 icon=“temperature” visibility=[Temp_Limit==“10”]
Setpoint item=Set_Temp minValue=0 maxValue=15 step=1 icon=“temperature” visibility=[Temp_Limit==“15”]
Setpoint item=Set_Temp minValue=0 maxValue=20 step=1 icon=“temperature” visibility=[Temp_Limit==“20”]
Setpoint item=Set_Temp minValue=0 maxValue=25 step=1 icon=“temperature” visibility=[Temp_Limit==“25”]
Setpoint item=Set_Temp minValue=0 maxValue=30 step=1 icon=“temperature” visibility=[Temp_Limit==“30”]

I hope this helps others who wanted to do something similar. Of course, with rules, you can postUpdate Set_Temp if the Temp_Limit changes and the Set_Temp is higher and out of range. Also, with rules, you can set a minValue and maxValue too, but then you will have to create an even great number of setpoint items.

If anyone has feedback on this solution, please let me know!