Passing variables to Node-RED endpoint

Hi, I’m new to Node-RED and am setting up endpoints to allow me to control some thermostats in HomeAssistant. I’d like to set up an endpoint to set the temperature for the thermostat but I’m unclear how to do this.

Let’s say my endpoint is xxx/endpoint/mbr_set_temp. Can I add a token to the endpoint and do something like this?

xxx/endpoint/mbr_set_temp?setpoint=72

If I can do this, how do I format the JSON text in the data field in Node-RED so the 72 gets passed to the set_temperature service call?

Thanks in advance for your help.

For anyone who is interested, I figured out how to accomplish this:

  • In the “http in” node name your endpoint like this (in this example I’m trying to send a temperature to Node-RED): homeassistant.local/endpoint/mbr_set_temp/:settemp

  • Ini the “call service” node define the data field using the following format: { "temperature": "{{req.params.settemp}}" }

Hope this can help someone trying to control Node-RED using endpoints and simple HTTP requests coming from other home automation platforms, or from browsers.