Sending data from external network using rest api

Hi, I’m trying to send temperature from external network(i.e. mobile data) using rest, after i get it working this will be used for python script on another raspberry pi.
For authentication long term token used, in postman app its called “Bearer Token”
I created device in configuration.yaml

sensor:

  • platform: rest
    name: DS18B20_Solution_Temperature
    resource: https://homeassistant_domain.org/api/states/sensor.ds18b20_solution_temperature
    value_template: “{{ value_json.state }}”
    unit_of_measurement: “°C”
    device_class: temperature

Rebooted HA -


To test it I used a postman software with following body:

{
“state”: 23,
“attributes”: {
“unit_of_measurement”: “°C”,
“device_class”: “temperature”,
“friendly_name”: “DS18B20_Solution_Temperature”
}
}

Postman response i got:

{
“entity_id”: “sensor.ds18b20_solution_temperature”,
“state”: “unknown”,
“attributes”: {
“unit_of_measurement”: “°C”,
“device_class”: “temperature”,
“friendly_name”: “DS18B20_Solution_Temperature”
},
“last_changed”: “2025-02-19T06:29:45.830027+00:00”,
“last_reported”: “2025-02-19T06:44:15.930104+00:00”,
“last_updated”: “2025-02-19T06:29:45.830027+00:00”,
“context”: {
“id”: “01JMEEBVQ6T31Y4R2GX873TQSG”,
“parent_id”: null,
“user_id”: null
}
}

Log:

What I’m doing wrong, please help fix.

At this time fixed issue - changed call method from GET to POST, and it worked as expected for now.
Writing a help post for 15 minutes, then try simple thing and find answer :slight_smile:

2 Likes