I’m looking for a way to collect data from sensors on remote rest web server. But can’t find a way to include dynamic sensor data into request payload.
I tried to create a rest sensor that sends info to remote server with post and receives a target temperature. It works exept payload is static and includes sensor’s name, not value.
sensor:
- platform: rest
name: web_sensor
resource: http://host:port/url
method: POST
headers:
Content-Type: application/json
payload: >
{
"current_temp": "{{ states('sensor.temperature_sensor')|float }} "
}
json_attributes:
- target_temp
value_template: 'OK'
On remote server’s side request body is:
{"current_temp": "{{ states('sensor.temperature_sensor')|float }}"}
Please, guys, show me the way I can make classic REST POST requests with dynamil payload.
Tnanks.