Home assistant node red jsonata syntax

I am pretty new to Home assistant and Node red. I am having a syntax problem that I hope to resolve. I have two thermostats that I want to turn on at the same time by bumping up the “temperature” on each Generic Thermostat. I am using node red to do this. I want to set one thermostat to one degree colder that the other. This is the data field in the call service node which uses a number input to set the temp. {“temperature” : “{{payload}}”} this works great. In the other call service I would like to change/lower the input number by one. {“temperature” : “{{payload}} -1”} obviously that is wrong, but I don’t know what right looks like. I have also tried a function node with something like this “payload” : “payload” - 1. That doesn’t work. Yet “payload” : 1 + 1 outputs a value of 2… I just need help with syntax! Looked every where for an example of how to decrement a variable in jsonata… Thanks in advance!

A guess… {“temperature” : “{{payload -1}}”}

If that doesn’t work then add a function node between the two call services and add this code:

msg.payload = msg.payload -1;
return msg;

JSONata doesn’t use curly brackets.


{"temperature": payload  - 1 }

Thanks so much! That was the info I was looking for!