However, the temperature set for Thermo1 should also be transferred to ThermoMapping, if available (if nothing is selected in the mapping).
How is this possible?
This is not working:
rule "Heizung2Mapping"
when
Item Thermo1 changed
then
ThermoMapping.sendCommand(Thermo1.state.toString)
end
Explanation: If you set 18°C in ThermoMapping and then freely adjust the temperature in Thermo1, the (now incorrect) 18°C remains displayed in ThermoMapping and when you click on 18°C nothing happens. (You first have to click on another temperature and then on 18°C).
Typically you’ll want to postUpdate instead of commanding the Item unless that Item is linked to a Channel and you want the device to do something. In this case you are just keeping two Items in sync inside of OH so updates are what you want to use.
Both Thermo1 and TermoMapping are Number Items?
Note, if you freely adjust Thermo1 to anything other than exactly 18, 20, and 22 (note 18.0 is not the same as 18 in this case), there won’t be a mapping that matches the current state of the Item so it won’t change because it has nothing to change to.
Finally, I’m not certain that BasicUI updates the mappings without a refresh of the page anyway.
To control the thermostat, it does not matter whether it is an Int or Float (with a decimal place).
But you are right, for mapping it must be exactly the same number.
Quite funny, but I restarted my OH (because of other errors) and now the code I posted above works to set the mapping.
Thank you, it works, but not as intended. You save a variable, but the mapping is never marked, you always have to press the button twice for this.
And if you change the temperature manually in the setpoint, the temperature is unfortunately not visible in the mapping.
What exactly do you want to see? If you want to see the exact set point temperature @Lolodomo gave the answer above I think. Add the format to your label.
"Temperature [%d °C]" or %s depending on what formatting you want. typed on a phone so double check that degree symbol.
What you want to achieve can be done using one item like I posted above.
The key here is to make sure the mapping command matches the item’s state. I’m guessing (since I haven’t seen your item’s definition) that Thermo1 is a Number:Temperature item?