Comparison of two temperatures

I'm new to Node Red and can't figure out how to compare two values ( two temperatures). I get two temperatures from openhab (current temperature and target temperature). How do I compare them and, if the condition is met, start a further action? For example:1. The target temperature is 23 degrees, the current temperature is 25, i.e. you need to close the tap on the battery. 2. The target temperature is 23 degrees, the current temperature is 20, i.e. you need to open the tap on the battery. The hysteresis is 1 degree. How to implement it? Using the node function?

Are they in the same message?

In different

See this article in the cookbook for an example of how to join messages into one object. Then you can access the two properties in a function node at the same time.

if you do a search in the manage pallet section of the editor for thermostat nodes there are several out there you may find useful. Of course I'm fairly certain that people here have probably rolled their own as well and they may be willing to share.

I didn't find anything suitable, there are no ideas other than trying to write in java. In general I thought this would be a common situation

Have a look at:

This is not the case, the target temperature is set in the application and not written in the node

You can set the target programmatically.

Register it in node, but how to change it? Constantly go in and change?

See setTarget

To set the target temperature, the topic should be called SetTarget?

I've used that node and the only gotcha is any command you use to set temperature is transient so be careful to take steps to make it do what you want on power up, or make sure sure it powers up like you think.
[Edit]
watch your capitalization on your commands

How to work with it? I get the target temperature from OPENHAB, then use node function to convert the value to a numeric value, and how do I set the target temperature?

@cflurin actually wrote the node so he's the expert but while waiting for him
msg = {
payload: 22, // or whatever current is
topic: 'setCurrent,
}

That tells it where the temp is

msg ={
payload: 25, // or whatever you want temp to be
topic: 'setTarget',
}

sets where you want temp to go
[edit]
You are probably going to need a function node or two in front of this to get the messages into a format you can use and to store temps possibly, also some widgets on dashboard to adjust the settings

Nothing is clear... I got two temperatures, removed the temperature sign, and converted them to a numeric format. What to do next?

It may help if you posted your flow

[{"id":"2359a6f.6d6f85a","type":"tab","label":"Warm","disabled":false,"info":""},{"id":"5f450b9e.721934","type":"openhab2-in","z":"2359a6f.6d6f85a","name":"Cabinet_temp","controller":"ac368245.00ba1","itemname":"Temperature_cabinet","x":90,"y":140,"wires":[["79b1b959.ce0468"],[]]},{"id":"218a1f48.ad847","type":"openhab2-in","z":"2359a6f.6d6f85a","name":"Target_temp","controller":"ac368245.00ba1","itemname":"Target_temp_cabinet","x":110,"y":60,"wires":[["a4b33d28.92113"],[]],"info":"Целевая температура для поддержания"},{"id":"3faaa291.62672e","type":"comment","z":"2359a6f.6d6f85a","name":"Батарея в кабинете","info":"","x":160,"y":20,"wires":[]},{"id":"a4b33d28.92113","type":"function","z":"2359a6f.6d6f85a","name":"Number_format","func":"msg.payload = Number (msg.payload)\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":400,"y":40,"wires":[["e84ca637.d8d478"]]},{"id":"79b1b959.ce0468","type":"change","z":"2359a6f.6d6f85a","name":"Clear","rules":[{"t":"change","p":"payload","pt":"msg","from":" °C","fromt":"str","to":"","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":450,"y":220,"wires":[["53011dcc.f405c4"]]},{"id":"53011dcc.f405c4","type":"function","z":"2359a6f.6d6f85a","name":"Number_format","func":"msg.payload = Number(msg.payload).toFixed(1)*1;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":780,"y":220,"wires":[["e84ca637.d8d478"]]},{"id":"e84ca637.d8d478","type":"debug","z":"2359a6f.6d6f85a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1100,"y":120,"wires":[]},{"id":"ac368245.00ba1","type":"openhab2-controller","name":"OpenHabServer","protocol":"http","host":"192.168.88.1","port":"8080","path":"","username":"","password":""}]

I don't run openhab so I have no idea what that data will look like. So in my flow I've used some inject nodes to simulate data coming in. I set the nodes to string just in case your data comes in a string format then I convert to a number.

[{"id":"2359a6f.6d6f85a","type":"tab","label":"Warm","disabled":false,"info":""},{"id":"3faaa291.62672e","type":"comment","z":"2359a6f.6d6f85a","name":"Батарея в кабинете","info":"","x":240,"y":40,"wires":[]},{"id":"a4b33d28.92113","type":"function","z":"2359a6f.6d6f85a","name":"set current","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setCurrent',\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":120,"wires":[["e84ca637.d8d478","b55a10cf.c78568"]]},{"id":"53011dcc.f405c4","type":"function","z":"2359a6f.6d6f85a","name":"set target","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setTargt',\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":220,"wires":[["e84ca637.d8d478","b55a10cf.c78568"]]},{"id":"e84ca637.d8d478","type":"debug","z":"2359a6f.6d6f85a","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":120,"wires":[]},{"id":"b55a10cf.c78568","type":"ramp-thermostat","z":"2359a6f.6d6f85a","name":"test","profile":"79f20c8c.fe6764","hysteresisplus":"1","hysteresisminus":"1","x":790,"y":220,"wires":[["d8c8af25.7b31c8"],["bdb90a8a.0b02d8"],["af6efea8.67e878"]]},{"id":"872e9ee6.23ca38","type":"inject","z":"2359a6f.6d6f85a","name":"current temp","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setCurrent","payload":"21","payloadType":"str","x":200,"y":120,"wires":[["a4b33d28.92113"]]},{"id":"9d9d8dca.7732a8","type":"inject","z":"2359a6f.6d6f85a","name":"target","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setTarget","payload":"25","payloadType":"str","x":210,"y":220,"wires":[["53011dcc.f405c4"]]},{"id":"d8c8af25.7b31c8","type":"debug","z":"2359a6f.6d6f85a","name":"A","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":200,"wires":[]},{"id":"bdb90a8a.0b02d8","type":"debug","z":"2359a6f.6d6f85a","name":"B","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":280,"wires":[]},{"id":"af6efea8.67e878","type":"debug","z":"2359a6f.6d6f85a","name":"C","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":360,"wires":[]},{"id":"b351a6e0.7595a","type":"inject","z":"2359a6f.6d6f85a","name":"hysteresis plus","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":230,"y":340,"wires":[["bd34c740.60466"]]},{"id":"bd34c740.60466","type":"function","z":"2359a6f.6d6f85a","name":"set hysteresis plus","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setHysteresisPlus',\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":340,"wires":[["b55a10cf.c78568","e84ca637.d8d478"]]},{"id":"9e24fb02.4ad3d8","type":"inject","z":"2359a6f.6d6f85a","name":"hysteresis minus","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":240,"y":420,"wires":[["4d43a817.260308"]]},{"id":"4d43a817.260308","type":"function","z":"2359a6f.6d6f85a","name":"set hysterisis minus","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setHysteresisMinus',\n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":420,"wires":[["b55a10cf.c78568","e84ca637.d8d478"]]},{"id":"79f20c8c.fe6764","type":"profile","name":"test","time1":"","temp1":"","time2":"","temp2":"","time3":"","temp3":"","time4":"","temp4":"","time5":"","temp5":"","time6":"","temp6":"","time7":"","temp7":"","time8":"","temp8":"","time9":"","temp9":"","time10":"","temp10":""}]

there are a lot of things missing such as how to get dashboard data into the node but maybe this will at least show you the basics of what you need. If you go into the link @cflurin provided showing the node there is a lot of example code there you should look at. Also, in your flow you don't have node loaded so that my be a starting point. Get the node installed and use inject nodes to see what happens. My base flow should be a start for that. It's just not possible to try to guess what you want to do or how to do it as there are so many scenarios so try to muddle through as best as you can and when you get stuck ask questions. I'm not a great programmer but this node I've used so I do have some familiarity with it. There are lots of really good programmers here to help as well.
Keep trying

[{"id":"2359a6f.6d6f85a","type":"tab","label":"Warm","disabled":false,"info":""},{"id":"3faaa291.62672e","type":"comment","z":"2359a6f.6d6f85a","name":"Батарея в кабинете","info":"","x":240,"y":40,"wires":[]},{"id":"a4b33d28.92113","type":"function","z":"2359a6f.6d6f85a","name":"set current","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setCurrent',\n}\nnode.status({fill:\"blue\",shape:\"dot\",text:msg.payload});\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":470,"y":120,"wires":[["e84ca637.d8d478","b55a10cf.c78568"]]},{"id":"53011dcc.f405c4","type":"function","z":"2359a6f.6d6f85a","name":"set target","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setTarget',\n}\nnode.status({fill:\"blue\",shape:\"dot\",text:msg.payload });\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":440,"y":220,"wires":[["e84ca637.d8d478","b55a10cf.c78568"]]},{"id":"e84ca637.d8d478","type":"debug","z":"2359a6f.6d6f85a","name":"debug","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":790,"y":120,"wires":[]},{"id":"b55a10cf.c78568","type":"ramp-thermostat","z":"2359a6f.6d6f85a","name":"test","profile":"79f20c8c.fe6764","hysteresisplus":"1","hysteresisminus":"1","x":790,"y":220,"wires":[["d8c8af25.7b31c8"],["bdb90a8a.0b02d8"],["af6efea8.67e878"]]},{"id":"872e9ee6.23ca38","type":"inject","z":"2359a6f.6d6f85a","name":"current temp","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setCurrent","payload":"21","payloadType":"str","x":200,"y":120,"wires":[["a4b33d28.92113"]]},{"id":"9d9d8dca.7732a8","type":"inject","z":"2359a6f.6d6f85a","name":"target","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"setTarget","payload":"25","payloadType":"str","x":210,"y":220,"wires":[["53011dcc.f405c4"]]},{"id":"d8c8af25.7b31c8","type":"debug","z":"2359a6f.6d6f85a","name":"A","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":200,"wires":[]},{"id":"bdb90a8a.0b02d8","type":"debug","z":"2359a6f.6d6f85a","name":"B","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":280,"wires":[]},{"id":"af6efea8.67e878","type":"debug","z":"2359a6f.6d6f85a","name":"C","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":950,"y":360,"wires":[]},{"id":"b351a6e0.7595a","type":"inject","z":"2359a6f.6d6f85a","name":"hysteresis plus","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":230,"y":340,"wires":[["bd34c740.60466"]]},{"id":"bd34c740.60466","type":"function","z":"2359a6f.6d6f85a","name":"set hysteresis plus","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setHysteresisPlus',\n}\nnode.status({fill:\"blue\",shape:\"dot\",text:msg.payload });\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":340,"wires":[["b55a10cf.c78568","e84ca637.d8d478"]]},{"id":"9e24fb02.4ad3d8","type":"inject","z":"2359a6f.6d6f85a","name":"hysteresis minus","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":240,"y":420,"wires":[["4d43a817.260308"]]},{"id":"4d43a817.260308","type":"function","z":"2359a6f.6d6f85a","name":"set hysterisis minus","func":"let z = Number(msg.payload);\nmsg = {\n    payload: z,\n    topic: 'setHysteresisMinus',\n}\nnode.status({fill:\"blue\",shape:\"dot\",text:msg.payload });\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":500,"y":420,"wires":[["b55a10cf.c78568","e84ca637.d8d478"]]},{"id":"79f20c8c.fe6764","type":"profile","name":"test","time1":"00:00","temp1":"10","time2":"23:59","temp2":"10","time3":"","temp3":"","time4":"","temp4":"","time5":"","temp5":"","time6":"","temp6":"","time7":"","temp7":"","time8":"","temp8":"","time9":"","temp9":"","time10":"","temp10":""}]

missed a couple of things in first flow, use this one