Basic tutorial on REST sensors?

It would help if you included the sensor config that isn’t working.

If you are using a template, as per the docs, you must use resource_template: not resource:. My guess is that you haven’t done that, but without your code, it’s just a guess.

resource_template: "https://aa.usno.navy.mil/api/seasons?year={{ now().year }}"

Thank you. I was not using resource_template but the example you gave works. I appreciate the help.

2 Likes

Is there a way to send custom JSON formatted HTTP POST to a restful sensor?
I am willing to get data from helium console. Helium console will send a HTTP POST request to some HTTP server each time a LoRA sensor is sending data, mine sends each 30 minutes.
I haven’t manage to customize the body in helium console so i have to parse it in home assistant.
But home assistant is responding to the http post request with an error, no state specified.
Is there a way how to solve this?
Thak you and best regards.

You need the external system to adhere to HA’s API for posting a sensor value. If that’s not possible, you have two options:

The one option is to register a webhook and use that with a trigger-based template sensor.

The other option is to intercept the call: in other words, post it to an intermediary where you can transform it before posting it to HA. This could be as simple as using Nginx.