How to implement Setpoint in items


I am used the demo.items and demo.sitemap as a basis for my project.

As shown in demo.sitemap it uses ‘Group’ to list the items under that group.

sitemap demo label="Main Menu"
	Frame {
		Group item=gFF label="First Floor" icon="firstfloor"
		Group item=gGF label="Ground Floor" icon="groundfloor"
		Group item=gC label="Cellar" icon="cellar"
		Group item=Garden icon="garden"
Group gFF           "First Floor"   <firstfloor>
Group gGF           "Ground Floor"  <groundfloor>
Group gC            "Cellar"        <cellar>
Group Garden        "Garden"        <garden>
Group Weather       "Weather"       <sun>

Group Status
Group Shutters

Group GF_Living     "Living Room"   <video>     (gGF)
Group GF_Kitchen    "Kitchen"       <kitchen>   (gGF)
Group GF_Toilet     "Toilet"        <bath>      (gGF)
Group GF_Corridor   "Corridor"      <corridor>  (gGF)

Dimmer Light_GF_Living_Table        "Table"         (GF_Living, Lights)     ["Lighting"]
Switch Light_GF_Corridor_Ceiling    "Ceiling"       (GF_Corridor, Lights)
Switch Light_GF_Kitchen_Ceiling "Ceiling" (GF_Kitchen, Lights)

In this way, it will not need any addition in the site map, which is really cool

The question is:
I want to add ‘setpoint’ (in sitemap) in order to use it to set the temperature of a thermostat, but this will not comply with the above configuration.
What can be done in this case? Is there a way to avoid re-configuring the whole sitemap?

Thanks in advance

Not really. You can either use a Group element to put all the members of a Group on your sitemap using the Item defaults, or you have to list each item on the sitemap individually which will let you use a Setpoint with a Number Item instead of the default Text.

1 Like

There should be another way!

There is, it’s called HABpanel.

My long term plan is to switch to HABpanel.

I used Rollershutter as a workaround.

Number 			SetTemp_FF_Office_internal 		"Office-Internal [%.1f °C]"     <temperature> 	(gThermostat_internal)         							{mqtt="<[mqttbroker:/bo19/sw0250_SetTemperature:state:default]"}
Rollershutter 	SetTemp_FF_Office 				"Office [%.1f °C]"             	<temperature> 	(FF_Office, gThermostat)    ["TargetTemperature"]       {mqtt="<[mqttbroker:/bo19/sw0250_SetTemperature:state:default]", autoupdate="false"} //autoupdate="false": to avoid displaying 0 and 100

Since Rollershutter states are 0 and 100 (UP and DOWN), I disabled the item ‘autoupdate’ and created another item that is only used in a rule to mimic the Setpoint functionality in Sitemap.

    var Number MaxTemperature = 30
    var Number MinTemperature = 10

	rule "SetTemp_FF_Office Command Rule"
    	Item SetTemp_FF_Office received command
		var Number CurrentTemp
		var Number NewTemp
		//logInfo("receivedCommand", receivedCommand.toString )
		CurrentTemp = SetTemp_FF_Office_internal.state
		//logInfo("CurrentTemp", CurrentTemp.toString )
		if (receivedCommand.toString == "UP" ) {
		NewTemp = CurrentTemp + 0.5
		if (NewTemp > MaxTemperature) {
			NewTemp = MaxTemperature
		//logInfo("NewTemp", NewTemp.toString )
		publish("mqttbroker", "/bo19/sw0250_RemoteSetTemperature", NewTemp.toString) // sends MQTT command (MQTT Actions add-ons should be installed)
		if (receivedCommand.toString == "DOWN" ) {
		NewTemp = CurrentTemp - 0.5
		if (NewTemp < MinTemperature) {
			NewTemp = MinTemperature
		//logInfo("NewTemp", NewTemp.toString )
		publish("mqttbroker", "/bo19/sw0250_RemoteSetTemperature", NewTemp.toString) // sends MQTT command
    rule "SetTemp_FF_Office Status Rule" //Update the topic 'RemoteSetTemperature' with the latest set temp
    	Item SetTemp_FF_Office received update
	    var Number CurrentTemp
		CurrentTemp = SetTemp_FF_Office.state
		//logInfo("CurrentTemp", CurrentTemp.toString )
		publish("mqttbroker", "/bo19/sw0250_RemoteSetTemperature", CurrentTemp.toString) // sends MQTT command (MQTT Actions add-ons should be installed)

Openhab sent its ‘remoteSetTemperature’, then Thermostat mirror it to the actual ‘setTemperature’ value